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
Copy file name to clipboardExpand all lines: Encoder/Argon2iPasswordEncoder.php
+47-21Lines changed: 47 additions & 21 deletions
Original file line number
Diff line number
Diff line change
@@ -11,17 +11,39 @@
11
11
12
12
namespaceSymfony\Component\Security\Core\Encoder;
13
13
14
+
@trigger_error(sprintf('The "%s" class is deprecated since Symfony 4.3, use "%s" instead.', Argon2iPasswordEncoder::class, SodiumPasswordEncoder::class), E_USER_DEPRECATED);
if (Argon2idPasswordEncoder::isDefaultSodiumAlgorithm()) {
52
-
@trigger_error(sprintf('Using "%s" while only the "argon2id" algorithm is supported is deprecated since Symfony 4.3, use "%s" instead.', __CLASS__, Argon2idPasswordEncoder::class), E_USER_DEPRECATED);
53
-
}
54
-
71
+
return$this->encodePasswordNative($raw);
72
+
}
73
+
if (\function_exists('sodium_crypto_pwhash_str')) {
55
74
return$this->encodePasswordSodiumFunction($raw);
56
75
}
57
76
if (\extension_loaded('libsodium')) {
@@ -66,20 +85,10 @@ public function encodePassword($raw, $salt)
// If $encoded was created via "sodium_crypto_pwhash_str()", the hashing algorithm may be "argon2id" instead of "argon2i"
74
-
if ($isArgon2id = (0 === strpos($encoded, Argon2idPasswordEncoder::HASH_PREFIX))) {
75
-
@trigger_error(sprintf('Calling "%s()" with a password hashed using argon2id is deprecated since Symfony 4.3, use "%s" instead.', __METHOD__, Argon2idPasswordEncoder::class), E_USER_DEPRECATED);
76
-
}
77
-
78
-
if (\PHP_VERSION_ID >= 70200 && \defined('PASSWORD_ARGON2I')) {
79
-
// Remove the right part of the OR in 5.0
80
-
if (\defined('PASSWORD_ARGON2I') || $isArgon2id && \defined('PASSWORD_ARGON2ID')) {
81
-
returnpassword_verify($raw, $encoded);
82
-
}
88
+
// If $encoded was created via "sodium_crypto_pwhash_str()", the hashing algorithm may be "argon2id" instead of "argon2i".
89
+
// In this case, "password_verify()" cannot be used.
0 commit comments