2005-11-18 20:58:54 +00:00
|
|
|
--TEST--
|
|
|
|
hmac-md5 algorithm
|
|
|
|
--SKIPIF--
|
2006-10-02 01:38:05 +00:00
|
|
|
<?php
|
|
|
|
if(!extension_loaded("hash")) print "skip"; ?>
|
2005-11-18 20:58:54 +00:00
|
|
|
--FILE--
|
|
|
|
<?php
|
|
|
|
/* 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";
|
|
|
|
|
2005-12-01 04:53:55 +00:00
|
|
|
echo hash_hmac('md5', str_repeat(chr(0xDD), 50), str_repeat(chr(0xAA), 16)) . "\n";
|
2007-04-18 08:09:02 +00:00
|
|
|
?>
|
2008-05-27 18:16:04 +00:00
|
|
|
--EXPECTF--
|
2006-10-02 01:38:05 +00:00
|
|
|
9294727a3638bb1c13f48ef8158bfc9d
|
|
|
|
750c783e6ab0b503eaa86e310a5db738
|
|
|
|
|
2007-04-18 08:09:02 +00:00
|
|
|
Warning: hash_hmac(): Binary or ASCII-Unicode string expected, non-ASCII-Unicode string received in %shmac-md5.php on line %d
|