Annotation of embedaddon/php/ext/hash/tests/mhash_002.phpt, revision 1.1.1.2
1.1 misho 1: --TEST--
2: mhash_get_block_size() & mhash_get_hash_name() test
3: --SKIPIF--
4: <?php
5: include "skip_mhash.inc";
6: ?>
7: --FILE--
8: <?php
9: $supported_hash_al = array(
10: "MD5" => 16,
11: "MD4" => 16,
12: "SHA1" => 20,
13: "SHA256" => 32,
14: "HAVAL256" => 32,
15: "HAVAL192" => 24,
16: "HAVAL224" => 28,
17: "HAVAL160" => 20,
18: "HAVAL128" => 16,
19: "RIPEMD160" => 20,
20: "GOST" => 32,
21: "TIGER" => 24,
22: "TIGER160" => 20,
23: "TIGER128" => 16,
24: "CRC32" => 4,
25: "CRC32B" => 4,
26: "ADLER32" => 4,
1.1.1.2 ! misho 27: "NA_XYZ" => 0 /* verify that the algorithm works */
1.1 misho 28: );
29:
30: $hc = mhash_count() + 1;
31:
32: $known_hash_al = array();
33: for ($i=0; $i < $hc; $i++) {
34: $known_hash_al[mhash_get_hash_name($i)] = $i;
35: }
36:
37: foreach ($supported_hash_al as $name => $len) {
38: if (array_key_exists($name, $known_hash_al)) {
39: $len = mhash_get_block_size($known_hash_al[$name]);
40: echo "$name = $len\n";
41: } else {
42: echo "$name ? $len\n";
43: }
44: }
45: ?>
46: --EXPECTREGEX--
47: MD5 . 16
48: MD4 . 16
49: SHA1 . 20
50: SHA256 . 32
51: HAVAL256 . 32
52: HAVAL192 . 24
53: HAVAL224 . 28
54: HAVAL160 . 20
55: HAVAL128 . 16
56: RIPEMD160 . 20
57: GOST . 32
58: TIGER . 24
59: TIGER160 . 20
60: TIGER128 . 16
61: CRC32 . 4
62: CRC32B . 4
63: ADLER32 . 4
64: NA_XYZ . 0
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>