xref: /PHP-8.1/ext/hash/tests/hmac-md5.phpt (revision 7aacc705)
1--TEST--
2Hash: hmac-md5 algorithm
3--FILE--
4<?php
5/* Test Vectors from RFC 2104 */
6$ctx = hash_init('md5',HASH_HMAC,str_repeat(chr(0x0b), 16));
7hash_update($ctx, 'Hi There');
8echo hash_final($ctx) . "\n";
9
10$ctx = hash_init('md5',HASH_HMAC,'Jefe');
11hash_update($ctx, 'what do ya want for nothing?');
12echo hash_final($ctx) . "\n";
13
14echo hash_hmac('md5', str_repeat(chr(0xDD), 50), str_repeat(chr(0xAA), 16)) . "\n";
15?>
16--EXPECT--
179294727a3638bb1c13f48ef8158bfc9d
18750c783e6ab0b503eaa86e310a5db738
1956be34521d144c88dbb8c733f0e8b3f6
20