mirror of
https://github.com/php/php-src.git
synced 2024-10-07 09:46:10 +00:00
d7d2b6ef50
Made error reporting use php_error_docref() Fixed a bug in mhash_keygen_s2k() that caused non \0 terminated data to be returned. Added tests of all mhash functions.
68 lines
1011 B
PHP
68 lines
1011 B
PHP
--TEST--
|
||
mhash() test
|
||
--SKIPIF--
|
||
<?php
|
||
include "skip.inc";
|
||
?>
|
||
--FILE--
|
||
<?php
|
||
|
||
$supported_hash_al = array(
|
||
"MHASH_MD5",
|
||
"MHASH_SHA1",
|
||
"MHASH_HAVAL256",
|
||
"MHASH_HAVAL192",
|
||
"MHASH_HAVAL224",
|
||
"MHASH_HAVAL160",
|
||
"MHASH_RIPEMD160",
|
||
"MHASH_GOST",
|
||
"MHASH_TIGER",
|
||
"MHASH_CRC32",
|
||
"MHASH_CRC32B"
|
||
);
|
||
|
||
$data = "This is the test of the mhash extension...";
|
||
|
||
foreach ($supported_hash_al as $hash) {
|
||
echo $hash . "\n";
|
||
var_dump(mhash(constant($hash), $data));
|
||
echo "\n";
|
||
}
|
||
?>
|
||
--EXPECT--
|
||
MHASH_MD5
|
||
string(16) "-›Û‘ùN–ÙÄâ®S*Ì“j"
|
||
|
||
MHASH_SHA1
|
||
string(20) "/“AåZ<C3A5>ƒíõI{ø;£Û<C2A3>*}à£"
|
||
|
||
MHASH_HAVAL256
|
||
string(32) "²Uþÿd'5<>Ç<EFBFBD>›Æ•¡ü¥;Ýýúñ<C3BA> ²u’‡“¯"
|
||
|
||
MHASH_HAVAL192
|
||
string(24) "Lè7ÞH0 *²Æp”Ɉß×ÛÍ"
|
||
|
||
MHASH_HAVAL224
|
||
string(28) "SbÑ…gR¿,›²Öý×r¹ÅÈÎ^È&•&K…á"
|
||
|
||
MHASH_HAVAL160
|
||
string(20) "Ƴo‡uWi<57>¼´ò"q”{ùË"
|
||
|
||
MHASH_RIPEMD160
|
||
string(20) "lGCZ¡ÓYķƯF4Ÿ>XX="
|
||
|
||
MHASH_GOST
|
||
string(32) "
|
||
%Rνõ|ñQGòU¶C)5»œ,Çâ<C387>‹-ž"
|
||
|
||
MHASH_TIGER
|
||
string(24) "•:Ãyš¹ýë‘®«— ~g9\»T0à
|
||
"
|
||
|
||
MHASH_CRC32
|
||
string(4) "ƒ¸"
|
||
|
||
MHASH_CRC32B
|
||
string(4) "¤·Zß"
|
||
|