Annotation of embedaddon/php/ext/standard/tests/strings/sha1.phpt, revision 1.1.1.1

1.1       misho       1: --TEST--
                      2: sha1() with ASCII output
                      3: --FILE--
                      4: <?php
                      5: 
                      6: $filename = dirname(__FILE__)."/sha1.dat";
                      7: $a = array(
                      8:        "abc",
                      9:        "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq",
                     10:        "a",
                     11:        "0123456701234567012345670123456701234567012345670123456701234567",
                     12:        ""
                     13: );
                     14: 
                     15: foreach ($a as $str) {
                     16:        var_dump($val1 = sha1($str));
                     17:        file_put_contents($filename, $str);
                     18:        var_dump($val2 = sha1_file($filename));
                     19:        var_dump($val1 === $val2);
                     20: }
                     21: 
                     22: var_dump(sha1($str, true));
                     23: var_dump(sha1_file($filename, true));
                     24: 
                     25: @unlink($filename);
                     26: 
                     27: sha1_file($filename);
                     28: 
                     29: echo "Done\n";
                     30: ?>
                     31: --EXPECTF--
                     32: string(40) "a9993e364706816aba3e25717850c26c9cd0d89d"
                     33: string(40) "a9993e364706816aba3e25717850c26c9cd0d89d"
                     34: bool(true)
                     35: string(40) "84983e441c3bd26ebaae4aa1f95129e5e54670f1"
                     36: string(40) "84983e441c3bd26ebaae4aa1f95129e5e54670f1"
                     37: bool(true)
                     38: string(40) "86f7e437faa5a7fce15d1ddcb9eaeaea377667b8"
                     39: string(40) "86f7e437faa5a7fce15d1ddcb9eaeaea377667b8"
                     40: bool(true)
                     41: string(40) "e0c094e867ef46c350ef54a7f59dd60bed92ae83"
                     42: string(40) "e0c094e867ef46c350ef54a7f59dd60bed92ae83"
                     43: bool(true)
                     44: string(40) "da39a3ee5e6b4b0d3255bfef95601890afd80709"
                     45: string(40) "da39a3ee5e6b4b0d3255bfef95601890afd80709"
                     46: bool(true)
                     47: string(20) "%a"
                     48: string(20) "%a"
                     49: 
                     50: Warning: sha1_file(%ssha1.dat): failed to open stream: No such file or directory in %s on line %d
                     51: Done

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