@taquito/timelock 24.3.0 → 25.0.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3,6 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VERSION = void 0;
4
4
  // IMPORTANT: THIS FILE IS AUTO GENERATED! DO NOT MANUALLY EDIT!
5
5
  exports.VERSION = {
6
- "commitHash": "f724c83a603e3623928be71c46030af223a779ee",
7
- "version": "24.3.0"
6
+ "commitHash": "9851c9b7e8387a82f8ff0aa6a34277a9108bb68c",
7
+ "version": "25.0.0-beta.1"
8
8
  };
@@ -2,22 +2,62 @@ import { openSecretBox, secretBox } from '@stablelib/nacl';
2
2
  import bigInt from 'big-integer';
3
3
 
4
4
  /**
5
- * Utilities for hex, bytes, CSPRNG.
6
- * @module
5
+ * Checks if something is Uint8Array. Be careful: nodejs Buffer will return true.
6
+ * @param a - value to test
7
+ * @returns `true` when the value is a Uint8Array-compatible view.
8
+ * @example
9
+ * Check whether a value is a Uint8Array-compatible view.
10
+ * ```ts
11
+ * isBytes(new Uint8Array([1, 2, 3]));
12
+ * ```
7
13
  */
8
- /*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */
9
- /** Checks if something is Uint8Array. Be careful: nodejs Buffer will return true. */
10
14
  function isBytes(a) {
11
- return a instanceof Uint8Array || (ArrayBuffer.isView(a) && a.constructor.name === 'Uint8Array');
15
+ // Plain `instanceof Uint8Array` is too strict for some Buffer / proxy / cross-realm cases.
16
+ // The fallback still requires a real ArrayBuffer view, so plain
17
+ // JSON-deserialized `{ constructor: ... }` spoofing is rejected, and
18
+ // `BYTES_PER_ELEMENT === 1` keeps the fallback on byte-oriented views.
19
+ return (a instanceof Uint8Array ||
20
+ (ArrayBuffer.isView(a) &&
21
+ a.constructor.name === 'Uint8Array' &&
22
+ 'BYTES_PER_ELEMENT' in a &&
23
+ a.BYTES_PER_ELEMENT === 1));
12
24
  }
13
- /** Asserts something is positive integer. */
25
+ /**
26
+ * Asserts something is a non-negative integer.
27
+ * @param n - number to validate
28
+ * @param title - label included in thrown errors
29
+ * @throws On wrong argument types. {@link TypeError}
30
+ * @throws On wrong argument ranges or values. {@link RangeError}
31
+ * @example
32
+ * Validate a non-negative integer option.
33
+ * ```ts
34
+ * anumber(32, 'length');
35
+ * ```
36
+ */
14
37
  function anumber(n, title = '') {
38
+ if (typeof n !== 'number') {
39
+ const prefix = title && `"${title}" `;
40
+ throw new TypeError(`${prefix}expected number, got ${typeof n}`);
41
+ }
15
42
  if (!Number.isSafeInteger(n) || n < 0) {
16
43
  const prefix = title && `"${title}" `;
17
- throw new Error(`${prefix}expected integer >= 0, got ${n}`);
44
+ throw new RangeError(`${prefix}expected integer >= 0, got ${n}`);
18
45
  }
19
46
  }
20
- /** Asserts something is Uint8Array. */
47
+ /**
48
+ * Asserts something is Uint8Array.
49
+ * @param value - value to validate
50
+ * @param length - optional exact length constraint
51
+ * @param title - label included in thrown errors
52
+ * @returns The validated byte array.
53
+ * @throws On wrong argument types. {@link TypeError}
54
+ * @throws On wrong argument ranges or values. {@link RangeError}
55
+ * @example
56
+ * Validate that a value is a byte array.
57
+ * ```ts
58
+ * abytes(new Uint8Array([1, 2, 3]));
59
+ * ```
60
+ */
21
61
  function abytes(value, length, title = '') {
22
62
  const bytes = isBytes(value);
23
63
  const len = value?.length;
@@ -26,64 +66,171 @@ function abytes(value, length, title = '') {
26
66
  const prefix = title && `"${title}" `;
27
67
  const ofLen = needsLen ? ` of length ${length}` : '';
28
68
  const got = bytes ? `length=${len}` : `type=${typeof value}`;
29
- throw new Error(prefix + 'expected Uint8Array' + ofLen + ', got ' + got);
69
+ const message = prefix + 'expected Uint8Array' + ofLen + ', got ' + got;
70
+ if (!bytes)
71
+ throw new TypeError(message);
72
+ throw new RangeError(message);
30
73
  }
31
74
  return value;
32
75
  }
