Preview Ruby 4.1 is a preview. It can change before the final release. Switch to Ruby 4.0 →
instance method
OpenSSL::HMAC#update
(::String data) -> self
hmac.update(string) → self
ext/openssl/ossl_hmac.c
View on GitHub ↗
static VALUE
ossl_hmac_update(VALUE self, VALUE data)
{
EVP_MD_CTX *ctx;
StringValue(data);
GetHMAC(self, ctx);
if (EVP_DigestSignUpdate(ctx, RSTRING_PTR(data), RSTRING_LEN(data)) != 1)
ossl_raise(eHMACError, "EVP_DigestSignUpdate");
return self;
}
Returns hmac updated with the message to be authenticated. Can be called repeatedly with chunks of the message.
Example
Example
first_chunk = 'The quick brown fox jumps ' second_chunk = 'over the lazy dog' instance.update(first_chunk) #=> 5b9a8038a65d571076d97fe783989e52278a492a instance.update(second_chunk) #=> de7c9b85b8b78aa6bc8a7a36f70a90701c9db4d9