1 <?php declare(strict_types=1);
25 $knownString .= chr(0);
26 $userString .= chr(0);
28 $known_string_length = strlen($knownString);
29 $user_string_length = strlen($userString);
31 $result = $known_string_length - $user_string_length;
33 for (
$i = 0;
$i < $user_string_length;
$i++) {
34 $result |= (ord($knownString[
$i % $known_string_length]) ^ ord($userString[
$i]));
48 return strlen($password) > self::MAX_PASSWORD_LENGTH;
comparePasswords(string $knownString, string $userString)
Compares two passwords.
requiresReencoding(string $encoded)
isPasswordTooLong(string $password)
Checks if the password is too long.
const MAX_PASSWORD_LENGTH