/hphp/test/zend/good/ext/hash/tests/hmac-md5.php
PHP | 13 lines | 10 code | 2 blank | 1 comment | 0 complexity | 67001b8c0777f447cfc8afaec9c77471 MD5 | raw file
Possible License(s): LGPL-2.1, BSD-2-Clause, BSD-3-Clause, MPL-2.0-no-copyleft-exception, MIT, LGPL-2.0, Apache-2.0
- <?hh
- <<__EntryPoint>> function main(): void {
- /* Test Vectors from RFC 2104 */
- $ctx = hash_init('md5',HASH_HMAC,str_repeat(chr(0x0b), 16));
- hash_update($ctx, 'Hi There');
- echo hash_final($ctx) . "\n";
- $ctx = hash_init('md5',HASH_HMAC,'Jefe');
- hash_update($ctx, 'what do ya want for nothing?');
- echo hash_final($ctx) . "\n";
- echo hash_hmac('md5', str_repeat(chr(0xDD), 50), str_repeat(chr(0xAA), 16)) . "\n";
- }