summaryrefslogtreecommitdiff
path: root/ext/digest/sha1/sha1init.c
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
commit814c1adec7d20b74b9499cb2c1b37e12b1b04681 (patch)
tree4953f1fd770b9b48945be09fa3cf808ed435d6e7 /ext/digest/sha1/sha1init.c
parentd74bb0958d0af93496f7ac030f134f9164518e30 (diff)
* 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/sha1/sha1init.c')
-rw-r--r--ext/digest/sha1/sha1init.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/ext/digest/sha1/sha1init.c b/ext/digest/sha1/sha1init.c
index 1f8b89e..44dda3f 100644
--- a/ext/digest/sha1/sha1init.c
+++ b/ext/digest/sha1/sha1init.c
@@ -22,9 +22,31 @@ static const rb_digest_metadata_t sha1 = {
};
/*
+ * Document-class: Digest::SHA1 < Digest::Base
* A class for calculating message digests using the SHA-1 Secure Hash
* Algorithm by NIST (the US' National Institute of Standards and
* Technology), described in FIPS PUB 180-1.
+ *
+ * See Digest::Instance for digest API.
+ *
+ * SHA-1 calculates a digest of 160 bits (20 bytes).
+ *
+ * == Examples
+ * require 'digest'
+ *
+ * # Compute a complete digest
+ * Digest::SHA1.hexdigest 'abc' #=> "a9993e36..."
+ *
+ * # Compute digest by chunks
+ * sha1 = Digest::SHA1.new # =>#<Digest::SHA1>
+ * sha1.update "ab"
+ * sha1 << "c" # alias for #update
+ * sha1.hexdigest # => "a9993e36..."
+ *
+ * # Use the same object to compute another digest
+ * sha1.reset
+ * sha1 << "message"
+ * sha1.hexdigest # => "6f9b9af3..."
*/
void
Init_sha1(void)