public function calculateChallengeResponseData(HashCredentialInterface $hash_credential, $data)
    {
        // Nul pad the credential hash to the full key size
        $padded_hash = str_pad($hash_credential->getValue(), static::DESL_FULL_KEY_LENGTH, static::NULL_PAD_CHARACTER);

        $key_blocks = str_split($padded_hash, static::DESL_KEY_BLOCK_SEGMENT_LENGTH);

        $binary_data = array_reduce(
            $key_blocks,
            function ($result, $key_block) use ($data) {
                return $result . $this->des_encrypter->encrypt(
                    $key_block,
                    $data,
                    CipherMode::ECB,
                    '' // DES-ECB expects a 0-byte-length initialization vector
                );
            },
            ''
        );

        return $binary_data;
    }
public function calculateChallengeResponseData(HashCredentialInterface $hash_credential, $data)
    {
        // Nul pad the credential hash to the full key size
        $padded_hash = str_pad($hash_credential->getValue(), static::DESL_FULL_KEY_LENGTH, static::NULL_PAD_CHARACTER);

        $key_blocks = str_split($padded_hash, static::DESL_KEY_BLOCK_SEGMENT_LENGTH);

        $binary_data = array_reduce(
            $key_blocks,
            function ($result, $key_block) use ($data) {
                return $result . $this->des_encrypter->encrypt(
                    $key_block,
                    $data,
                    CipherMode::ECB,
                    '' // DES-ECB expects a 0-byte-length initialization vector
                );
            },
            ''
        );

        return $binary_data;
    }
public function calculateChallengeResponseData ( HashCredentialInterface $ hash_credential , $ data ) { // Nul pad the credential hash to the full key size $ padded_hash = str_pad ( $ hash_credential -> getValue ( ) , static :: DESL_FULL_KEY_LENGTH , static :: NULL_PAD_CHARACTER ) ; $ key_blocks = str_split ( $ padded_hash , static :: DESL_KEY_BLOCK_SEGMENT_LENGTH ) ; $ binary_data = array_reduce ( $ key_blocks , function ( $ result , $ key_block ) use ( $ data ) { return $ result . $ this -> des_encrypter -> encrypt ( $ key_block , $ data , CipherMode :: ECB , '' // DES-ECB expects a 0-byte-length initialization vector ) ; } , '' ) ; return $ binary_data ; }
Calculates a response to a server challenge for a given credential hash.

@param HashCredentialInterface $hash_credential The authentication
credential hash to compute the response for.
@param string $data The binary string containing the previously
calculated data to encrypt, depending on the session strategy.
@return string The calculated challenge response data as a binary string.
Calculates a response to a server challenge for a given credential hash .