hmac.d.ts 1.0 KB

1234567891011121314151617181920212223242526272829303132333435
  1. /**
  2. * HMAC: RFC2104 message authentication code.
  3. * @module
  4. */
  5. import { Hash, type CHash, type Input } from './utils.ts';
  6. export declare class HMAC<T extends Hash<T>> extends Hash<HMAC<T>> {
  7. oHash: T;
  8. iHash: T;
  9. blockLen: number;
  10. outputLen: number;
  11. private finished;
  12. private destroyed;
  13. constructor(hash: CHash, _key: Input);
  14. update(buf: Input): this;
  15. digestInto(out: Uint8Array): void;
  16. digest(): Uint8Array;
  17. _cloneInto(to?: HMAC<T>): HMAC<T>;
  18. clone(): HMAC<T>;
  19. destroy(): void;
  20. }
  21. /**
  22. * HMAC: RFC2104 message authentication code.
  23. * @param hash - function that would be used e.g. sha256
  24. * @param key - message key
  25. * @param message - message data
  26. * @example
  27. * import { hmac } from '@noble/hashes/hmac';
  28. * import { sha256 } from '@noble/hashes/sha2';
  29. * const mac1 = hmac(sha256, 'key', 'message');
  30. */
  31. export declare const hmac: {
  32. (hash: CHash, key: Input, message: Input): Uint8Array;
  33. create(hash: CHash, key: Input): HMAC<any>;
  34. };
  35. //# sourceMappingURL=hmac.d.ts.map