Class: Toybox::Cryptography::HashBasedMessageAuthenticationCode

Inherits:
Lang::Object
  • Object
show all

Overview

Hash-Based Message Authentication Code (HMAC) object.

A HashBasedMessageAuthenticationCode is an object that can be used to compute a message authentication code using the HMAC algorithm.

Instance Method Summary collapse

Methods inherited from Lang::Object

equals, hashCode, method, toString, weak

Constructor Details

initialize(options) ⇒ HashBasedMessageAuthenticationCode

Returns a new instance of HashBasedMessageAuthenticationCode

Parameters:

Options Hash (options):

  • :algorithm (Toybox::Lang::Number)

    A HASH_* value specifying the type of Hash used for this HMAC computation; HASH_SHA256 is the only supported algorithm in Connect IQ 3.x (required)

  • :key (Toybox::Lang::ByteArray)

    The secret key used to compute the message authentication code, which can be of any length in bytes (required)

Raises:

Since:

  • 3.0.0


3858
3859
# File 'Monkeybrains.rb', line 3858

def initialize(options)
end

Instance Method Details

digestToybox::Lang::ByteArray

Return the digest of the authentication code.

The state of the object is reset and can be used to compute a new authentication code with the same options.

Returns:

Since:

  • 3.0.0


3880
3881
# File 'Monkeybrains.rb', line 3880

def digest()
end

update(message) ⇒ Object

Continue computation of the HMAC by consuming the next chunk of data.

Repeated calls are equivalent to a single call with the concatenation of all the arguments.

Parameters:

Raises:

Since:

  • 3.0.0


3870
3871
# File 'Monkeybrains.rb', line 3870

def update(message)
end