xref: /PHP-7.3/ext/hash/tests/hmac-md5.phpt (revision 950de078)
1--TEST--
2hmac-md5 algorithm
3--SKIPIF--
4<?php if(!extension_loaded("hash")) print "skip"; ?>
5--FILE--
6<?php
7/* Test Vectors from RFC 2104 */
8$ctx = hash_init('md5',HASH_HMAC,str_repeat(chr(0x0b), 16));
9hash_update($ctx, 'Hi There');
10echo hash_final($ctx) . "\n";
11
12$ctx = hash_init('md5',HASH_HMAC,'Jefe');
13hash_update($ctx, 'what do ya want for nothing?');
14echo hash_final($ctx) . "\n";
15
16echo hash_hmac('md5', str_repeat(chr(0xDD), 50), str_repeat(chr(0xAA), 16)) . "\n";
17--EXPECT--
189294727a3638bb1c13f48ef8158bfc9d
19750c783e6ab0b503eaa86e310a5db738
2056be34521d144c88dbb8c733f0e8b3f6
21