Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Hash

public

An object that provides a hash of data provided in chunks to update. The hash may be performed incrementally as chunks are received or all at once when the hash is finalized, depending on the underlying implementation.

deprecated

use Checksum

Hierarchy

  • Hash

Implements

Index

Constructors

Methods

Constructors

constructor

  • Parameters

    • algorithmIdentifier: string
    • Optional secret: SourceData

    Returns Hash

Methods

digest

  • digest(): Promise<Uint8Array>
  • digest(): Promise<Uint8Array>
  • Finalizes the hash and provides a promise that will be fulfilled with the raw bytes of the calculated hash.

    Returns Promise<Uint8Array>

  • Finalizes the hash and provides a promise that will be fulfilled with the raw bytes of the calculated hash.

    Returns Promise<Uint8Array>

reset

  • reset(): void
  • Returns void

update

  • update(toHash: SourceData, encoding?: "utf8" | "ascii" | "latin1"): void
  • update(toHash: SourceData, encoding?: "utf8" | "ascii" | "latin1"): void
  • Adds a chunk of data to the hash. If a buffer is provided, the encoding argument will be ignored. If a string is provided without a specified encoding, implementations must assume UTF-8 encoding.

    Not all encodings are supported on all platforms, though all must support UTF-8.

    Parameters

    • toHash: SourceData
    • Optional encoding: "utf8" | "ascii" | "latin1"

    Returns void

  • Adds a chunk of data to the hash. If a buffer is provided, the encoding argument will be ignored. If a string is provided without a specified encoding, implementations must assume UTF-8 encoding. Not all encodings are supported on all platforms, though all must support UTF-8.

    Parameters

    • toHash: SourceData
    • Optional encoding: "utf8" | "ascii" | "latin1"

    Returns void