The goog.crypt.Hmac Class

goog.crypt.Hmac
> goog.crypt.Hash

goog.crypt.Hmac(hasher, key, opt_blockSize)

hasher {!goog.crypt.Hash}
An object to serve as a hash function.
key {Array.<number>}
The secret key to use to calculate the hmac. Should be an array of not more than {@code blockSize} integers in {0, 255}.
opt_blockSize {number=}
Optional. The block size {@code hasher} uses. If not specified, 16.

.digest()

returns {Array.<number>}
The finalized hash computed from the internal accumulator.

.getHmac(message)

Calculates an HMAC for a given message.

message {Array.<number>}
An array of integers in {0, 255}.
returns {Array}
the digest of the given message.

.reset()

Resets the internal accumulator.

.update(bytes, opt_length)

Adds a byte array (array with values in [0-255] range) or a string (might only contain 8-bit, i.e., Latin1 characters) to the internal accumulator.

bytes {Array.<number>|Uint8Array|string}
Data used for the update.
opt_length {number=}
Number of bytes to use.