php-src/ext/mhash/tests/001.phpt
Ilia Alshanetsky d7d2b6ef50 Switched to a new parameter parsing API, which simplifies the code a great deal.
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.
2002-11-20 06:48:39 +00:00

68 lines
1011 B
PHP
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

--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‡u Wi<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ß"