private function checkModePbkdf2($password, $hash)
    {
        $this->cwsDebug->titleH2('Check password hash in PBKDF2 mode');
        $this->cwsDebug->labelValue('Password', $password);
        $this->cwsDebug->dump('Hash', $hash);

        $params = explode(self::PBKDF2_SEPARATOR, $hash);
        if (count($params) < self::PBKDF2_SECTIONS) {
            return false;
        }

        $algorithm = $params[self::PBKDF2_ALGORITHM_INDEX];
        $salt = $params[self::PBKDF2_SALT_INDEX];
        $ite = $params[self::PBKDF2_ITE_INDEX];
        $hash = base64_decode($params[self::PBKDF2_HASH_INDEX]);
        $this->cwsDebug->labelValue('Decoded hash', $hash);

        $checkHash = $this->getPbkdf2($algorithm, $password, $salt, $ite, strlen($hash), true);
        $this->cwsDebug->labelValue('Check hash', $checkHash);

        $result = $this->slowEquals($hash, $checkHash);
        $this->cwsDebug->labelValue('Valid?', ($result ? 'YES!' : 'NO...'));

        return $result;
    }
private function checkModePbkdf2($password, $hash)
    {
        $this->cwsDebug->titleH2('Check password hash in PBKDF2 mode');
        $this->cwsDebug->labelValue('Password', $password);
        $this->cwsDebug->dump('Hash', $hash);

        $params = explode(self::PBKDF2_SEPARATOR, $hash);
        if (count($params) < self::PBKDF2_SECTIONS) {
            return false;
        }

        $algorithm = $params[self::PBKDF2_ALGORITHM_INDEX];
        $salt = $params[self::PBKDF2_SALT_INDEX];
        $ite = $params[self::PBKDF2_ITE_INDEX];
        $hash = base64_decode($params[self::PBKDF2_HASH_INDEX]);
        $this->cwsDebug->labelValue('Decoded hash', $hash);

        $checkHash = $this->getPbkdf2($algorithm, $password, $salt, $ite, strlen($hash), true);
        $this->cwsDebug->labelValue('Check hash', $checkHash);

        $result = $this->slowEquals($hash, $checkHash);
        $this->cwsDebug->labelValue('Valid?', ($result ? 'YES!' : 'NO...'));

        return $result;
    }
private function checkModePbkdf2 ( $ password , $ hash ) { $ this -> cwsDebug -> titleH2 ( 'Check password hash in PBKDF2 mode' ) ; $ this -> cwsDebug -> labelValue ( 'Password' , $ password ) ; $ this -> cwsDebug -> dump ( 'Hash' , $ hash ) ; $ params = explode ( self :: PBKDF2_SEPARATOR , $ hash ) ; if ( count ( $ params ) < self :: PBKDF2_SECTIONS ) { return false ; } $ algorithm = $ params [ self :: PBKDF2_ALGORITHM_INDEX ] ; $ salt = $ params [ self :: PBKDF2_SALT_INDEX ] ; $ ite = $ params [ self :: PBKDF2_ITE_INDEX ] ; $ hash = base64_decode ( $ params [ self :: PBKDF2_HASH_INDEX ] ) ; $ this -> cwsDebug -> labelValue ( 'Decoded hash' , $ hash ) ; $ checkHash = $ this -> getPbkdf2 ( $ algorithm , $ password , $ salt , $ ite , strlen ( $ hash ) , true ) ; $ this -> cwsDebug -> labelValue ( 'Check hash' , $ checkHash ) ; $ result = $ this -> slowEquals ( $ hash , $ checkHash ) ; $ this -> cwsDebug -> labelValue ( 'Valid?' , ( $ result ? 'YES!' : 'NO...' ) ) ; return $ result ; }
Check a hash with the password given using PBKDF2 mode.

@param string $password
@param string $hash

@return bool
Check a hash with the password given using PBKDF2 mode .