mirror of
https://github.com/cliffe/SecGen.git
synced 2026-02-20 13:50:45 +00:00
Revert OpenSSL conversion for SHA1-based hashes
Update local_encoding_functions to avoid FrozenError on encoding modules
This commit is contained in:
@@ -25,7 +25,7 @@ class EncodingFunctions
|
||||
utf8 = []
|
||||
value.map {|element|
|
||||
if element.is_a? String
|
||||
utf8 << element.force_encoding('UTF-8')
|
||||
utf8 << element.dup.force_encoding('UTF-8')
|
||||
elsif element.is_a? Hash
|
||||
utf8 << EncodingFunctions::hash_to_utf8(element)
|
||||
elsif element.is_a? Array
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
#!/usr/bin/ruby
|
||||
require_relative '../../../../../lib/objects/local_hash_encoder.rb'
|
||||
require 'openssl'
|
||||
|
||||
class SHA1Encoder < HashEncoder
|
||||
def initialize
|
||||
@@ -9,7 +8,7 @@ class SHA1Encoder < HashEncoder
|
||||
end
|
||||
|
||||
def hash_function(string)
|
||||
OpenSSL::Digest::SHA1.new.hexdigest(string)
|
||||
Digest::SHA1.hexdigest(string)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
#!/usr/bin/ruby
|
||||
require_relative '../../../../../lib/objects/local_hash_encoder.rb'
|
||||
require 'openssl'
|
||||
|
||||
class SHA256Encoder < HashEncoder
|
||||
def initialize
|
||||
@@ -9,7 +8,7 @@ class SHA256Encoder < HashEncoder
|
||||
end
|
||||
|
||||
def hash_function(string)
|
||||
OpenSSL::Digest::SHA256.new.hexdigest(string)
|
||||
Digest::SHA256.hexdigest(string)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
#!/usr/bin/ruby
|
||||
require_relative '../../../../../lib/objects/local_hash_encoder.rb'
|
||||
require 'openssl'
|
||||
|
||||
class SHA384Encoder < HashEncoder
|
||||
def initialize
|
||||
@@ -9,7 +8,7 @@ class SHA384Encoder < HashEncoder
|
||||
end
|
||||
|
||||
def hash_function(string)
|
||||
OpenSSL::Digest::SHA384.new.hexdigest(string)
|
||||
Digest::SHA384.hexdigest(string)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
#!/usr/bin/ruby
|
||||
require_relative '../../../../../lib/objects/local_hash_encoder.rb'
|
||||
require 'openssl'
|
||||
|
||||
class SHA512Encoder < HashEncoder
|
||||
def initialize
|
||||
@@ -9,7 +8,7 @@ class SHA512Encoder < HashEncoder
|
||||
end
|
||||
|
||||
def hash_function(string)
|
||||
OpenSSL::Digest::SHA512.new.hexdigest(string)
|
||||
Digest::SHA512.hexdigest(string)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user