You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -140,16 +141,29 @@ private function getEncoderConfigFromAlgorithm(array $config): array
140
141
],
141
142
];
142
143
143
-
/* @deprecated since Symfony 4.3 */
144
144
case'argon2i':
145
-
return [
146
-
'class' => Argon2iPasswordEncoder::class,
147
-
'arguments' => [
148
-
$config['memory_cost'],
149
-
$config['time_cost'],
150
-
$config['threads'],
151
-
],
152
-
];
145
+
if (SodiumPasswordEncoder::isSupported() && !\defined('SODIUM_CRYPTO_PWHASH_ALG_ARGON2ID13')) {
146
+
$config['algorithm'] = 'sodium';
147
+
} elseif (\defined('PASSWORD_ARGON2I')) {
148
+
$config['algorithm'] = 'native';
149
+
$config['native_algorithm'] = PASSWORD_ARGON2I;
150
+
} else {
151
+
thrownewLogicException(sprintf('Algorithm "argon2i" is not available. Either use %s"auto" or upgrade to PHP 7.2+ instead.', \defined('SODIUM_CRYPTO_PWHASH_ALG_ARGON2ID13') ? '"argon2id", ' : ''));
if (($hasSodium = SodiumPasswordEncoder::isSupported()) && \defined('SODIUM_CRYPTO_PWHASH_ALG_ARGON2ID13')) {
158
+
$config['algorithm'] = 'sodium';
159
+
} elseif (\defined('PASSWORD_ARGON2ID')) {
160
+
$config['algorithm'] = 'native';
161
+
$config['native_algorithm'] = PASSWORD_ARGON2ID;
162
+
} else {
163
+
thrownewLogicException(sprintf('Algorithm "argon2id" is not available. Either use %s"auto", upgrade to PHP 7.3+ or use libsodium 1.0.15+ instead.', \defined('PASSWORD_ARGON2I') || $hasSodium ? '"argon2i", ' : ''));
0 commit comments