Class: Toybox.Cryptography.HashBasedMessageAuthenticationCode

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.

See Also:

Since:

API Level 3.0.0

Supported Devices:

Instance Method Summary collapse

Instance Method Details

digest() as 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:

  • Lang.ByteArray

    The computed message authentication code in network byte order

Since:

API Level 3.0.0

initialize(options as { :algorithm as Cryptography.HashAlgorithm, :key as Lang.ByteArray })

Constructor

Parameters:

  • options(Lang.Dictionary)

    A Dictionary of options

    • :algorithm(Cryptography.HashAlgorithm)

      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(Lang.ByteArray)

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

Since:

API Level 3.0.0

Throws:

update(message as Lang.ByteArray) as Void

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:

  • message(Lang.ByteArray)

    The next chunk of the message being hashed

Since:

API Level 3.0.0

Throws:


Generated Sep 23, 2024, 3:32:48 PM