Extend Argon2i support check to account for sodium_compat

This commit is contained in:
Michael Babker 2017-12-09 12:56:59 -06:00
parent 17b5a2ca65
commit 95c1fc82bd

View File

@ -22,9 +22,15 @@ class Argon2iPasswordEncoder extends BasePasswordEncoder implements SelfSaltingE
{
public static function isSupported()
{
return (\PHP_VERSION_ID >= 70200 && \defined('PASSWORD_ARGON2I'))
|| \function_exists('sodium_crypto_pwhash_str')
|| \extension_loaded('libsodium');
if (\PHP_VERSION_ID >= 70200 && \defined('PASSWORD_ARGON2I')) {
return true;
}
if (\class_exists('ParagonIE_Sodium_Compat') && \method_exists('ParagonIE_Sodium_Compat', 'crypto_pwhash_is_available')) {
return \ParagonIE_Sodium_Compat::crypto_pwhash_is_available();
}
return \function_exists('sodium_crypto_pwhash_str') || \extension_loaded('libsodium');
}
/**