[rubygems/rubygems] OpenSSL::Digest is always provided after Ruby 2.4
https://github.com/rubygems/rubygems/commit/4f2f2ad412
This commit is contained in:
parent
09041a6ee8
commit
b528ecc164
@ -461,17 +461,9 @@ module Gem::Security
|
|||||||
# Creates a new digest instance using the specified +algorithm+. The default
|
# Creates a new digest instance using the specified +algorithm+. The default
|
||||||
# is SHA256.
|
# is SHA256.
|
||||||
|
|
||||||
if defined?(OpenSSL::Digest)
|
|
||||||
def self.create_digest(algorithm = DIGEST_NAME)
|
def self.create_digest(algorithm = DIGEST_NAME)
|
||||||
OpenSSL::Digest.new(algorithm)
|
OpenSSL::Digest.new(algorithm)
|
||||||
end
|
end
|
||||||
else
|
|
||||||
require "digest"
|
|
||||||
|
|
||||||
def self.create_digest(algorithm = DIGEST_NAME)
|
|
||||||
Digest.const_get(algorithm).new
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
##
|
##
|
||||||
# Creates a new key pair of the specified +algorithm+. RSA, DSA, and EC
|
# Creates a new key pair of the specified +algorithm+. RSA, DSA, and EC
|
||||||
|
Loading…
x
Reference in New Issue
Block a user