A1_Core::check PHP Method

check() public method

Checks if password matches hash
public check ( $password, $hash ) : boolean
return boolean password matches hashed password
    public function check($password, $hash)
    {
        // $2a$ (4) 00 (2) $ (1) <salt> (22)
        preg_match('/^\\$2a\\$(\\d{2})\\$(.{22})/D', $hash, $matches);
        // Extract the iterations and salt from the hash
        $cost = Arr::get($matches, 1);
        $salt = Arr::get($matches, 2);
        return $this->hash($password, $salt, $cost) === $hash;
    }