Skip to main content

Class: Sha1

Class to help with Sha1 scheme. TypeScript conversion from https://github.com/emn178/js-sha1. Although this algorithm should not be use in most cases, it is the default and most widely support for generating TOTP/HOTP codes.

Table of contents

Constructors

Methods

Constructors

constructor

new Sha1()

Create a new instance of Sha1.

Methods

sum

Static sum(data): Uint8Array

Perform Sum on the data.

Parameters

NameTypeDescription
dataUint8ArrayThe data to operate on.

Returns

Uint8Array

The sum of the data.


update

update(message): Sha1

Update the hash with the data.

throws Error if the hash has already been finalized.

Parameters

NameTypeDescription
messageUint8ArrayThe data to update the hash with.

Returns

Sha1

The instance for chaining.


digest

digest(): Uint8Array

Get the digest.

Returns

Uint8Array

The digest.