sha3-addons.d.ts 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. import { Input, Hash, HashXOF } from './utils.js';
  2. import { Keccak, ShakeOpts } from './sha3.js';
  3. export type cShakeOpts = ShakeOpts & {
  4. personalization?: Input;
  5. NISTfn?: Input;
  6. };
  7. export declare const cshake128: {
  8. (msg: Input, opts?: cShakeOpts | undefined): Uint8Array;
  9. outputLen: number;
  10. blockLen: number;
  11. create(opts: cShakeOpts): HashXOF<Keccak>;
  12. };
  13. export declare const cshake256: {
  14. (msg: Input, opts?: cShakeOpts | undefined): Uint8Array;
  15. outputLen: number;
  16. blockLen: number;
  17. create(opts: cShakeOpts): HashXOF<Keccak>;
  18. };
  19. declare class KMAC extends Keccak implements HashXOF<KMAC> {
  20. constructor(blockLen: number, outputLen: number, enableXOF: boolean, key: Input, opts?: cShakeOpts);
  21. protected finish(): void;
  22. _cloneInto(to?: KMAC): KMAC;
  23. clone(): KMAC;
  24. }
  25. export declare const kmac128: {
  26. (key: Input, message: Input, opts?: cShakeOpts): Uint8Array;
  27. create(key: Input, opts?: cShakeOpts): KMAC;
  28. };
  29. export declare const kmac256: {
  30. (key: Input, message: Input, opts?: cShakeOpts): Uint8Array;
  31. create(key: Input, opts?: cShakeOpts): KMAC;
  32. };
  33. export declare const kmac128xof: {
  34. (key: Input, message: Input, opts?: cShakeOpts): Uint8Array;
  35. create(key: Input, opts?: cShakeOpts): KMAC;
  36. };
  37. export declare const kmac256xof: {
  38. (key: Input, message: Input, opts?: cShakeOpts): Uint8Array;
  39. create(key: Input, opts?: cShakeOpts): KMAC;
  40. };
  41. declare class TupleHash extends Keccak implements HashXOF<TupleHash> {
  42. constructor(blockLen: number, outputLen: number, enableXOF: boolean, opts?: cShakeOpts);
  43. protected finish(): void;
  44. _cloneInto(to?: TupleHash): TupleHash;
  45. clone(): TupleHash;
  46. }
  47. export declare const tuplehash128: {
  48. (messages: Input[], opts?: cShakeOpts): Uint8Array;
  49. create(opts?: cShakeOpts): TupleHash;
  50. };
  51. export declare const tuplehash256: {
  52. (messages: Input[], opts?: cShakeOpts): Uint8Array;
  53. create(opts?: cShakeOpts): TupleHash;
  54. };
  55. export declare const tuplehash128xof: {
  56. (messages: Input[], opts?: cShakeOpts): Uint8Array;
  57. create(opts?: cShakeOpts): TupleHash;
  58. };
  59. export declare const tuplehash256xof: {
  60. (messages: Input[], opts?: cShakeOpts): Uint8Array;
  61. create(opts?: cShakeOpts): TupleHash;
  62. };
  63. type ParallelOpts = cShakeOpts & {
  64. blockLen?: number;
  65. };
  66. declare class ParallelHash extends Keccak implements HashXOF<ParallelHash> {
  67. protected leafCons: () => Hash<Keccak>;
  68. private leafHash?;
  69. private chunkPos;
  70. private chunksDone;
  71. private chunkLen;
  72. constructor(blockLen: number, outputLen: number, leafCons: () => Hash<Keccak>, enableXOF: boolean, opts?: ParallelOpts);
  73. protected finish(): void;
  74. _cloneInto(to?: ParallelHash): ParallelHash;
  75. destroy(): void;
  76. clone(): ParallelHash;
  77. }
  78. export declare const parallelhash128: {
  79. (message: Input, opts?: ParallelOpts): Uint8Array;
  80. create(opts?: ParallelOpts): ParallelHash;
  81. };
  82. export declare const parallelhash256: {
  83. (message: Input, opts?: ParallelOpts): Uint8Array;
  84. create(opts?: ParallelOpts): ParallelHash;
  85. };
  86. export declare const parallelhash128xof: {
  87. (message: Input, opts?: ParallelOpts): Uint8Array;
  88. create(opts?: ParallelOpts): ParallelHash;
  89. };
  90. export declare const parallelhash256xof: {
  91. (message: Input, opts?: ParallelOpts): Uint8Array;
  92. create(opts?: ParallelOpts): ParallelHash;
  93. };
  94. export type TurboshakeOpts = ShakeOpts & {
  95. D?: number;
  96. };
  97. export declare const turboshake128: {
  98. (msg: Input, opts?: TurboshakeOpts | undefined): Uint8Array;
  99. outputLen: number;
  100. blockLen: number;
  101. create(opts: TurboshakeOpts): HashXOF<HashXOF<Keccak>>;
  102. };
  103. export declare const turboshake256: {
  104. (msg: Input, opts?: TurboshakeOpts | undefined): Uint8Array;
  105. outputLen: number;
  106. blockLen: number;
  107. create(opts: TurboshakeOpts): HashXOF<HashXOF<Keccak>>;
  108. };
  109. export type KangarooOpts = {
  110. dkLen?: number;
  111. personalization?: Input;
  112. };
  113. declare class KangarooTwelve extends Keccak implements HashXOF<KangarooTwelve> {
  114. protected leafLen: number;
  115. readonly chunkLen = 8192;
  116. private leafHash?;
  117. private personalization;
  118. private chunkPos;
  119. private chunksDone;
  120. constructor(blockLen: number, leafLen: number, outputLen: number, rounds: number, opts: KangarooOpts);
  121. update(data: Input): this;
  122. protected finish(): void;
  123. destroy(): void;
  124. _cloneInto(to?: KangarooTwelve): KangarooTwelve;
  125. clone(): KangarooTwelve;
  126. }
  127. export declare const k12: {
  128. (msg: Input, opts?: KangarooOpts | undefined): Uint8Array;
  129. outputLen: number;
  130. blockLen: number;
  131. create(opts: KangarooOpts): Hash<KangarooTwelve>;
  132. };
  133. export declare const m14: {
  134. (msg: Input, opts?: KangarooOpts | undefined): Uint8Array;
  135. outputLen: number;
  136. blockLen: number;
  137. create(opts: KangarooOpts): Hash<KangarooTwelve>;
  138. };
  139. declare class KeccakPRG extends Keccak {
  140. protected rate: number;
  141. constructor(capacity: number);
  142. keccak(): void;
  143. update(data: Input): this;
  144. feed(data: Input): this;
  145. protected finish(): void;
  146. digestInto(_out: Uint8Array): Uint8Array;
  147. fetch(bytes: number): Uint8Array;
  148. forget(): void;
  149. _cloneInto(to?: KeccakPRG): KeccakPRG;
  150. clone(): KeccakPRG;
  151. }
  152. export declare const keccakprg: (capacity?: number) => KeccakPRG;
  153. export {};
  154. //# sourceMappingURL=sha3-addons.d.ts.map