mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
parent
3f8665fe0e
commit
0b2c70eaa1
31 changed files with 161 additions and 171 deletions
|
@ -31,8 +31,8 @@ module OpenSSL
|
|||
# the length of the secret. Returns +true+ if the strings are identical,
|
||||
# +false+ otherwise.
|
||||
def self.secure_compare(a, b)
|
||||
hashed_a = OpenSSL::Digest::SHA256.digest(a)
|
||||
hashed_b = OpenSSL::Digest::SHA256.digest(b)
|
||||
hashed_a = OpenSSL::Digest.digest('SHA256', a)
|
||||
hashed_b = OpenSSL::Digest.digest('SHA256', b)
|
||||
OpenSSL.fixed_length_secure_compare(hashed_a, hashed_b) && a == b
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue