Function hmacSha256

  • Create a hash-based message authentication code using HMAC-SHA256 as specified in RFC 4231. Returns a 32-byte Uint8Array.

    Secrets longer than the block byte-length (64 bytes) are hashed before use, shortening their length to the minimum recommended length (32 bytes). See RFC 2104 for details.

    Parameters

    • secret: Uint8Array

      the secret key (recommended length: 32-64 bytes)

    • message: Uint8Array

      the message to authenticate

    • sha256: {
          hash: ((input: Uint8Array) => Uint8Array);
      } = internalSha256

      an implementation of Sha256

      • hash: ((input: Uint8Array) => Uint8Array)
          • (input: Uint8Array): Uint8Array
          • Returns the sha256 hash of the provided input.

            To incrementally construct a sha256 hash (e.g. for streaming), use init, update, and final.

            Parameters

            • input: Uint8Array

              a Uint8Array to be hashed using sha256

            Returns Uint8Array

    Returns Uint8Array

Generated using TypeDoc