update

Bun

Symbol

CryptoHasher.update

inputEncoding?: Encoding

Update the hash with data

Referenced types

type BlobOrStringOrBuffer = string | NodeJS.TypedArray | ArrayBufferLike | Blob

class CryptoHasher

Hardware-accelerated cryptographic hash functions

Used for crypto.createHash()

  • readonly algorithm: SupportedCryptoAlgorithms

    The algorithm chosen to hash the data

  • readonly byteLength: number

    The length of the output hash in bytes

  • readonly static algorithms: SupportedCryptoAlgorithms[]

    List of supported hash algorithms

    These are hardware accelerated with BoringSSL

  • Perform a deep copy of the hasher

  • digest(): string;

    Finalize the hash. Resets the CryptoHasher so it can be reused.

    @param encoding

    DigestEncoding to return the hash in. If none is provided, it will return a Uint8Array.

    digest(): Buffer;

    Finalize the hash and return a Buffer

    digest(): TypedArray;

    Finalize the hash

    @param hashInto

    TypedArray to write the hash into. Faster than creating a new one each time

  • inputEncoding?: Encoding

    Update the hash with data

  • static hash(
    ): Buffer;

    Run the hash over the given data

    @param input

    string, Uint8Array, or ArrayBuffer to hash. Uint8Array or ArrayBuffer is faster.

    static hash(
    hashInto: TypedArray
    ): TypedArray;

    Run the hash over the given data

    @param input

    string, Uint8Array, or ArrayBuffer to hash. Uint8Array or ArrayBuffer is faster.

    @param hashInto

    TypedArray to write the hash into. Faster than creating a new one each time

    static hash(
    encoding: DigestEncoding
    ): string;

    Run the hash over the given data

    @param input

    string, Uint8Array, or ArrayBuffer to hash. Uint8Array or ArrayBuffer is faster.

    @param encoding

    DigestEncoding to return the hash in