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#reset
hmac.reset → self
ext/openssl/ossl_hmac.c
View on GitHub ↗
static VALUE
ossl_hmac_reset(VALUE self)
{
HMAC_CTX *ctx;
GetHMAC(self, ctx);
HMAC_Init_ex(ctx, NULL, 0, NULL, NULL);
return 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', OpenSSL::Digest.new('sha1')) #=> f42bb0eeb018ebbd4597ae7213711ec60760843f instance.update(data) #=> de7c9b85b8b78aa6bc8a7a36f70a90701c9db4d9 instance.reset #=> f42bb0eeb018ebbd4597ae7213711ec60760843f