2 Hash: hash_hkdf() function: edge cases
6 /* Prototype : string hkdf ( string $algo , string $ikm [, int $length , string $info = '' , string $salt = '' ] )
7 * Description: HMAC-based Key Derivation Function
8 * Source code: ext/hash/hash.c
11 echo "*** Testing hash_hkdf(): edge cases ***\n";
13 $ikm = 'input key material';
15 echo 'Length < digestSize: ', bin2hex(hash_hkdf('md5', $ikm, 7)), "\n";
16 echo 'Length % digestSize != 0: ', bin2hex(hash_hkdf('md5', $ikm, 17)), "\n";
17 echo 'Algo name case-sensitivity: ', (bin2hex(hash_hkdf('Md5', $ikm, 7)) === '98b16391063ece' ? 'true' : 'false'), "\n";
18 echo "Non-crypto algo name case-sensitivity:\n";
21 var_dump(hash_hkdf('jOaAt', $ikm));
24 echo '[Error] ' . $e->getMessage() . "\n";
29 *** Testing hash_hkdf(): edge cases ***
30 Length < digestSize: 98b16391063ece
31 Length % digestSize != 0: 98b16391063ecee006a3ca8ee5776b1e5f
32 Algo name case-sensitivity: true
33 Non-crypto algo name case-sensitivity:
34 [Error] hash_hkdf(): Argument #1 ($algo) must be a valid cryptographic hashing algorithm