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
                )
        );
    }