Annotation of embedaddon/php/ext/hash/tests/mhash_001.phpt, revision 1.1.1.1

1.1       misho       1: --TEST--
                      2: mhash() test
                      3: --INI--
                      4: magic_quotes_runtime=0
                      5: --SKIPIF--
                      6: <?php
                      7:        include "skip_mhash.inc";
                      8: ?>
                      9: --FILE--
                     10: <?php
                     11: 
                     12: $supported_hash_al = array(
                     13: "MHASH_MD5"       => "2d9bdb91f94e96d9c4e2ae532acc936a",
                     14: "MHASH_SHA1"      => "2f9341e55a9083edf5497bf83ba3db812a7de0a3",
                     15: "MHASH_HAVAL256"  => "b255feff01ad641b27358dc7909bc695a1fca53bddfdfaf19020b275928793af",
                     16: "MHASH_HAVAL192"  => "4ce837de481e1e30092ab2c610057094c988dfd7db1e01cd",
                     17: "MHASH_HAVAL224"  => "5362d1856752bf2c139bb2d6fdd772b9c515c8ce5ec82695264b85e1",
                     18: "MHASH_HAVAL160"  => "c6b36f87750b18576981bc17b4f22271947bf9cb",
                     19: "MHASH_RIPEMD160" => "6c47435aa1d359c4b7c6af46349f0c3e1258583d",
                     20: "MHASH_GOST"      => "101b0a2552cebdf5137cadf15147f21e55b6432935bb9c2c03c7e28d188b2d9e",
                     21: "MHASH_TIGER"     => "fdb9019a79c33a95677e2097abae91eb0de00b3054bb5c39",
                     22: "MHASH_CRC32"     => "83041db8",
                     23: "MHASH_CRC32B"    => "df5ab7a4"
                     24: );
                     25: 
                     26: $data = "This is the test of the mhash extension...";
                     27: 
                     28: foreach ($supported_hash_al as $hash=>$wanted) {
                     29:        $result = mhash(constant($hash), $data);
                     30:        if (bin2hex($result)==$wanted) {
                     31:                echo "$hash\nok\n";
                     32:        } else {
                     33:                echo "$hash: ";
                     34:                var_dump($wanted);
                     35:                echo "$hash: ";
                     36:                var_dump(bin2hex($result));
                     37:        }
                     38:        echo "\n";
                     39: }
                     40: ?>
                     41: --EXPECT--
                     42: MHASH_MD5
                     43: ok
                     44: 
                     45: MHASH_SHA1
                     46: ok
                     47: 
                     48: MHASH_HAVAL256
                     49: ok
                     50: 
                     51: MHASH_HAVAL192
                     52: ok
                     53: 
                     54: MHASH_HAVAL224
                     55: ok
                     56: 
                     57: MHASH_HAVAL160
                     58: ok
                     59: 
                     60: MHASH_RIPEMD160
                     61: ok
                     62: 
                     63: MHASH_GOST
                     64: ok
                     65: 
                     66: MHASH_TIGER
                     67: ok
                     68: 
                     69: MHASH_CRC32
                     70: ok
                     71: 
                     72: MHASH_CRC32B
                     73: ok

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>