Skip to content

Preview Ruby 4.1 is a preview. It can change before the final release. Switch to Ruby 4.0 →

instance method

OpenSSL::HMAC#digest

() -> ::String
hmac.digest → string

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

Example

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