1
0
mirror of https://github.com/php/php-src.git synced 2026-04-25 17:08:14 +02:00
Files
archived-php-src/ext/hash/tests/hmac-md5.phpt
T
Sara Golemon 7b5058378c Allow hash()/hash_hmac() to accept ascii-unicode data,
Update tests to work in unicode.semantics mode.
2006-10-02 01:38:05 +00:00

27 lines
795 B
PHP

--TEST--
hmac-md5 algorithm
--SKIPIF--
<?php
if(!extension_loaded("hash")) print "skip"; ?>
--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";
echo hash_hmac('md5', str_repeat(chr(0xDD), 50), str_repeat(chr(0xAA), 16)) . "\n";
--EXPECT--
9294727a3638bb1c13f48ef8158bfc9d
750c783e6ab0b503eaa86e310a5db738
56be34521d144c88dbb8c733f0e8b3f6
--UEXPECTF--
9294727a3638bb1c13f48ef8158bfc9d
750c783e6ab0b503eaa86e310a5db738
Warning: hash_hmac(): Binary or ASCII-Unicode string expected, non-ASCII-Unicode string received in %s/tests/hmac-md5.php on line %d