Skip to main content



Hash is the abstract base class for hash classes.


name: string

The name of the hash algorithm

isSupported: boolean


preload(): Promise<void>

Asynchronously loads required libraries. For some hash classes this must be completed before hashSync() is available.

hash(data: ArrayBuffer): Promise<ArrayBuffer>

Asynchronously hashes data.

hashSync(data: ArrayBuffer): ArrayBuffer

Synchronously hashes data.

For some hashions preload() must have been called and completed before synchronous operations are available.

hashBatches(data: AsyncIterable<ArrayBuffer>): AsyncIterable<ArrayBuffer>

Asynchronously hashes data in batches.

If the underlying hashion does not support streaming hashion, the incoming data will be concatenated into a single ArrayBuffer and a single hashed batch will be yielded.