hash-fn.d.ts 1.1 KB

123456789101112131415161718192021222324
  1. /// <reference types="node" />
  2. import { BaseHashInput, IBaseHashOptions } from '../base/hash-fn';
  3. /**
  4. * Input used for node-based hashes.
  5. */
  6. export declare type HashInput = BaseHashInput | string;
  7. /**
  8. * @hidden
  9. */
  10. export declare const normalizeInput: (input: HashInput, encoding?: "ascii" | "utf8" | "utf-8" | "utf16le" | "ucs2" | "ucs-2" | "base64" | "latin1" | "binary" | "hex" | undefined) => Uint8Array;
  11. /**
  12. * Returns a blake3 hash of the input, returning the binary hash data.
  13. */
  14. export declare function hash(input: HashInput, { length }?: IBaseHashOptions): Buffer | string;
  15. /**
  16. * Given cryptographic key material and a context string, services a subkey of
  17. * any length. See {@link https://docs.rs/blake3/0.1.3/blake3/fn.derive_key.html}
  18. * for more information.
  19. */
  20. export declare function deriveKey(context: string, material: HashInput, { length }?: IBaseHashOptions): Buffer;
  21. /**
  22. * The keyed hash function. See {@link https://docs.rs/blake3/0.1.3/blake3/fn.keyed_hash.html}.
  23. */
  24. export declare function keyedHash(key: Buffer, input: HashInput, { length }?: IBaseHashOptions): Buffer;