Skip to main content

Class: Sha256

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

Table of contents

Properties

Constructors

Methods

Properties

SIZE_256

Static Readonly SIZE_256: number = 256

Sha256 256.


SIZE_224

Static Readonly SIZE_224: number = 224

Sha256 224.

Constructors

constructor

new Sha256(bits?)

Create a new instance of Sha256.

Parameters

NameTypeDefault valueDescription
bitsnumberSha256.SIZE_256The number of bits.

Methods

sum256

Static sum256(data): Uint8Array

Perform Sum 256 on the data.

Parameters

NameTypeDescription
dataUint8ArrayThe data to operate on.

Returns

Uint8Array

The sum 256 of the data.


sum224

Static sum224(data): Uint8Array

Perform Sum 224 on the data.

Parameters

NameTypeDescription
dataUint8ArrayThe data to operate on.

Returns

Uint8Array

The sum 224 of the data.


update

update(message): Sha256

Update the hash with the data.

Parameters

NameTypeDescription
messageUint8ArrayThe data to update the hash with.

Returns

Sha256

The instance for chaining.


digest

digest(): Uint8Array

Get the digest.

Returns

Uint8Array

The digest.