33
- /** Asserts a hash instance has not been destroyed / finished */
76
+ /**
77
+ * Asserts a hash instance has not been destroyed or finished.
78
+ * @param instance - hash instance to validate
79
+ * @param checkFinished - whether to reject finalized instances
80
+ * @throws If the hash instance has already been destroyed or finalized. {@link Error}
81
+ * @example
82
+ * Validate that a hash instance is still usable.
83
+ * ```ts
84
+ * import { aexists } from '@noble/hashes/utils.js';
85
+ * import { sha256 } from '@noble/hashes/sha2.js';
86
+ * const hash = sha256.create();
87
+ * aexists(hash);
88
+ * ```
89
+ */
34
90
  function aexists(instance, checkFinished = true) {
35
91
  if (instance.destroyed)
36
92
  throw new Error('Hash instance has been destroyed');
37
93
  if (checkFinished && instance.finished)
38
94
  throw new Error('Hash#digest() has already been called');
39
95
  }
40
- /** Asserts output is properly-sized byte array */
96
+ /**
97
+ * Asserts output is a sufficiently-sized byte array.
98
+ * @param out - destination buffer
99
+ * @param instance - hash instance providing output length
100
+ * Oversized buffers are allowed; downstream code only promises to fill the first `outputLen` bytes.
101
+ * @throws On wrong argument types. {@link TypeError}
102
+ * @throws On wrong argument ranges or values. {@link RangeError}
103
+ * @example
104
+ * Validate a caller-provided digest buffer.
105
+ * ```ts
106
+ * import { aoutput } from '@noble/hashes/utils.js';
107
+ * import { sha256 } from '@noble/hashes/sha2.js';
108
+ * const hash = sha256.create();
109
+ * aoutput(new Uint8Array(hash.outputLen), hash);
110
+ * ```
111
+ */
41
112
  function aoutput(out, instance) {
42
113
  abytes(out, undefined, 'digestInto() output');
43
114
  const min = instance.outputLen;
44
115
  if (out.length < min) {
45
- throw new Error('"digestInto() output" expected to be of length >=' + min);
116
+ throw new RangeError('"digestInto() output" expected to be of length >=' + min);
46
117
  }
47
118
  }
48
- /** Cast u8 / u16 / u32 to u32. */
119
+ /**
120
+ * Casts a typed array view to Uint32Array.
121
+ * `arr.byteOffset` must already be 4-byte aligned or the platform
122
+ * Uint32Array constructor will throw.
123
+ * @param arr - source typed array
124
+ * @returns Uint32Array view over the same buffer.
125
+ * @example
126
+ * Reinterpret a byte array as 32-bit words.
127
+ * ```ts
128
+ * u32(new Uint8Array(8));
129
+ * ```
130
+ */
49
131
  function u32(arr) {
50
132
  return new Uint32Array(arr.buffer, arr.byteOffset, Math.floor(arr.byteLength / 4));
51
133
  }
52
- /** Zeroize a byte array. Warning: JS provides no guarantees. */
134
+ /**
135
+ * Zeroizes typed arrays in place. Warning: JS provides no guarantees.
136
+ * @param arrays - arrays to overwrite with zeros
137
+ * @example
138
+ * Zeroize sensitive buffers in place.
139
+ * ```ts
140
+ * clean(new Uint8Array([1, 2, 3]));
141
+ * ```
142
+ */
53
143
  function clean(...arrays) {
54
144
  for (let i = 0; i < arrays.length; i++) {
55
145
  arrays[i].fill(0);
56
146
  }
57
147
  }
58
- /** Is current platform little-endian? Most are. Big-Endian platform: IBM */
148
+ /** Whether the current platform is little-endian. */
59
149
  const isLE = /* @__PURE__ */ (() => new Uint8Array(new Uint32Array([0x11223344]).buffer)[0] === 0x44)();
