2 namespace TYPO3\CMS\Saltedpasswords\Salt;
34 const ITOA64 =
'./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';
102 $saltWithSettings = $salt;
105 if (strlen($salt) == $reqLenBase64) {
109 $saltWithSettings .= $salt;
111 return $saltWithSettings;
125 return $hash && $saltedHashPW === $hash;
155 $setting = substr($setting, 0, strlen($this->
getSetting()) + 1 + $reqLenBase64);
159 $salt = substr($setting, strlen($this->
getSetting()) + 1, $reqLenBase64);
165 $count = 1 << $count_log2;
166 $hash = md5($salt . $password,
true);
168 $hash = md5($hash . $password,
true);
172 return strlen($saltedPW) == 34 ? $saltedPW :
false;
201 $randomBytes = \TYPO3\CMS\Core\Utility\GeneralUtility::generateRandomBytes($this->
getSaltLength());
215 return isset(self::$hashCount) ? self::$hashCount : self::HASH_COUNT;
228 if (!empty($password)) {
257 return isset(self::$maxHashCount) ? self::$maxHashCount : self::MAX_HASH_COUNT;
270 return isset(self::$minHashCount) ? self::$minHashCount : self::MIN_HASH_COUNT;
280 return self::$saltLengthPhpass;
290 return self::$settingPhpass;
308 if (strncmp($passString,
'$P$', 3) || strlen($passString) != 34) {
323 $isValid = ($skip =
false);
325 if (strlen($salt) >= $reqLenBase64) {
327 if (!strncmp(
'$', $salt, 1)) {
330 $salt = substr($salt, strrpos($salt,
'$') + 2);
336 if (!$skip && strlen($salt) >= $reqLenBase64) {
337 if (preg_match(
'/^[' . preg_quote($this->
getItoa64(),
'/') .
']{' . $reqLenBase64 .
',' . $reqLenBase64 .
'}$/', substr($salt, 0, $reqLenBase64))) {