diff options
author | gotoyuzo <gotoyuzo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2005-09-10 00:57:20 +0000 |
---|---|---|
committer | gotoyuzo <gotoyuzo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2005-09-10 00:57:20 +0000 |
commit | 580d8dca4038e30044c293b4b4477814caadcd22 (patch) | |
tree | 4d035e1f62a048c989afee82c57d2414881b9cd6 /ext/openssl | |
parent | 2ec654a1a042979088d6d84c0c7c5eae3aaf31d5 (diff) |
* ext/openssl/lib/digest.rb: added SHA224, SHA256, SHA384 and SHA512.
these features are enabled if this library is compiled with
OpenSSL 0.9.8 or later.
* test/openssl/test_digest.rb: add test for new digests.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@9111 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/openssl')
-rw-r--r-- | ext/openssl/lib/openssl/digest.rb | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/ext/openssl/lib/openssl/digest.rb b/ext/openssl/lib/openssl/digest.rb index 58622f543e..5745661c3c 100644 --- a/ext/openssl/lib/openssl/digest.rb +++ b/ext/openssl/lib/openssl/digest.rb @@ -21,8 +21,13 @@ module OpenSSL module Digest - %w(DSS DSS1 MD2 MD4 MD5 MDC2 RIPEMD160 SHA SHA1).each{|digest| - eval(<<-EOD) + alg = %w(DSS DSS1 MD2 MD4 MD5 MDC2 RIPEMD160 SHA SHA1) + if OPENSSL_VERSION_NUMBER > 0x00908000 + alg += %w(SHA224 SHA256 SHA384 SHA512) + end + + alg.each{|digest| + self.module_eval(<<-EOD) class #{digest} < Digest def initialize(data=nil) super(\"#{digest}\", data) |