2001-05-17 12:05:49 -04:00
|
|
|
.\" sha1.doc - -*- Indented-Text -*- created at: Thu May 17 06:51:50 JST 2001
|
2001-05-16 18:07:28 -04:00
|
|
|
|
2001-05-16 18:19:30 -04:00
|
|
|
** SHA1(Class)
|
|
|
|
|
|
|
|
A class to implement the SHA1 Secure Hash Algorithm by NIST (the US'
|
|
|
|
National Institute of Standards and Technology), described in FIPS PUB
|
|
|
|
180-1.
|
2001-05-16 18:07:28 -04:00
|
|
|
|
|
|
|
Superclass: Object
|
|
|
|
|
|
|
|
Class Methods:
|
|
|
|
|
2001-05-16 18:19:30 -04:00
|
|
|
new([str])
|
|
|
|
sha1([str])
|
2001-05-16 18:07:28 -04:00
|
|
|
|
|
|
|
Creates a new SHA1 object. If a string argument is given, it
|
|
|
|
is added to the object. (see update.)
|
|
|
|
|
|
|
|
Methods:
|
|
|
|
|
2001-05-16 18:19:30 -04:00
|
|
|
clone
|
2001-05-16 18:07:28 -04:00
|
|
|
|
|
|
|
Copies the SHA1 object.
|
|
|
|
|
2001-05-16 18:19:30 -04:00
|
|
|
digest
|
2001-05-16 18:07:28 -04:00
|
|
|
|
2001-05-16 18:19:30 -04:00
|
|
|
Returns the SHA1 hash of the added strings as a string of 20
|
|
|
|
bytes.
|
2001-05-16 18:07:28 -04:00
|
|
|
|
2001-05-16 18:19:30 -04:00
|
|
|
hexdigest
|
2001-05-16 18:07:28 -04:00
|
|
|
|
|
|
|
Returns the SHA1 hash of the added strings as a string of 40
|
2001-05-16 18:19:30 -04:00
|
|
|
hexadecimal digits. This method is equal to:
|
2001-05-16 18:07:28 -04:00
|
|
|
|
|
|
|
def hexdigest
|
|
|
|
ret = ''
|
|
|
|
digest.each_byte {|i| ret << sprintf('%02x', i) }
|
|
|
|
ret
|
|
|
|
end
|
|
|
|
|
2001-05-16 18:19:30 -04:00
|
|
|
update(str)
|
|
|
|
<< str
|
2001-05-16 18:07:28 -04:00
|
|
|
|
|
|
|
Updates the SHA1 object with string str. Repeated calls are
|
|
|
|
equivalent to a single call with the concatenation of all the
|
|
|
|
arguments, i.e. m.update(a); m.update(b) is equivalent to
|
|
|
|
m.update(a+b) and m << a << b is equivalent to m << a+b.
|
|
|
|
|
|
|
|
Copyright:
|
|
|
|
|
2001-05-16 18:19:30 -04:00
|
|
|
sha1.c is in the public domain.
|
|
|
|
|
|
|
|
-------------------------------------------------------
|
|
|
|
Local variables:
|
|
|
|
fill-column: 70
|
|
|
|
end:
|