1--TEST-- 2Test hash_hkdf() function: edge cases 3--SKIPIF-- 4<?php extension_loaded('hash') or die('skip: hash extension not loaded.'); ?> 5--FILE-- 6<?php 7 8/* Prototype : string hkdf ( string $algo , string $ikm [, int $length , string $info = '' , string $salt = '' ] ) 9 * Description: HMAC-based Key Derivation Function 10 * Source code: ext/hash/hash.c 11*/ 12 13echo "*** Testing hash_hkdf(): edge cases ***\n"; 14 15$ikm = 'input key material'; 16 17echo 'Length < digestSize: ', bin2hex(hash_hkdf('md5', $ikm, 7)), "\n"; 18echo 'Length % digestSize != 0: ', bin2hex(hash_hkdf('md5', $ikm, 17)), "\n"; 19echo 'Algo name case-sensitivity: ', (bin2hex(hash_hkdf('Md5', $ikm, 7)) === '98b16391063ece' ? 'true' : 'false'), "\n"; 20echo "Non-crypto algo name case-sensitivity:\n"; 21var_dump(hash_hkdf('jOaAt', $ikm)); 22 23?> 24--EXPECTF-- 25*** Testing hash_hkdf(): edge cases *** 26Length < digestSize: 98b16391063ece 27Length % digestSize != 0: 98b16391063ecee006a3ca8ee5776b1e5f 28Algo name case-sensitivity: true 29Non-crypto algo name case-sensitivity: 30 31Warning: hash_hkdf(): Non-cryptographic hashing algorithm: jOaAt in %s on line %d 32bool(false) 33