60
- /** The byte swap operation for uint32 */
150
+ /**
151
+ * Byte-swap operation for uint32 values.
152
+ * @param word - source word
153
+ * @returns Word with reversed byte order.
154
+ * @example
155
+ * Reverse the byte order of a 32-bit word.
156
+ * ```ts
157
+ * byteSwap(0x11223344);
158
+ * ```
159
+ */
61
160
  function byteSwap(word) {
62
161
  return (((word << 24) & 0xff000000) |
63
162
  ((word << 8) & 0xff0000) |
64
163
  ((word >>> 8) & 0xff00) |
65
164
  ((word >>> 24) & 0xff));
66
165
  }
67
- /** Conditionally byte swap if on a big-endian platform */
166
+ /**
167
+ * Conditionally byte-swaps one 32-bit word on big-endian platforms.
168
+ * @param n - source word
169
+ * @returns Original or byte-swapped word depending on platform endianness.
170
+ * @example
171
+ * Normalize a 32-bit word for host endianness.
172
+ * ```ts
173
+ * swap8IfBE(0x11223344);
174
+ * ```
175
+ */
68
176
  const swap8IfBE = isLE
69
177
  ? (n) => n
70
- : (n) => byteSwap(n);
71
- /** In place byte swap for Uint32Array */
178
+ : (n) => byteSwap(n) >>> 0;
179
+ /**
180
+ * Byte-swaps every word of a Uint32Array in place.
181
+ * @param arr - array to mutate
182
+ * @returns The same array after mutation; callers pass live state arrays here.
183
+ * @example
184
+ * Reverse the byte order of every word in place.
185
+ * ```ts
186
+ * byteSwap32(new Uint32Array([0x11223344]));
187
+ * ```
188
+ */
72
189
  function byteSwap32(arr) {
73
190
  for (let i = 0; i < arr.length; i++) {
74
191
  arr[i] = byteSwap(arr[i]);
75
192
  }
76
193
  return arr;
77
194
  }
195
+ /**
196
+ * Conditionally byte-swaps a Uint32Array on big-endian platforms.
197
+ * @param u - array to normalize for host endianness
198
+ * @returns Original or byte-swapped array depending on platform endianness.
199
+ * On big-endian runtimes this mutates `u` in place via `byteSwap32(...)`.
200
+ * @example
201
+ * Normalize a word array for host endianness.
202
+ * ```ts
203
+ * swap32IfBE(new Uint32Array([0x11223344]));
204
+ * ```
205
+ */
78
206
  const swap32IfBE = isLE
79
207
  ? (u) => u
80
208
  : byteSwap32;
