Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit d6cfde9

Browse filesBrowse files
author
Robin Chalas
committed
[Security] Do not mix usage of password_*() functions and sodium_*() ones
1 parent 7f04e55 commit d6cfde9
Copy full SHA for d6cfde9

File tree

Expand file treeCollapse file tree

1 file changed

+3
-1
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+3
-1
lines changed

‎src/Symfony/Component/Security/Core/Encoder/Argon2iPasswordEncoder.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Security/Core/Encoder/Argon2iPasswordEncoder.php
+3-1Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,9 @@ public function encodePassword($raw, $salt)
6060
*/
6161
public function isPasswordValid($encoded, $raw, $salt)
6262
{
63-
if (\PHP_VERSION_ID >= 70200 && \defined('PASSWORD_ARGON2I')) {
63+
// If $encoded was created via "sodium_crypto_pwhash_str()", the hashing algorithm may be "argon2id" instead of "argon2i".
64+
// In this case, "password_verify()" cannot be used.
65+
if (\PHP_VERSION_ID >= 70200 && \defined('PASSWORD_ARGON2I') && (false === strpos($encoded, '$argon2id$'))) {
6466
return !$this->isPasswordTooLong($raw) && password_verify($raw, $encoded);
6567
}
6668
if (\function_exists('sodium_crypto_pwhash_str_verify')) {

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.