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

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

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