Method: OpenSSL::HMAC#reset

Defined in:
ossl_hmac.c

#resetself

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’, OpenSSL::Digest.new(‘sha1’)) #=> f42bb0eeb018ebbd4597ae7213711ec60760843f

instance.update(data) #=> de7c9b85b8b78aa6bc8a7a36f70a90701c9db4d9 instance.reset #=> f42bb0eeb018ebbd4597ae7213711ec60760843f

Returns:

  • (self)


242
243
244
245
246
247
248
249
250
251
# File 'ossl_hmac.c', line 242

static VALUE
ossl_hmac_reset(VALUE self)
{
    HMAC_CTX *ctx;

    GetHMAC(self, ctx);
    HMAC_Init_ex(ctx, NULL, 0, NULL, NULL);

    return self;
}