Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface Checksum

public

An object that provides a checksum of data provided in chunks to update. The checksum may be performed incrementally as chunks are received or all at once when the checksum is finalized, depending on the underlying implementation. It's recommended to compute checksum incrementally to avoid reading the entire payload in memory. A class that implements this interface may accept an optional secret key in its constructor while computing checksum value, when using HMAC. If provided, this secret key would be used when computing checksum.

Hierarchy

  • Checksum

Implemented by

Index

Properties

Methods

Properties

Optional digestLength

digestLength: undefined | number

Constant length of the digest created by the algorithm in bytes.

Methods

Optional copy

  • Creates a new checksum object that contains a deep copy of the internal state of the current Checksum object.

    Returns Checksum

digest

  • digest(): Promise<Uint8Array>
  • Returns the digest of all of the data passed.

    Returns Promise<Uint8Array>

Optional mark

  • mark(readLimit: number): void
  • Allows marking a checksum for checksums that support the ability to mark and reset.

    Parameters

    • readLimit: number

      The maximum limit of bytes that can be read before the mark position becomes invalid.

    Returns void

reset

  • reset(): void
  • Resets the checksum to its initial value.

    Returns void

update

  • update(chunk: Uint8Array): void
  • Adds a chunk of data for which checksum needs to be computed. This can be called many times with new data as it is streamed.

    Implementations may override this method which passes second param which makes Checksum object stateless.

    Parameters

    • chunk: Uint8Array

      The buffer to update checksum with.

    Returns void