Class: OpenSSL::HMAC

Inherits:
Object
  • Object
show all
Defined in:
lib/openssl/hmac.rb

Instance Method Summary collapse

Instance Method Details

#==(other) ⇒ Object

Securely compare with another HMAC instance in constant time.



6
7
8
9
10
11
# File 'lib/openssl/hmac.rb', line 6

def ==(other)
  return false unless HMAC === other
  return false unless self.digest.bytesize == other.digest.bytesize

  OpenSSL.fixed_length_secure_compare(self.digest, other.digest)
end