diff options
author | knu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2001-05-16 22:07:28 +0000 |
---|---|---|
committer | knu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2001-05-16 22:07:28 +0000 |
commit | 5348fd7d4afcc2ff5e3dba1bddc9fa50a3fb6ddd (patch) | |
tree | d41d9d8aa771f88e03aa78f63ebad3bf591bf9c1 /ext/sha1/sha1.txt | |
parent | 4202ff1a9fba06137f58c0c757ada7e5c11b3ac5 (diff) | |
download | ruby-5348fd7d4afcc2ff5e3dba1bddc9fa50a3fb6ddd.tar.gz |
Initial revision
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1405 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/sha1/sha1.txt')
-rw-r--r-- | ext/sha1/sha1.txt | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/ext/sha1/sha1.txt b/ext/sha1/sha1.txt new file mode 100644 index 0000000000..24bf0d4244 --- /dev/null +++ b/ext/sha1/sha1.txt @@ -0,0 +1,50 @@ +Class SHA1 + + 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. + +Superclass: Object + +Class Methods: + + new([str]) + sha1([str]) + + Creates a new SHA1 object. If a string argument is given, it + is added to the object. (see update.) + +Methods: + + clone + + Copies the SHA1 object. + + digest + + Returns the SHA1 hash of the added strings as a string of 20 bytes. + + hexdigest + + Returns the SHA1 hash of the added strings as a string of 40 + hexadecimal digits. This method is equal to: + + def hexdigest + ret = '' + digest.each_byte {|i| ret << sprintf('%02x', i) } + ret + end + + update(str) + << str + + 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: + + README and sha1-ruby.c are derived from the Ruby source and so fall + under the same license as Ruby. The rest of this package is in the + public domain. |