1--TEST--
2sha1() 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
10echo "*** Testing sha1() : basic functionality ***\n";
11
12echo "\n-- Without raw argument --\n";
13var_dump(sha1(""));
14var_dump(sha1("a"));
15var_dump(sha1("abc"));
16var_dump(sha1("message digest"));
17var_dump(sha1("abcdefghijklmnopqrstuvwxyz"));
18var_dump(sha1("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"));
19var_dump(sha1("12345678901234567890123456789012345678901234567890123456789012345678901234567890"));
20
21echo "\n-- With raw == false --\n";
22var_dump(sha1("", false));
23var_dump(sha1("a", false));
24var_dump(sha1("abc", false));
25var_dump(sha1("message digest", false));
26var_dump(sha1("abcdefghijklmnopqrstuvwxyz", false));
27var_dump(sha1("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", false));
28var_dump(sha1("12345678901234567890123456789012345678901234567890123456789012345678901234567890", false));
29
30echo "\n-- With raw == true --\n";
31var_dump(bin2hex(sha1("", true)));
32var_dump(bin2hex(sha1("a", true)));
33var_dump(bin2hex(sha1("abc", true)));
34var_dump(bin2hex(sha1("message digest", true)));
35var_dump(bin2hex(sha1("abcdefghijklmnopqrstuvwxyz", true)));
36var_dump(bin2hex(sha1("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", true)));
37var_dump(bin2hex(sha1("12345678901234567890123456789012345678901234567890123456789012345678901234567890", true)));
38
39?>
40===DONE===
41--EXPECT--
42*** Testing sha1() : basic functionality ***
43
44-- Without raw argument --
45string(40) "da39a3ee5e6b4b0d3255bfef95601890afd80709"
46string(40) "86f7e437faa5a7fce15d1ddcb9eaeaea377667b8"
47string(40) "a9993e364706816aba3e25717850c26c9cd0d89d"
48string(40) "c12252ceda8be8994d5fa0290a47231c1d16aae3"
49string(40) "32d10c7b8cf96570ca04ce37f2a19d84240d3a89"
50string(40) "761c457bf73b14d27e9e9265c46f4b4dda11f940"
51string(40) "50abf5706a150990a08b2c5ea40fa0e585554732"
52
53-- With raw == false --
54string(40) "da39a3ee5e6b4b0d3255bfef95601890afd80709"
55string(40) "86f7e437faa5a7fce15d1ddcb9eaeaea377667b8"
56string(40) "a9993e364706816aba3e25717850c26c9cd0d89d"
57string(40) "c12252ceda8be8994d5fa0290a47231c1d16aae3"
58string(40) "32d10c7b8cf96570ca04ce37f2a19d84240d3a89"
59string(40) "761c457bf73b14d27e9e9265c46f4b4dda11f940"
60string(40) "50abf5706a150990a08b2c5ea40fa0e585554732"
61
62-- With raw == true --
63string(40) "da39a3ee5e6b4b0d3255bfef95601890afd80709"
64string(40) "86f7e437faa5a7fce15d1ddcb9eaeaea377667b8"
65string(40) "a9993e364706816aba3e25717850c26c9cd0d89d"
66string(40) "c12252ceda8be8994d5fa0290a47231c1d16aae3"
67string(40) "32d10c7b8cf96570ca04ce37f2a19d84240d3a89"
68string(40) "761c457bf73b14d27e9e9265c46f4b4dda11f940"
69string(40) "50abf5706a150990a08b2c5ea40fa0e585554732"
70===DONE===