arsd.argon2

My minimal interface to https://github.com/p-h-c/phc-winner-argon2

You must compile and install the C library separately.

Members

Functions

argon2id_hash_encoded
int argon2id_hash_encoded(uint32_t t_cost, uint32_t m_cost, uint32_t parallelism, void* pwd, size_t pwdlen, void* salt, size_t saltlen, size_t hashlen, char* encoded, size_t encodedlen)

Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.

argon2id_verify
int argon2id_verify(char* encoded, void* pwd, size_t pwdlen)

Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.

encode
string encode(string password, SecurityParameters params)

encode a password for secure storage. verify later with verify

verify
bool verify(string savedPassword, string providedPassword)

Check's a user's provided password against the saved password, and returns true if they matched. Neither string can be empty.

Manifest constants

ARGON2_OK
enum ARGON2_OK;

Undocumented in source.

HighSecurity
enum HighSecurity;
LowSecurity
enum LowSecurity;
MediumSecurity
enum MediumSecurity;

Parameters to the argon2 function. Bigger numbers make it harder to crack, but also take more resources for legitimate users too (e.g. making logins and signups slower and more memory-intensive). Some examples are provided. HighSecurity is about 3/4 second on my computer, MediumSecurity about 1/3 second, LowSecurity about 1/10 second.

Structs

SecurityParameters
struct SecurityParameters

Parameters to the argon2 function. Bigger numbers make it harder to crack, but also take more resources for legitimate users too (e.g. making logins and signups slower and more memory-intensive). Some examples are provided. HighSecurity is about 3/4 second on my computer, MediumSecurity about 1/3 second, LowSecurity about 1/10 second.

Meta