Method: OpenSSL::HMAC#update

Defined in:
ossl_hmac.c

#update(string) ⇒ self Also known as: <<

Returns hmac updated with the message to be authenticated. Can be called repeatedly with chunks of the message.

Example

first_chunk = ‘The quick brown fox jumps ’ second_chunk = ‘over the lazy dog’

instance.update(first_chunk) #=> 5b9a8038a65d571076d97fe783989e52278a492a instance.update(second_chunk) #=> de7c9b85b8b78aa6bc8a7a36f70a90701c9db4d9

Returns:

  • (self)


157
158
159
160
161
162
163
164
165
166
167
168
# File 'ossl_hmac.c', line 157

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;
}