2 sha - old Secure Hash Algorithm (SHS FIPS Pub 180)
5 sha([arg1 [, val ...]])
14 The sha() builtin implements the old Secure Hash Algorithm
15 (SHA). The SHA is sometimes referenced as SHS. The SHA
18 With no args, sha() 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 sha() HASH returns initial HASH state
36 sha(h) number h is put into final form and the
37 numeric value of the hash state
39 sha(x) HASH modify the initial state by hashing 'x'
41 sha(sha(), x) HASH the same as sha(x)
43 sha(x, y) HASH the same as sha(sha(x), y)
45 sha(h, x, y) HASH modify state 'h' by 'x' and then 'y'
47 sha(sha(h,x,y)) number numeric value of the above call
56 0xf96cea198ad1dd5617ac084a3d92c6107708c0ef
58 > sha("x", "y", "z") == sha("xyz")
60 > sha("x", "y", "z") == sha("xy")
63 > sha(sha("this is", 7^19-8, "a composit", 3i+4.5, "hash"))
64 0x21e42319a26787046c2b28b7ae70f1b54bf0ba2a
66 > x = sha(list(1,2,3), "curds and whey", 2^21701-1, pi())
70 0xc9e155522ea4a38d85340e6f1c2e36636950ea7e
73 > y = sha(y, list(1,2,3), "curds and whey")
74 > y = sha(y, 2^21701-1)
79 0xc9e155522ea4a38d85340e6f1c2e36636950ea7e
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*);