summaryrefslogtreecommitdiff
path: root/ext/openssl/ossl_digest.c
diff options
context:
space:
mode:
authordrbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-08-25 00:29:02 +0000
committerdrbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-08-25 00:29:02 +0000
commitb0fb4fb689062826730d0712a685787daf796b9a (patch)
tree04cc28bdbc36a05cf0ad16730da9bab87349c1c4 /ext/openssl/ossl_digest.c
parentef039de5604582fbf87aea2dbc9a28697423aa51 (diff)
* ext/openssl/ossl_digest.c: Document OpenSSL::Digest::digest and add
an example to OpenSSL::Digest. Patch by Sylvain Daubert. [Ruby 1.9 - Bug #5166] * ext/openssl/lib/openssl/digest.rb (module OpenSSL): ditto git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33065 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/openssl/ossl_digest.c')
-rw-r--r--ext/openssl/ossl_digest.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/ext/openssl/ossl_digest.c b/ext/openssl/ossl_digest.c
index ab165c4..8fd6b75 100644
--- a/ext/openssl/ossl_digest.c
+++ b/ext/openssl/ossl_digest.c
@@ -403,6 +403,17 @@ Init_ossl_digest()
* sha256 << data2
* sha256 << data3
* digest = sha256.digest
+ *
+ * === Reuse a Digest instance
+ *
+ * data1 = File.read('file1')
+ * sha256 = OpenSSL::Digest::SHA256.new
+ * digest1 = sha256.digest(data1)
+ *
+ * data2 = File.read('file2')
+ * sha256.reset
+ * digest2 = sha256.digest(data2)
+ *
*/
cDigest = rb_define_class_under(mOSSL, "Digest", rb_path2class("Digest::Class"));
/* Document-class: OpenSSL::Digest::DigestError