Annotation of embedaddon/php/ext/standard/tests/strings/sha1_basic.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: sha1() with ASCII output.
3: --FILE--
4: <?php
5:
6: /* Prototype: string sha1 ( string $str [, bool $raw_output ] )
7: * Description: Calculate the sha1 hash of a string
8: */
9:
10: echo "*** Testing sha1() : basic functionality ***\n";
11:
12: echo "\n-- Without raw argument --\n";
13: var_dump(sha1(""));
14: var_dump(sha1("a"));
15: var_dump(sha1("abc"));
16: var_dump(sha1("message digest"));
17: var_dump(sha1("abcdefghijklmnopqrstuvwxyz"));
18: var_dump(sha1("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"));
19: var_dump(sha1("12345678901234567890123456789012345678901234567890123456789012345678901234567890"));
20:
21: echo "\n-- With raw == false --\n";
22: var_dump(sha1("", false));
23: var_dump(sha1("a", false));
24: var_dump(sha1("abc", false));
25: var_dump(sha1("message digest", false));
26: var_dump(sha1("abcdefghijklmnopqrstuvwxyz", false));
27: var_dump(sha1("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", false));
28: var_dump(sha1("12345678901234567890123456789012345678901234567890123456789012345678901234567890", false));
29:
30: echo "\n-- With raw == true --\n";
31: var_dump(bin2hex(sha1("", true)));
32: var_dump(bin2hex(sha1("a", true)));
33: var_dump(bin2hex(sha1("abc", true)));
34: var_dump(bin2hex(sha1("message digest", true)));
35: var_dump(bin2hex(sha1("abcdefghijklmnopqrstuvwxyz", true)));
36: var_dump(bin2hex(sha1("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", true)));
37: var_dump(bin2hex(sha1("12345678901234567890123456789012345678901234567890123456789012345678901234567890", true)));
38:
39: ?>
40: ===DONE===
41: --EXPECT--
42: *** Testing sha1() : basic functionality ***
43:
44: -- Without raw argument --
45: string(40) "da39a3ee5e6b4b0d3255bfef95601890afd80709"
46: string(40) "86f7e437faa5a7fce15d1ddcb9eaeaea377667b8"
47: string(40) "a9993e364706816aba3e25717850c26c9cd0d89d"
48: string(40) "c12252ceda8be8994d5fa0290a47231c1d16aae3"
49: string(40) "32d10c7b8cf96570ca04ce37f2a19d84240d3a89"
50: string(40) "761c457bf73b14d27e9e9265c46f4b4dda11f940"
51: string(40) "50abf5706a150990a08b2c5ea40fa0e585554732"
52:
53: -- With raw == false --
54: string(40) "da39a3ee5e6b4b0d3255bfef95601890afd80709"
55: string(40) "86f7e437faa5a7fce15d1ddcb9eaeaea377667b8"
56: string(40) "a9993e364706816aba3e25717850c26c9cd0d89d"
57: string(40) "c12252ceda8be8994d5fa0290a47231c1d16aae3"
58: string(40) "32d10c7b8cf96570ca04ce37f2a19d84240d3a89"
59: string(40) "761c457bf73b14d27e9e9265c46f4b4dda11f940"
60: string(40) "50abf5706a150990a08b2c5ea40fa0e585554732"
61:
62: -- With raw == true --
63: string(40) "da39a3ee5e6b4b0d3255bfef95601890afd80709"
64: string(40) "86f7e437faa5a7fce15d1ddcb9eaeaea377667b8"
65: string(40) "a9993e364706816aba3e25717850c26c9cd0d89d"
66: string(40) "c12252ceda8be8994d5fa0290a47231c1d16aae3"
67: string(40) "32d10c7b8cf96570ca04ce37f2a19d84240d3a89"
68: string(40) "761c457bf73b14d27e9e9265c46f4b4dda11f940"
69: string(40) "50abf5706a150990a08b2c5ea40fa0e585554732"
70: ===DONE===
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>