mirror of
https://github.com/RobThree/TwoFactorAuth.git
synced 2026-08-24 13:36:35 +00:00
extract strlen check from loop
This commit is contained in:
@@ -218,7 +218,8 @@ class TwoFactorAuth
|
||||
// we don't leak information about the difference of the two strings.
|
||||
if (strlen($safe) === strlen($user)) {
|
||||
$result = 0;
|
||||
for ($i = 0; $i < strlen($safe); $i++) {
|
||||
$strlen = strlen($safe);
|
||||
for ($i = 0; $i < $strlen; $i++) {
|
||||
$result |= (ord($safe[$i]) ^ ord($user[$i]));
|
||||
}
|
||||
return $result === 0;
|
||||
|
||||
Reference in New Issue
Block a user