Hautelook\Phpass\PasswordHash::CheckPassword PHP Method

CheckPassword() public method

public CheckPassword ( String $password, String $stored_hash ) : boolean
$password String
$stored_hash String
return boolean
    public function CheckPassword($password, $stored_hash)
    {
        $hash = $this->crypt_private($password, $stored_hash);
        if ($hash[0] == '*') {
            $hash = crypt($password, $stored_hash);
        }
        return hash_equals($stored_hash, $hash);
    }

Usage Example

Example #1
0
 /**
  * Check the given plain value against a hash.
  *
  * @param  string  $value
  * @param  string  $hashedValue
  * @param  array   $options
  * @return bool
  */
 public function check($value, $hashedValue, array $options = [])
 {
     if (strlen($hashedValue) === 0) {
         return false;
     }
     return $this->hasher->CheckPassword($value, $hashedValue);
 }
All Usage Examples Of Hautelook\Phpass\PasswordHash::CheckPassword