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*);
102 ## Copyright (C) 1999-20007 Landon Curt Noll
104 ## Calc is open software; you can redistribute it and/or modify it under
105 ## the terms of the version 2.1 of the GNU Lesser General Public License
106 ## as published by the Free Software Foundation.
108 ## Calc is distributed in the hope that it will be useful, but WITHOUT
109 ## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
110 ## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
111 ## Public License for more details.
113 ## A copy of version 2.1 of the GNU Lesser General Public License is
114 ## distributed with calc under the filename COPYING-LGPL. You should have
115 ## received a copy with calc; if not, write to Free Software Foundation, Inc.
116 ## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
118 ## @(#) $Revision: 30.2 $
119 ## @(#) $Id: sha1,v 30.2 2007/07/05 17:37:41 chongo Exp $
120 ## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/sha1,v $
122 ## Under source code control: 1997/03/23 00:01:18
123 ## File existed as early as: 1997
125 ## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
126 ## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/