81
- /** Creates function with outputLen, blockLen, create properties from a class constructor. */
209
+ /**
210
+ * Creates a callable hash function from a stateful class constructor.
211
+ * @param hashCons - hash constructor or factory
212
+ * @param info - optional metadata such as DER OID
213
+ * @returns Frozen callable hash wrapper with `.create()`.
214
+ * Wrapper construction eagerly calls `hashCons(undefined)` once to read
215
+ * `outputLen` / `blockLen`, so constructor side effects happen at module
216
+ * init time.
217
+ * @example
218
+ * Wrap a stateful hash constructor into a callable helper.
219
+ * ```ts
220
+ * import { createHasher } from '@noble/hashes/utils.js';
221
+ * import { sha256 } from '@noble/hashes/sha2.js';
222
+ * const wrapped = createHasher(sha256.create, { oid: sha256.oid });
223
+ * wrapped(new Uint8Array([1]));
224
+ * ```
225
+ */
82
226
  function createHasher(hashCons, info = {}) {
83
- const hashC = (msg, opts) => hashCons(opts).update(msg).digest();
227
+ const hashC = (msg, opts) => hashCons(opts)
228
+ .update(msg)
229
+ .digest();
84
230
  const tmp = hashCons(undefined);
85
231
  hashC.outputLen = tmp.outputLen;
86
232
  hashC.blockLen = tmp.blockLen;
233
+ hashC.canXOF = tmp.canXOF;
87
234
  hashC.create = (opts) => hashCons(opts);
88
235
  Object.assign(hashC, info);
89
236
  return Object.freeze(hashC);
@@ -94,8 +241,10 @@ function createHasher(hashCons, info = {}) {
94
241
  * @module
95
242
  */
96
243
  /**
97
- * Internal blake variable.
98
- * For BLAKE2b, the two extra permutations for rounds 10 and 11 are SIGMA[10..11] = SIGMA[0..1].
244
+ * Internal blake permutation table.
245
+ * Rows `0..9` serve BLAKE2s, rows `0..11` serve BLAKE2b with `10..11 = 0..1`, and Blake1 also
246
+ * reuses the later rows shown below. Blake1 expands rounds `10..15` as `SIGMA[i % 10]`, so rows
247
+ * `10..15` intentionally repeat rows `0..5` for the 14-round (256) and 16-round (512) variants.
99
248
  */
100
249
  // prettier-ignore
101
250
  const BSIGMA = /* @__PURE__ */ Uint8Array.from([
@@ -118,35 +267,38 @@ const BSIGMA = /* @__PURE__ */ Uint8Array.from([
118
267
  2, 12, 6, 10, 0, 11, 8, 3, 4, 13, 7, 5, 15, 14, 1, 9,
119
268
  ]);
120
269
 
121
- /**
122
- * Internal helpers for u64. BigUint64Array is too slow as per 2025, so we implement it using Uint32Array.
123
- * @todo re-check https://issues.chromium.org/issues/42212588
124
- * @module
125
- */
126
270
  const U32_MASK64 = /* @__PURE__ */ BigInt(2 ** 32 - 1);
127
271
  const _32n = /* @__PURE__ */ BigInt(32);
272
+ // Split bigint into two 32-bit halves. With `le=true`, returned fields become `{ h: low, l: high
273
+ // }` to match little-endian word order rather than the property names.
128
274
  function fromBig(n, le = false) {
129
275
  if (le)
130
276
  return { h: Number(n & U32_MASK64), l: Number((n >> _32n) & U32_MASK64) };
131
277
  return { h: Number((n >> _32n) & U32_MASK64) | 0, l: Number(n & U32_MASK64) | 0 };
132
278
  }
133
- // Right rotate for Shift in [1, 32)
279
+ // High 32-bit half of a 64-bit right rotate, valid for `s` in `1..31`.
134
280
  const rotrSH = (h, l, s) => (h >>> s) | (l << (32 - s));
281
+ // Low 32-bit half of a 64-bit right rotate, valid for `s` in `1..31`.
135
282
  const rotrSL = (h, l, s) => (h << (32 - s)) | (l >>> s);
136
- // Right rotate for Shift in (32, 64), NOTE: 32 is special case.
283
+ // High 32-bit half of a 64-bit right rotate, valid for `s` in `33..63`; `32` uses `rotr32*`.
137
284
  const rotrBH = (h, l, s) => (h << (64 - s)) | (l >>> (s - 32));
285
+ // Low 32-bit half of a 64-bit right rotate, valid for `s` in `33..63`; `32` uses `rotr32*`.
138
286
  const rotrBL = (h, l, s) => (h >>> (s - 32)) | (l << (64 - s));
139
- // Right rotate for shift===32 (just swaps l&h)
287
+ // High 32-bit half of a 64-bit right rotate for `s === 32`; this is just the swapped low half.
140
288
  const rotr32H = (_h, l) => l;
289
+ // Low 32-bit half of a 64-bit right rotate for `s === 32`; this is just the swapped high half.
141
290
  const rotr32L = (h, _l) => h;
142
- // JS uses 32-bit signed integers for bitwise operations which means we cannot
143
- // simple take carry out of low bit sum by shift, we need to use division.
291
+ // Add two split 64-bit words and return the split `{ h, l }` sum.
292
+ // JS uses 32-bit signed integers for bitwise operations, so we cannot simply shift the carry out
293
+ // of the low sum and instead use division.
144
294
  function add(Ah, Al, Bh, Bl) {
145
295
  const l = (Al >>> 0) + (Bl >>> 0);
146
296
  return { h: (Ah + Bh + ((l / 2 ** 32) | 0)) | 0, l: l | 0 };
147
297
  }
148
298
  // Addition with more than 2 elements
299
+ // Unmasked low-word accumulator for 3-way addition; pass the raw result into `add3H(...)`.
149
300
  const add3L = (Al, Bl, Cl) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0);
301
+ // High-word finalize step for 3-way addition; `low` must be the untruncated output of `add3L(...)`.
150
302
  const add3H = (low, Ah, Bh, Ch) => (Ah + Bh + Ch + ((low / 2 ** 32) | 0)) | 0;
151
303
 
152
304
  /**
@@ -154,14 +306,15 @@ const add3H = (low, Ah, Bh, Ch) => (Ah + Bh + Ch + ((low / 2 ** 32) | 0)) | 0;
154
306
  * b could have been faster, but there is no fast u64 in js, so s is 1.5x faster.
155
307
  * @module
156
308
  */
157
- // Same as SHA512_IV, but swapped endianness: LE instead of BE. iv[1] is iv[0], etc.
309
+ // Same IV words as `SHA512_IV`, but endian-swapped into LE u32 low/high halves
310
+ // for the BLAKE2b u64 helpers below.
158
311
  const B2B_IV = /* @__PURE__ */ Uint32Array.from([
159
312
  0xf3bcc908, 0x6a09e667, 0x84caa73b, 0xbb67ae85, 0xfe94f82b, 0x3c6ef372, 0x5f1d36f1, 0xa54ff53a,
160
313
  0xade682d1, 0x510e527f, 0x2b3e6c1f, 0x9b05688c, 0xfb41bd6b, 0x1f83d9ab, 0x137e2179, 0x5be0cd19,
161
314
  ]);
162
- // Temporary buffer
315
+ // Shared synchronous BLAKE2b work vector as LE u32 low/high halves.
163
316
  const BBUF = /* @__PURE__ */ new Uint32Array(32);
164
- // Mixing function G splitted in two halfs
317
+ // BLAKE2b G mix split into two half-rounds over LE u32 low/high limbs.
165
318
  function G1b(a, b, c, d, msg, x) {
166
319
  // NOTE: V is LE here
167
320
  const Xl = msg[x], Xh = msg[x + 1]; // prettier-ignore
@@ -186,6 +339,7 @@ function G1b(a, b, c, d, msg, x) {
186
339
  ((BBUF[2 * c] = Cl), (BBUF[2 * c + 1] = Ch));
187
340
  ((BBUF[2 * d] = Dl), (BBUF[2 * d + 1] = Dh));
188
341
  }
342
+ // Second half-round of the same LE-limb BLAKE2b G mix; `x` is the message word offset.
189
343
  function G2b(a, b, c, d, msg, x) {
190
344
  // NOTE: V is LE here
191
345
  const Xl = msg[x], Xh = msg[x + 1]; // prettier-ignore
@@ -212,9 +366,11 @@ function G2b(a, b, c, d, msg, x) {
212
366
  }
213
367
  function checkBlake2Opts(outputLen, opts = {}, keyLen, saltLen, persLen) {
214
368
  anumber(keyLen);
215
- if (outputLen < 0 || outputLen > keyLen)
369
+ // RFC 7693 §2.1 requires digest length nn in 1..keyLen.
370
+ if (outputLen <= 0 || outputLen > keyLen)
216
371
  throw new Error('outputLen bigger than keyLen');
217
372
  const { key, salt, personalization } = opts;
373
+ // This API uses `undefined` for the RFC 7693 `kk = 0` case, so a provided key must be non-empty.
218
374
  if (key !== undefined && (key.length < 1 || key.length > keyLen))
219
375
  throw new Error('"key" expected to be undefined or of length=1..' + keyLen);
220
376
  if (salt !== undefined)
@@ -232,6 +388,7 @@ class _BLAKE2 {
232
388
  pos = 0;
233
389
  blockLen;
234
390
  outputLen;
391
+ canXOF = false;
235
392
  constructor(blockLen, outputLen) {
236
393
  anumber(blockLen);
237
394
  anumber(outputLen);
@@ -261,7 +418,7 @@ class _BLAKE2 {
261
418
  }
262
419
  const take = Math.min(blockLen - this.pos, len - pos);
263
420
  const dataOffset = offset + pos;
264
- // full block && aligned to 4 bytes && not last in input
421
+ // Zero-copy only for full, 4-byte-aligned, non-final blocks.
265
422
  if (take === blockLen && !(dataOffset % 4) && pos + take < len) {
266
423
  const data32 = new Uint32Array(buf, dataOffset, Math.floor((len - pos) / 4));
267
424
  swap32IfBE(data32);
@@ -289,18 +446,33 @@ class _BLAKE2 {
289
446
  swap32IfBE(buffer32);
290
447
  this.compress(buffer32, 0, true);
291
448
  swap32IfBE(buffer32);
449
+ // Reject unaligned views explicitly instead of hiding them behind a full scratch copy.
450
+ if (out.byteOffset & 3)
451
+ throw new RangeError('"digestInto() output" expected 4-byte aligned byteOffset, got ' + out.byteOffset);
452
+ const state = this.get();
292
453
  const out32 = u32(out);
293
- this.get().forEach((v, i) => (out32[i] = swap8IfBE(v)));
454
+ const full = Math.floor(this.outputLen / 4);
455
+ for (let i = 0; i < full; i++)
456
+ out32[i] = swap8IfBE(state[i]);
457
+ const tail = this.outputLen % 4;
458
+ if (!tail)
459
+ return;
460
+ const off = full * 4;
461
+ const word = state[full];
462
+ for (let i = 0; i < tail; i++)
463
+ out[off + i] = word >>> (8 * i);
294
464
  }
295
465
  digest() {
296
466
  const { buffer, outputLen } = this;
297
467
  this.digestInto(buffer);
468
+ // Return a copy so callers do not alias the instance scratch buffer used during finalization.
298
469
  const res = buffer.slice(0, outputLen);
299
470
  this.destroy();
300
471
  return res;
301
472
  }
302
473
  _cloneInto(to) {
303
474
  const { buffer, length, finished, destroyed, outputLen, pos } = this;
475
+ // Recreate only `dkLen`; key/salt/personalization are already absorbed into the copied state.
304
476
  to ||= new this.constructor({ dkLen: outputLen });
305
477
  to.set(...this.get());
306
478
  to.buffer.set(buffer);
@@ -316,9 +488,9 @@ class _BLAKE2 {
316
488
  return this._cloneInto();
317
489
  }
318
490
  }
319
- /** Internal blake2b hash class. */
491
+ /** Internal blake2b hash class with state stored as LE u32 low/high halves. */
320
492
  class _BLAKE2b extends _BLAKE2 {
321
- // Same as SHA-512, but LE
493
+ // Same IV words as SHA-512 / BLAKE2b, encoded as LE u32 low/high halves.
322
494
  v0l = B2B_IV[0] | 0;
323
495
  v0h = B2B_IV[1] | 0;
324
496
  v1l = B2B_IV[2] | 0;
@@ -345,6 +517,8 @@ class _BLAKE2b extends _BLAKE2 {
345
517
  abytes(key, undefined, 'key');
346
518
  keyLength = key.length;
347
519
  }
520
+ // RFC 7693 §2.5: xor `p[0] = 0x0101kknn` into the low 32 bits of `h[0]`;
521
+ // the high 32 bits stay at `IV[0]`.
348
522
  this.v0l ^= this.outputLen | (keyLength << 8) | (0x01 << 16) | (0x01 << 24);
349
523
  if (salt !== undefined) {
350
524
  abytes(salt, undefined, 'salt');
@@ -406,6 +580,8 @@ class _BLAKE2b extends _BLAKE2 {
406
580
  }
407
581
  let j = 0;
408
582
  const s = BSIGMA;
583
+ // SIGMA selects 64-bit message words; multiply by 2 because `msg` stores
584
+ // each word as [low32, high32].
409
585
  for (let i = 0; i < 12; i++) {
410
586
  G1b(0, 4, 8, 12, msg, offset + 2 * s[j++]);
411
587
  G2b(0, 4, 8, 12, msg, offset + 2 * s[j++]);
@@ -451,7 +627,15 @@ class _BLAKE2b extends _BLAKE2 {
451
627
  /**
452
628
  * Blake2b hash function. 64-bit. 1.5x slower than blake2s in JS.
453
629
  * @param msg - message that would be hashed
454
- * @param opts - dkLen output length, key for MAC mode, salt, personalization
630
+ * @param opts - Optional output, MAC, salt, and personalization settings.
631
+ * `dkLen` must be 1..64 bytes; `salt` and `personalization`, if present,
632
+ * must be 16 bytes each. See {@link Blake2Opts}.
633
+ * @returns Digest bytes.
634
+ * @example
635
+ * Hash a message with Blake2b.
636
+ * ```ts
637
+ * blake2b(new Uint8Array([97, 98, 99]));
638
+ * ```
455
639
  */
456
640
  const blake2b = /* @__PURE__ */ createHasher((opts) => new _BLAKE2b(opts));
457
641