Skip to content

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

instance method

OpenSSL::HMAC#reset

hmac.reset → self

Returns hmac as it was when it was first initialized, with all processed data cleared from it.

Example

Example
data = "The quick brown fox jumps over the lazy dog"
instance = OpenSSL::HMAC.new('key', 'SHA1')
#=> f42bb0eeb018ebbd4597ae7213711ec60760843f

instance.update(data)
#=> de7c9b85b8b78aa6bc8a7a36f70a90701c9db4d9
instance.reset
#=> f42bb0eeb018ebbd4597ae7213711ec60760843f
See also #inspect #to_s #initialize_copy #update also in 4.1 · 4.0 · 3.4 · 3.3 · 3.2 · 3.0