class OpenSSL::HMAC
def ==(other)
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
def base64digest
hmac.base64digest -> string
:call-seq:
def base64digest [digest].pack("m0") end
def base64digest(digest, key, data)
hmac = OpenSSL::HMAC.base64digest('SHA1', key, data)
data = 'The quick brown fox jumps over the lazy dog'
key = 'key'
=== Example
representing the algorithm name or an instance of OpenSSL::Digest.
parameter specifies the digest algorithm to use. This may be a String
Returns the authentication code as a Base64-encoded string. The _digest_
HMAC.base64digest(digest, key, data) -> aString
:call-seq:
def base64digest(digest, key, data) [digest(digest, key, data)].pack("m0") end
def digest(digest, key, data)
hmac = OpenSSL::HMAC.digest('SHA1', key, data)
data = 'The quick brown fox jumps over the lazy dog'
key = 'key'
=== Example
the algorithm name or an instance of OpenSSL::Digest.
specifies the digest algorithm to use. This may be a String representing
Returns the authentication code as a binary string. The _digest_ parameter
HMAC.digest(digest, key, data) -> aString
:call-seq:
def digest(digest, key, data) hmac = new(key, digest) hmac << data hmac.digest end unless method_defined?(:digest) # JRuby
def hexdigest(digest, key, data)
hmac = OpenSSL::HMAC.hexdigest('SHA1', key, data)
data = 'The quick brown fox jumps over the lazy dog'
key = 'key'
=== Example
representing the algorithm name or an instance of OpenSSL::Digest.
parameter specifies the digest algorithm to use. This may be a String
Returns the authentication code as a hex-encoded string. The _digest_
HMAC.hexdigest(digest, key, data) -> aString
:call-seq:
def hexdigest(digest, key, data) hmac = new(key, digest) hmac << data hmac.hexdigest end unless method_defined?(:hexdigest) # JRuby