Skip to content

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

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
See also #to_s #reset also in 4.0 · 3.4 · 3.3 · 3.2 · 3.1 · 3.0