Options
All
  • Public
  • Public/Protected
  • All
Menu

Module crypto

A module containing support for a variety of cryptographic operations.

Index

Crypto Classes

Crypto Type aliases

Crypto Functions

Crypto Type aliases

Hashable

Hashable: string | ArrayBuffer | DataView | Buffer

The types that are acceptable to use as input for hashing.

Crypto Functions

crc32

  • crc32(data: Hashable, previous?: undefined | number): number
  • Computes an crc32 checksum.

    Parameters

    • data: Hashable

      The data to checksum

    • Optional previous: undefined | number

      previous crc32 checksum result. Used if you are buffering large input.

    Returns number

crc32c

  • crc32c(data: Hashable, previous?: undefined | number): number
  • Computes a crc32c checksum.

    Parameters

    • data: Hashable

      The data to checksum

    • Optional previous: undefined | number

      previous crc32c checksum result. Used if you are buffering large input.

    Returns number

hash_md5

  • hash_md5(data: Hashable, truncate_to?: undefined | number): DataView
  • Computes an MD5 hash. Use this if you don't need to stream the data you're hashing and can load the entire input into memory.

    Parameters

    • data: Hashable

      The data to hash

    • Optional truncate_to: undefined | number

      The maximum number of bytes to receive. Leave as undefined or 0 to receive the entire digest.

    Returns DataView

hash_sha1

  • hash_sha1(data: Hashable, truncate_to?: undefined | number): DataView
  • Computes an SHA1 hash. Use this if you don't need to stream the data you're hashing and can load the entire input into memory.

    Parameters

    • data: Hashable

      The data to hash

    • Optional truncate_to: undefined | number

      The maximum number of bytes to receive. Leave as undefined or 0 to receive the entire digest.

    Returns DataView

hash_sha256

  • hash_sha256(data: Hashable, truncate_to?: undefined | number): DataView
  • Computes an SHA256 hash. Use this if you don't need to stream the data you're hashing and can load the entire input into memory.

    Parameters

    • data: Hashable

      The data to hash

    • Optional truncate_to: undefined | number

      The maximum number of bytes to receive. Leave as undefined or 0 to receive the entire digest.

    Returns DataView

hmac_sha256

  • hmac_sha256(secret: Hashable, data: Hashable, truncate_to?: undefined | number): DataView
  • Computes an SHA256 HMAC. Use this if you don't need to stream the data you're hashing and can load the entire input into memory.

    Parameters

    • secret: Hashable

      The key to use for the HMAC process

    • data: Hashable

      The data to hash

    • Optional truncate_to: undefined | number

      The maximum number of bytes to receive. Leave as undefined or 0 to receive the entire digest.

    Returns DataView

Generated using TypeDoc