instance method
OpenSSL::HMAC#reset
() -> self
hmac.reset → self
ext/openssl/ossl_hmac.c
View on GitHub ↗
static VALUE
ossl_hmac_reset(VALUE self)
{
EVP_MD_CTX *ctx;
EVP_PKEY *pkey;
GetHMAC(self, ctx);
pkey = EVP_PKEY_CTX_get0_pkey(EVP_MD_CTX_get_pkey_ctx(ctx));
if (EVP_DigestSignInit(ctx, NULL, EVP_MD_CTX_get0_md(ctx), NULL, pkey) != 1)
ossl_raise(eHMACError, "EVP_DigestSignInit");
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', 'SHA1') #=> f42bb0eeb018ebbd4597ae7213711ec60760843f instance.update(data) #=> de7c9b85b8b78aa6bc8a7a36f70a90701c9db4d9 instance.reset #=> f42bb0eeb018ebbd4597ae7213711ec60760843f