src/sb/Password/Hash.php
public static function validate($password, $hash) {
        $params = explode(":", $hash);
        if (count($params) < 4)
            return false;
        $pbkdf2 = base64_decode($params[self::$hash_pbkdf2_index]);
        return self::slowEquals(
                $pbkdf2, self::calculate(
                    $params[self::$hash_alogrithm_index], $password, $params[self::$hash_salt_index], (int) $params[self::$hash_iteration_index], strlen($pbkdf2), true
                )
        );
    }
public static function validate($password, $hash) {
        $params = explode(":", $hash);
        if (count($params) < 4)
            return false;
        $pbkdf2 = base64_decode($params[self::$hash_pbkdf2_index]);
        return self::slowEquals(
                $pbkdf2, self::calculate(
                    $params[self::$hash_alogrithm_index], $password, $params[self::$hash_salt_index], (int) $params[self::$hash_iteration_index], strlen($pbkdf2), true
                )
        );
    }
public static function validate ( $ password , $ hash ) { $ params = explode ( ":" , $ hash ) ; if ( count ( $ params ) < 4 ) return false ; $ pbkdf2 = base64_decode ( $ params [ self :: $ hash_pbkdf2_index ] ) ; return self :: slowEquals ( $ pbkdf2 , self :: calculate ( $ params [ self :: $ hash_alogrithm_index ] , $ password , $ params [ self :: $ hash_salt_index ] , ( int ) $ params [ self :: $ hash_iteration_index ] , strlen ( $ pbkdf2 ) , true ) ) ; }
Validates a password against its precalculated hash
@param string $password
@param string $hash
@return boolean
<code>
$bool = \sb\Password\Hash::validate('password', $hash_from_create);
</code>
Validates a password against its precalculated hash