Skip to content

End of Life Ruby 3.0 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →

instance method

OpenSSL::HMAC#digest

hmac.digest → string

Returns the authentication code an instance represents as a binary string.

Example

Example
instance = OpenSSL::HMAC.new('key', OpenSSL::Digest.new('sha1'))
#=> f42bb0eeb018ebbd4597ae7213711ec60760843f
instance.digest
#=> "\xF4+\xB0\xEE\xB0\x18\xEB\xBDE\x97\xAEr\x13q\x1E\xC6\a`\x84?"
See also .digest #== #hexdigest #<< also in 4.1 · 4.0 · 3.4 · 3.3 · 3.2 · 3.1