aboutsummaryrefslogtreecommitdiffstats
path: root/ext/digest/md5
diff options
context:
space:
mode:
authorhsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-10-20 07:57:30 +0000
committerhsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-10-20 07:57:30 +0000
commit0b16ca9c801367701aee0967810ca2c7ce3dcb77 (patch)
tree4953f1fd770b9b48945be09fa3cf808ed435d6e7 /ext/digest/md5
parent0974d86d41c944716ac3b703306e782d0027896d (diff)
downloadruby-0b16ca9c801367701aee0967810ca2c7ce3dcb77.tar.gz
* ext/digest/digest.c: Add documentation for Digest.
[Feature #10452][ruby-core:66001][ci skip] * remove HMAC from list of digest algorithms, * add MD5 in list of digest algorithms, * add information about writing a C digest implementation using Digest::Base, * add documentation for Digest::Base public methods. * ext/digest/md5/md5init.c: add examples for MD5. * ext/digest/rmd160/rmd160init.c: add examples for Digest::RMD160. * ext/digest/sha1/sha1init.c: add examples for Digest::SHA1. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56455 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/digest/md5')
-rw-r--r--ext/digest/md5/md5init.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/ext/digest/md5/md5init.c b/ext/digest/md5/md5init.c
index a6afedef69..41f966fa7b 100644
--- a/ext/digest/md5/md5init.c
+++ b/ext/digest/md5/md5init.c
@@ -22,9 +22,29 @@ static const rb_digest_metadata_t md5 = {
};
/*
+ * Document-class: Digest::MD5 < Digest::Base
* A class for calculating message digests using the MD5
* Message-Digest Algorithm by RSA Data Security, Inc., described in
* RFC1321.
+ *
+ * MD5 calculates a digest of 128 bits (16 bytes).
+ *
+ * == Examples
+ * require 'digest'
+ *
+ * # Compute a complete digest
+ * Digest::MD5.hexdigest 'abc' #=> "90015098..."
+ *
+ * # Compute digest by chunks
+ * md5 = Digest::MD5.new # =>#<Digest::MD5>
+ * md5.update "ab"
+ * md5 << "c" # alias for #update
+ * md5.hexdigest # => "90015098..."
+ *
+ * # Use the same object to compute another digest
+ * md5.reset
+ * md5 << "message"
+ * md5.hexdigest # => "c13557f2..."
*/
void
Init_md5(void)