Method: OpenSSL::HMAC#reset
- Defined in:
- ossl_hmac.c
#reset ⇒ self
Returns hmac as it was when it was first initialized, with all processed data cleared from it.
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
242 243 244 245 246 247 248 249 250 251 252 253 254 |
# File 'ossl_hmac.c', line 242 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; } |