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 9fc01d2

Browse filesBrowse files
committed
use core StringUtils to compare hashes
1 parent 79baf8d commit 9fc01d2
Copy full SHA for 9fc01d2

File tree

Expand file treeCollapse file tree

1 file changed

+2
-10
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+2
-10
lines changed
Open diff view settings
Collapse file

‎src/Symfony/Component/Security/Http/RememberMe/TokenBasedRememberMeServices.php‎

Copy file name to clipboardExpand all lines: src/Symfony/Component/Security/Http/RememberMe/TokenBasedRememberMeServices.php
+2-10Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
1818
use Symfony\Component\Security\Core\Exception\AuthenticationException;
1919
use Symfony\Component\Security\Core\User\UserInterface;
20+
use Symfony\Component\Security\Core\Util\StringUtils;
2021

2122
/**
2223
* Concrete implementation of the RememberMeServicesInterface providing
@@ -77,16 +78,7 @@ protected function processAutoLoginCookie(array $cookieParts, Request $request)
7778
*/
7879
private function compareHashes($hash1, $hash2)
7980
{
80-
if (strlen($hash1) !== $c = strlen($hash2)) {
81-
return false;
82-
}
83-
84-
$result = 0;
85-
for ($i = 0; $i < $c; $i++) {
86-
$result |= ord($hash1[$i]) ^ ord($hash2[$i]);
87-
}
88-
89-
return 0 === $result;
81+
return StringUtils::equals($hash1, $hash2);
9082
}
9183

9284
/**

0 commit comments

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