36 const ITOA64 =
'./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';
99 $saltWithSettings = $salt;
102 if (strlen($salt) == $reqLenBase64) {
106 $saltWithSettings .= $salt;
108 return $saltWithSettings;
121 return $hash && $saltedHashPW === $hash;
149 $setting = substr($setting, 0, strlen($this->
getSetting()) + 1 + $reqLenBase64);
153 $salt = substr($setting, strlen($this->
getSetting()) + 1, $reqLenBase64);
159 $count = 1 << $count_log2;
160 $hash = md5($salt . $password, TRUE);
162 $hash = md5($hash . $password, TRUE);
166 return strlen($saltedPW) == 34 ? $saltedPW : FALSE;
206 return isset(self::$hashCount) ? self::$hashCount : self::HASH_COUNT;
218 if (!empty($password)) {
245 return isset(self::$maxHashCount) ? self::$maxHashCount : self::MAX_HASH_COUNT;
257 return isset(self::$minHashCount) ? self::$minHashCount : self::MIN_HASH_COUNT;
266 return self::$saltLengthPhpass;
275 return self::$settingPhpass;
292 if (strncmp($passString,
'$P$', 3) || strlen($passString) != 34) {
306 $isValid = ($skip = FALSE);
308 if (strlen($salt) >= $reqLenBase64) {
310 if (!strncmp(
'$', $salt, 1)) {
313 $salt = substr($salt, strrpos($salt,
'$') + 2);
319 if (!$skip && strlen($salt) >= $reqLenBase64) {
320 if (preg_match(
'/^[' . preg_quote($this->
getItoa64(),
'/') .
']{' . $reqLenBase64 .
',' . $reqLenBase64 .
'}$/', substr($salt, 0, $reqLenBase64))) {
336 $isValid = !strncmp($this->
getSetting(), $saltedPW, strlen($this->
getSetting())) ? TRUE : FALSE;
isHashUpdateNeeded($passString)
setHashCount($hashCount=NULL)
getHashedPassword($password, $salt=NULL)
isValidSaltedPW($saltedPW)
base64Encode($input, $count)
getLengthBase64FromBytes($byteLength)
static generateRandomBytes($bytesToReturn)
setMinHashCount($minHashCount=NULL)
cryptPassword($password, $setting)
setMaxHashCount($maxHashCount=NULL)
applySettingsToSalt($salt)
checkPassword($plainPW, $saltedHashPW)