hash-fn.d.ts 953 B

123456789101112131415161718192021222324
  1. import { BaseHashInput, IBaseHashOptions } from '../base/hash-fn';
  2. import { Hash } from './hash';
  3. /**
  4. * Input used for browser-based hashes.
  5. */
  6. export declare type HashInput = BaseHashInput | string;
  7. /**
  8. * @hidden
  9. */
  10. export declare const normalizeInput: (input: import("..").HashInput) => Uint8Array;
  11. /**
  12. * Returns a blake3 hash of the input.
  13. */
  14. export declare function hash(input: HashInput, { length }?: IBaseHashOptions): Hash;
  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): Hash;
  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: Uint8Array, input: HashInput, { length }?: IBaseHashOptions): Hash;