2 sha1 - Secure Hash Algorithm (SHS-1 FIPS Pub 180-1)
5 sha1([arg1 [, val ...]])
14 The sha1() builtin implements the old Secure Hash Algorithm
15 (SHA). The SHA is sometimes referenced as SHS. The SHA
18 With no args, sha1() returns the default initial SHA-1 HASH state.
20 If arg1 is a HASH state and no other val args are given, then the
21 HASH state is finalized and the numeric value of the hash is given.
23 If arg1 is a HASH state and one or more val args are given,
24 then the val args are used to modify the arg1 HASH state.
25 The new arg1 HASH state is returned.
27 If arg1 is not a a HASH state, then the initial HASH is
28 used and modifed by arg1 and any val args supplied. The
29 return value is the new HASH state.
31 The following table gives a summary of actions and return values.
32 Here, assume that 'h' is a HASH state:
34 sha1() HASH returns initial HASH state
36 sha1(h) number h is put into final form and the
37 numeric value of the hash state
39 sha1(x) HASH modify the initial state by hashing 'x'
41 sha1(sha1(), x) HASH the same as sha1(x)
43 sha1(x, y) HASH the same as sha1(sha1(x), y)
45 sha1(h, x, y) HASH modify state 'h' by 'x' and then 'y'
47 sha1(sha1(h,x,y)) number numeric value of the above call
56 0xda39a3ee5e6b4b0d3255bfef95601890afd80709
58 > sha1("x", "y", "z") == sha1("xyz")
60 > sha1("x", "y", "z") == sha1("xy")
63 > sha1(sha1("this is", 7^19-8, "a composit", 3i+4.5, "hash"))
64 0xc3e1b562bf45b3bcfc055ac65b5b39cdeb6a6c55
66 > x = sha1(list(1,2,3), "curds and whey", 2^21701-1, pi())
70 0x988d2de4584b7536aa9a50a5749707a37affa1b5
73 > y = sha1(y, list(1,2,3), "curds and whey")
74 > y = sha1(y, 2^21701-1)
79 0x988d2de4584b7536aa9a50a5749707a37affa1b5
85 HASH* hash_init(int, HASH*);
86 void hash_free(HASH*);
87 HASH* hash_copy(HASH*);
88 int hash_cmp(HASH*, HASH*);
89 void hash_print(HASH*);
90 ZVALUE hash_final(HASH*);
91 HASH* hash_long(int, long, HASH*);
92 HASH* hash_zvalue(int, ZVALUE, HASH*);
93 HASH* hash_number(int, void*, HASH*);
94 HASH* hash_complex(int, void*, HASH*);
95 HASH* hash_str(int, char*, HASH*);
96 HASH* hash_usb8(int, USB8*, int, HASH*);
97 HASH* hash_value(int, void*, HASH*);