Skip to main content

Class: HmacSha256

Class to help with HmacSha256 scheme. TypeScript conversion from https://github.com/emn178/js-sha256.

Table of contents

Constructors

Methods

Constructors

constructor

new HmacSha256(key, bits?)

Create a new instance of HmacSha256.

Parameters

NameTypeDefault valueDescription
keyUint8ArrayundefinedThe key for the hmac.
bitsnumber256The number of bits.

Methods

sum256

Static sum256(key, data): Uint8Array

Perform Sum 256 on the data.

Parameters

NameTypeDescription
keyUint8ArrayThe key for the hmac.
dataUint8ArrayThe data to operate on.

Returns

Uint8Array

The sum 256 of the data.


update

update(message): HmacSha256

Update the hash with the data.

Parameters

NameTypeDescription
messageUint8ArrayThe data to update the hash with.

Returns

HmacSha256

The instance for chaining.


digest

digest(): Uint8Array

Get the digest.

Returns

Uint8Array

The digest.