summaryrefslogtreecommitdiff
path: root/ext/digest/digest.txt
diff options
context:
space:
mode:
authorknu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2001-07-13 20:06:14 +0000
committerknu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2001-07-13 20:06:14 +0000
commit76d7dae26ab8b56dbafcec710fc42a5fb7d79840 (patch)
tree513cc8df433c60ad0d6249388a38ade5a651188e /ext/digest/digest.txt
parent6ecd6fe37bf6395850d3825bab3fb88d5d345c82 (diff)
Import the "digest" module and the submodules, from the Rough Ruby
project. ext/digest: This module provides the module Digest and the abstract class Digest::Base. ext/digest/md5 (which obsoletes ext/md5): This module provides the class Digest::MD5 which implements the MD5 Message-Digest Algorithm. ext/digest/rmd160: This module provides the class Digest::RMD160 which implements the RIPEMD-160 cryptographic hash function. ext/digest/sha1 (which obsoletes ext/sha1): This module provides the class Digest::SHA1 which implements the SHA-1 Secure Hash Algorithm. ext/digest/sha2: This module provides the classes Digest::SHA256, Digest::SHA384 and Digest::SHA512 which implement the SHA-256, SHA-384 and SHA-512 Secure Hash Algorithms, respectively. lib/md5.rb, lib/sha1.rb: These files are provided for backward compatibility. All these classes have the common API, which previously ext/md5 and ext/sha1 modules provided. While the new API keeps 100% backward compatibility, it has been enriched with several utility methods. Read digest.txt for further details. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1609 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/digest/digest.txt')
-rw-r--r--ext/digest/digest.txt113
1 files changed, 113 insertions, 0 deletions
diff --git a/ext/digest/digest.txt b/ext/digest/digest.txt
new file mode 100644
index 0000000000..5797dd18f9
--- /dev/null
+++ b/ext/digest/digest.txt
@@ -0,0 +1,113 @@
+.\" digest.txt - -*- Indented-Text -*- created at: Fri May 25 08:13:50 JST 2001
+$RoughId: digest.txt,v 1.9 2001/07/13 19:46:51 knu Exp $
+$Id$
+
+** MD5(Class)
+
+A class to implement the MD5 Message-Digest Algorithm by RSA Data
+Security, Inc., described in RFC1321.
+
+Superclass: Digest::Base
+
+require 'digest/md5'
+
+** SHA1(Class)
+
+A class to implement the SHA-1 Secure Hash Algorithm by NIST (the US'
+National Institute of Standards and Technology), described in FIPS PUB
+180-1.
+
+Superclass: Digest::Base
+
+require 'digest/sha1'
+
+** SHA256(Class)
+** SHA384(Class)
+** SHA512(Class)
+
+Classes to implement the SHA-256/384/512 Secure Hash Algorithm(s) by
+NIST (the US' National Institute of Standards and Technology),
+described in FIPS PUB 180-2.
+
+Superclass: Digest::Base
+
+require 'digest/sha2'
+
+** RMD160(Class)
+
+A class to implement the RIPEMD-160 cryptographic hash function,
+designed by Hans Dobbertin, Antoon Bosselaers, and Bart Preneel.
+
+Superclass: Digest::Base
+
+require 'digest/rmd160'
+
+
+Those above classes provide a common interface as shown below.
+
+
+Class Methods:
+
+ new([str])
+
+ Creates a new digest object. If a string argument is given,
+ it is added to the object. (see update.)
+
+ digest(str)
+
+ Immediately calculates and return the hash of the given
+ strings as a string. Equivalent to new(str).digest.
+
+ hexdigest(str)
+
+ Immediately calculates and return the hash of the given
+ strings as a string of hexadecimal digits. Equivalent to
+ new(str).hexdigest.
+
+Methods:
+
+ clone
+
+ Creates a copy of the digest object.
+
+ digest
+
+ Returns the hash of the added strings as a string of 16 bytes
+ for MD5, 20 bytes for SHA1 and RMD160, 32 bytes for SHA256, 48
+ bytes for SHA384, and 64 bytes for SHA512.
+
+ hexdigest
+ to_s
+
+ Returns the hash of the added strings as a string of 32
+ hexadecimal digits for MD5, 40 hexadecimal digits for SHA1 and
+ RMD160, 64 hexadecimal digits for SHA256, 96 hexadecimal
+ digits for SHA384, and 128 hexadecimal digits for SHA512.
+ This method is equal to:
+
+ def hexdigest
+ digest.unpack("H*")[0]
+ end
+
+ update(str)
+ << str
+
+ Appends the string str to the digest object. 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.
+
+ == md
+
+ Checks if the object is equal to the given digest object.
+
+ == str
+
+ Regards the value as either a digest value or a hexdigest
+ value (depending on the length) and checks if the object is
+ equal to the given string.
+
+-------------------------------------------------------
+Local variables:
+fill-column: 70
+end: