Add crypto_pwhash_primitive()

This commit is contained in:
Frank Denis 2016-03-21 20:54:24 +01:00
parent 1820a4239d
commit 3fb2ee07cb
3 changed files with 11 additions and 0 deletions

View File

@ -83,3 +83,8 @@ crypto_pwhash_str_verify(const char str[crypto_pwhash_STRBYTES],
{
return crypto_pwhash_argon2i_str_verify(str, passwd, passwdlen);
}
const char *
crypto_pwhash_primitive(void) {
return crypto_pwhash_PRIMITIVE;
}

View File

@ -71,6 +71,11 @@ int crypto_pwhash_str_verify(const char str[crypto_pwhash_STRBYTES],
unsigned long long passwdlen)
__attribute__ ((warn_unused_result));
#define crypto_pwhash_PRIMITIVE "argon2i"
SODIUM_EXPORT
const char *crypto_pwhash_primitive(void)
__attribute__ ((warn_unused_result));
#ifdef __cplusplus
}
#endif

View File

@ -242,6 +242,7 @@ int main(void)
assert(crypto_pwhash_memlimit_moderate() > 0U);
assert(crypto_pwhash_opslimit_sensitive() > 0U);
assert(crypto_pwhash_memlimit_sensitive() > 0U);
assert(strcmp(crypto_pwhash_primitive(), "argon2i") == 0);
sodium_free(salt);
sodium_free(str_out);