diff --git a/src/libsodium/crypto_pwhash/crypto_pwhash.c b/src/libsodium/crypto_pwhash/crypto_pwhash.c index b9c87f19..b65b7209 100644 --- a/src/libsodium/crypto_pwhash/crypto_pwhash.c +++ b/src/libsodium/crypto_pwhash/crypto_pwhash.c @@ -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; +} diff --git a/src/libsodium/include/sodium/crypto_pwhash.h b/src/libsodium/include/sodium/crypto_pwhash.h index 75e0249f..78d01928 100644 --- a/src/libsodium/include/sodium/crypto_pwhash.h +++ b/src/libsodium/include/sodium/crypto_pwhash.h @@ -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 diff --git a/test/default/pwhash.c b/test/default/pwhash.c index c3d97a4b..41eb1e69 100644 --- a/test/default/pwhash.c +++ b/test/default/pwhash.c @@ -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);