blob: 3d4427611d51c1795ca27e554fbf4cf4a5fee7ec (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
|
# frozen_string_literal: true
module OpenSSL
class HMAC
# Securely compare with another HMAC instance in constant time.
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
end
end
|