Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Feb 24, 2023. It is now read-only.
This repository was archived by the owner on Feb 24, 2023. It is now read-only.

Argon2 native CPU module selection #2

@riptl

Description

@riptl

Like in nimiq/core-js#440 of core-js, I think it's useful to have a native module selection for packaged builds, and I'd like to take on this.

My idea is to statically link the different versions of libargon2 into the same binary, giving the function names a suffix of the target via a C macro.
We'd then have argon2d_hash_raw_avx2, argon2d_hash_raw_sse2 and so on built from the same source.

Like in nimiq/core-js#456, a $PACKAGING environment variable should be introduced, that will trigger a native build if it's false instead of the avx2, sse2… versions.

On startup, Rust then would set up function pointers to the native module and use rust-cupid to initialize them with the correct implementations.

I also filed #1 to reduce the number of functions so the module is easier to work with.

The alternative would be to dynamically load the implementations like the .node libraries in Node.js but that'd be more difficult and inconvenient, in my opinion.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions