@taquito/utils 24.3.1-beta.1 → 25.0.0-rc.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": "9647402fcc62c98bf3907a30214fea8871b30bea",
7
- "version": "24.3.1-beta.1"
6
+ "commitHash": "13f62cd47ea018312f100b660d0225604c757afa",
7
+ "version": "25.0.0-rc.1"
8
8
  };
@@ -2190,22 +2190,62 @@ const payloadLength = {
2190
2190
  };
2191
2191
 
2192
2192
  /**
2193
- * Utilities for hex, bytes, CSPRNG.
2194
- * @module
2193
+ * Checks if something is Uint8Array. Be careful: nodejs Buffer will return true.
2194
+ * @param a - value to test
2195
+ * @returns `true` when the value is a Uint8Array-compatible view.
2196
+ * @example
2197
+ * Check whether a value is a Uint8Array-compatible view.
2198
+ * ```ts
2199
+ * isBytes(new Uint8Array([1, 2, 3]));
2200
+ * ```
2195
2201
  */
2196
- /*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */
2197
- /** Checks if something is Uint8Array. Be careful: nodejs Buffer will return true. */
2198
2202
  function isBytes(a) {
2199
- return a instanceof Uint8Array || (ArrayBuffer.isView(a) && a.constructor.name === 'Uint8Array');
2203
+ // Plain `instanceof Uint8Array` is too strict for some Buffer / proxy / cross-realm cases.
2204
+ // The fallback still requires a real ArrayBuffer view, so plain
2205
+ // JSON-deserialized `{ constructor: ... }` spoofing is rejected, and
2206
+ // `BYTES_PER_ELEMENT === 1` keeps the fallback on byte-oriented views.
2207
+ return (a instanceof Uint8Array ||
2208
+ (ArrayBuffer.isView(a) &&
2209
+ a.constructor.name === 'Uint8Array' &&
2210
+ 'BYTES_PER_ELEMENT' in a &&
2211
+ a.BYTES_PER_ELEMENT === 1));
2200
2212
  }
2201
- /** Asserts something is positive integer. */
2213
+ /**
2214
+ * Asserts something is a non-negative integer.
2215
+ * @param n - number to validate
2216
+ * @param title - label included in thrown errors
2217
+ * @throws On wrong argument types. {@link TypeError}
2218
+ * @throws On wrong argument ranges or values. {@link RangeError}
2219
+ * @example
2220
+ * Validate a non-negative integer option.
2221
+ * ```ts
2222
+ * anumber(32, 'length');
2223
+ * ```
2224
+ */
2202
2225
  function anumber(n, title = '') {
2226
+ if (typeof n !== 'number') {
2227
+ const prefix = title && `"${title}" `;
2228
+ throw new TypeError(`${prefix}expected number, got ${typeof n}`);
2229
+ }
2203
2230
  if (!Number.isSafeInteger(n) || n < 0) {
2204
2231
  const prefix = title && `"${title}" `;
2205
- throw new Error(`${prefix}expected integer >= 0, got ${n}`);
2232
+ throw new RangeError(`${prefix}expected integer >= 0, got ${n}`);
2206
2233
  }
2207
2234
  }
2208
- /** Asserts something is Uint8Array. */
2235
+ /**
2236
+ * Asserts something is Uint8Array.
2237
+ * @param value - value to validate
2238
+ * @param length - optional exact length constraint
2239
+ * @param title - label included in thrown errors
2240
+ * @returns The validated byte array.
2241
+ * @throws On wrong argument types. {@link TypeError}
2242
+ * @throws On wrong argument ranges or values. {@link RangeError}
2243
+ * @example
2244
+ * Validate that a value is a byte array.
2245
+ * ```ts
2246
+ * abytes(new Uint8Array([1, 2, 3]));
2247
+ * ```
2248
+ */
2209
2249
  function abytes(value, length, title = '') {
2210
2250
  const bytes = isBytes(value);
2211
2251
  const len = value?.length;
@@ -2214,64 +2254,171 @@ function abytes(value, length, title = '') {
2214
2254
  const prefix = title && `"${title}" `;
2215
2255
  const ofLen = needsLen ? ` of length ${length}` : '';
2216
2256
  const got = bytes ? `length=${len}` : `type=${typeof value}`;
2217
- throw new Error(prefix + 'expected Uint8Array' + ofLen + ', got ' + got);
2257
+ const message = prefix + 'expected Uint8Array' + ofLen + ', got ' + got;
2258
+ if (!bytes)
2259
+ throw new TypeError(message);
2260
+ throw new RangeError(message);
2218
2261
  }
2219
2262
  return value;
2220
2263
  }
2221
- /** Asserts a hash instance has not been destroyed / finished */
2264
+ /**
2265
+ * Asserts a hash instance has not been destroyed or finished.
2266
+ * @param instance - hash instance to validate
2267
+ * @param checkFinished - whether to reject finalized instances
2268
+ * @throws If the hash instance has already been destroyed or finalized. {@link Error}
2269
+ * @example
2270
+ * Validate that a hash instance is still usable.
2271
+ * ```ts
2272
+ * import { aexists } from '@noble/hashes/utils.js';
2273
+ * import { sha256 } from '@noble/hashes/sha2.js';
2274
+ * const hash = sha256.create();
2275
+ * aexists(hash);
2276
+ * ```
2277
+ */
2222
2278
  function aexists(instance, checkFinished = true) {
2223
2279
  if (instance.destroyed)
2224
2280
  throw new Error('Hash instance has been destroyed');
2225
2281
  if (checkFinished && instance.finished)
2226
2282
  throw new Error('Hash#digest() has already been called');
2227
2283
  }
2228
- /** Asserts output is properly-sized byte array */
2284
+ /**
2285
+ * Asserts output is a sufficiently-sized byte array.
2286
+ * @param out - destination buffer
2287
+ * @param instance - hash instance providing output length
2288
+ * Oversized buffers are allowed; downstream code only promises to fill the first `outputLen` bytes.
2289
+ * @throws On wrong argument types. {@link TypeError}
2290
+ * @throws On wrong argument ranges or values. {@link RangeError}
2291
+ * @example
2292
+ * Validate a caller-provided digest buffer.
2293
+ * ```ts
2294
+ * import { aoutput } from '@noble/hashes/utils.js';
2295
+ * import { sha256 } from '@noble/hashes/sha2.js';
2296
+ * const hash = sha256.create();
2297
+ * aoutput(new Uint8Array(hash.outputLen), hash);
2298
+ * ```
2299
+ */
2229
2300
  function aoutput(out, instance) {
2230
2301
  abytes(out, undefined, 'digestInto() output');
2231
2302
  const min = instance.outputLen;
2232
2303
  if (out.length < min) {
2233
- throw new Error('"digestInto() output" expected to be of length >=' + min);
2304
+ throw new RangeError('"digestInto() output" expected to be of length >=' + min);
2234
2305
  }
2235
2306
  }
2236
- /** Cast u8 / u16 / u32 to u32. */
2307
+ /**
2308
+ * Casts a typed array view to Uint32Array.
2309
+ * `arr.byteOffset` must already be 4-byte aligned or the platform
2310
+ * Uint32Array constructor will throw.
2311
+ * @param arr - source typed array
2312
+ * @returns Uint32Array view over the same buffer.
2313
+ * @example
2314
+ * Reinterpret a byte array as 32-bit words.
2315
+ * ```ts
2316
+ * u32(new Uint8Array(8));
2317
+ * ```
2318
+ */
2237
2319
  function u32(arr) {
2238
2320
  return new Uint32Array(arr.buffer, arr.byteOffset, Math.floor(arr.byteLength / 4));
2239
2321
  }
2240
- /** Zeroize a byte array. Warning: JS provides no guarantees. */
2322
+ /**
2323
+ * Zeroizes typed arrays in place. Warning: JS provides no guarantees.
2324
+ * @param arrays - arrays to overwrite with zeros
2325
+ * @example
2326
+ * Zeroize sensitive buffers in place.
2327
+ * ```ts
2328
+ * clean(new Uint8Array([1, 2, 3]));
2329
+ * ```
2330
+ */
2241
2331
  function clean(...arrays) {
2242
2332
  for (let i = 0; i < arrays.length; i++) {
2243
2333
  arrays[i].fill(0);
2244
2334
  }
2245
2335
  }
2246
- /** Is current platform little-endian? Most are. Big-Endian platform: IBM */
2336
+ /** Whether the current platform is little-endian. */
2247
2337
  const isLE = /* @__PURE__ */ (() => new Uint8Array(new Uint32Array([0x11223344]).buffer)[0] === 0x44)();
2248
- /** The byte swap operation for uint32 */
2338
+ /**
2339
+ * Byte-swap operation for uint32 values.
2340
+ * @param word - source word
2341
+ * @returns Word with reversed byte order.
2342
+ * @example
2343
+ * Reverse the byte order of a 32-bit word.
2344
+ * ```ts
2345
+ * byteSwap(0x11223344);
2346
+ * ```
2347
+ */
2249
2348
  function byteSwap(word) {
2250
2349
  return (((word << 24) & 0xff000000) |
2251
2350
  ((word << 8) & 0xff0000) |
2252
2351
  ((word >>> 8) & 0xff00) |
2253
2352
  ((word >>> 24) & 0xff));
2254
2353
  }
2255
- /** Conditionally byte swap if on a big-endian platform */
2354
+ /**
2355
+ * Conditionally byte-swaps one 32-bit word on big-endian platforms.
2356
+ * @param n - source word
2357
+ * @returns Original or byte-swapped word depending on platform endianness.
2358
+ * @example
2359
+ * Normalize a 32-bit word for host endianness.
2360
+ * ```ts
2361
+ * swap8IfBE(0x11223344);
2362
+ * ```
2363
+ */
2256
2364
  const swap8IfBE = isLE
2257
2365
  ? (n) => n
2258
- : (n) => byteSwap(n);
2259
- /** In place byte swap for Uint32Array */
2366
+ : (n) => byteSwap(n) >>> 0;
2367
+ /**
2368
+ * Byte-swaps every word of a Uint32Array in place.
2369
+ * @param arr - array to mutate
2370
+ * @returns The same array after mutation; callers pass live state arrays here.
2371
+ * @example
2372
+ * Reverse the byte order of every word in place.
2373
+ * ```ts
2374
+ * byteSwap32(new Uint32Array([0x11223344]));
2375
+ * ```
2376
+ */
2260
2377
  function byteSwap32(arr) {
2261
2378
  for (let i = 0; i < arr.length; i++) {
2262
2379
  arr[i] = byteSwap(arr[i]);
2263
2380
  }
2264
2381
  return arr;
2265
2382
  }
2383
+ /**
2384
+ * Conditionally byte-swaps a Uint32Array on big-endian platforms.
2385
+ * @param u - array to normalize for host endianness
2386
+ * @returns Original or byte-swapped array depending on platform endianness.
2387
+ * On big-endian runtimes this mutates `u` in place via `byteSwap32(...)`.
2388
+ * @example
2389
+ * Normalize a word array for host endianness.
2390
+ * ```ts
2391
+ * swap32IfBE(new Uint32Array([0x11223344]));
2392
+ * ```
2393
+ */
2266
2394
  const swap32IfBE = isLE
2267
2395
  ? (u) => u
2268
2396
  : byteSwap32;
2269
- /** Creates function with outputLen, blockLen, create properties from a class constructor. */
2397
+ /**
2398
+ * Creates a callable hash function from a stateful class constructor.
2399
+ * @param hashCons - hash constructor or factory
2400
+ * @param info - optional metadata such as DER OID
2401
+ * @returns Frozen callable hash wrapper with `.create()`.
2402
+ * Wrapper construction eagerly calls `hashCons(undefined)` once to read
2403
+ * `outputLen` / `blockLen`, so constructor side effects happen at module
2404
+ * init time.
2405
+ * @example
2406
+ * Wrap a stateful hash constructor into a callable helper.
2407
+ * ```ts
2408
+ * import { createHasher } from '@noble/hashes/utils.js';
2409
+ * import { sha256 } from '@noble/hashes/sha2.js';
2410
+ * const wrapped = createHasher(sha256.create, { oid: sha256.oid });
2411
+ * wrapped(new Uint8Array([1]));
2412
+ * ```
2413
+ */
2270
2414
  function createHasher(hashCons, info = {}) {
2271
- const hashC = (msg, opts) => hashCons(opts).update(msg).digest();
2415
+ const hashC = (msg, opts) => hashCons(opts)
2416
+ .update(msg)
2417
+ .digest();
2272
2418
  const tmp = hashCons(undefined);
2273
2419
  hashC.outputLen = tmp.outputLen;
2274
2420
  hashC.blockLen = tmp.blockLen;
2421
+ hashC.canXOF = tmp.canXOF;
2275
2422
  hashC.create = (opts) => hashCons(opts);
2276
2423
  Object.assign(hashC, info);
2277
2424
  return Object.freeze(hashC);
@@ -2282,8 +2429,10 @@ function createHasher(hashCons, info = {}) {
2282
2429
  * @module
2283
2430
  */
2284
2431
  /**
2285
- * Internal blake variable.
2286
- * For BLAKE2b, the two extra permutations for rounds 10 and 11 are SIGMA[10..11] = SIGMA[0..1].
2432
+ * Internal blake permutation table.
2433
+ * Rows `0..9` serve BLAKE2s, rows `0..11` serve BLAKE2b with `10..11 = 0..1`, and Blake1 also
2434
+ * reuses the later rows shown below. Blake1 expands rounds `10..15` as `SIGMA[i % 10]`, so rows
2435
+ * `10..15` intentionally repeat rows `0..5` for the 14-round (256) and 16-round (512) variants.
2287
2436
  */
2288
2437
  // prettier-ignore
2289
2438
  const BSIGMA = /* @__PURE__ */ Uint8Array.from([
@@ -2306,35 +2455,38 @@ const BSIGMA = /* @__PURE__ */ Uint8Array.from([
2306
2455
  2, 12, 6, 10, 0, 11, 8, 3, 4, 13, 7, 5, 15, 14, 1, 9,
2307
2456
  ]);
2308
2457
 
2309
- /**
2310
- * Internal helpers for u64. BigUint64Array is too slow as per 2025, so we implement it using Uint32Array.
2311
- * @todo re-check https://issues.chromium.org/issues/42212588
2312
- * @module
2313
- */
2314
2458
  const U32_MASK64 = /* @__PURE__ */ BigInt(2 ** 32 - 1);
2315
2459
  const _32n = /* @__PURE__ */ BigInt(32);
2460
+ // Split bigint into two 32-bit halves. With `le=true`, returned fields become `{ h: low, l: high
2461
+ // }` to match little-endian word order rather than the property names.
2316
2462
  function fromBig(n, le = false) {
2317
2463
  if (le)
2318
2464
  return { h: Number(n & U32_MASK64), l: Number((n >> _32n) & U32_MASK64) };
2319
2465
  return { h: Number((n >> _32n) & U32_MASK64) | 0, l: Number(n & U32_MASK64) | 0 };
2320
2466
  }
2321
- // Right rotate for Shift in [1, 32)
2467
+ // High 32-bit half of a 64-bit right rotate, valid for `s` in `1..31`.
2322
2468
  const rotrSH = (h, l, s) => (h >>> s) | (l << (32 - s));
2469
+ // Low 32-bit half of a 64-bit right rotate, valid for `s` in `1..31`.
2323
2470
  const rotrSL = (h, l, s) => (h << (32 - s)) | (l >>> s);
2324
- // Right rotate for Shift in (32, 64), NOTE: 32 is special case.
2471
+ // High 32-bit half of a 64-bit right rotate, valid for `s` in `33..63`; `32` uses `rotr32*`.
2325
2472
  const rotrBH = (h, l, s) => (h << (64 - s)) | (l >>> (s - 32));
2473
+ // Low 32-bit half of a 64-bit right rotate, valid for `s` in `33..63`; `32` uses `rotr32*`.
2326
2474
  const rotrBL = (h, l, s) => (h >>> (s - 32)) | (l << (64 - s));
2327
- // Right rotate for shift===32 (just swaps l&h)
2475
+ // High 32-bit half of a 64-bit right rotate for `s === 32`; this is just the swapped low half.
2328
2476
  const rotr32H = (_h, l) => l;
2477
+ // Low 32-bit half of a 64-bit right rotate for `s === 32`; this is just the swapped high half.
2329
2478
  const rotr32L = (h, _l) => h;
2330
- // JS uses 32-bit signed integers for bitwise operations which means we cannot
2331
- // simple take carry out of low bit sum by shift, we need to use division.
2479
+ // Add two split 64-bit words and return the split `{ h, l }` sum.
2480
+ // JS uses 32-bit signed integers for bitwise operations, so we cannot simply shift the carry out
2481
+ // of the low sum and instead use division.
2332
2482
  function add(Ah, Al, Bh, Bl) {
2333
2483
  const l = (Al >>> 0) + (Bl >>> 0);
2334
2484
  return { h: (Ah + Bh + ((l / 2 ** 32) | 0)) | 0, l: l | 0 };
2335
2485
  }
2336
2486
  // Addition with more than 2 elements
2487
+ // Unmasked low-word accumulator for 3-way addition; pass the raw result into `add3H(...)`.
2337
2488
  const add3L = (Al, Bl, Cl) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0);
2489
+ // High-word finalize step for 3-way addition; `low` must be the untruncated output of `add3L(...)`.
2338
2490
  const add3H = (low, Ah, Bh, Ch) => (Ah + Bh + Ch + ((low / 2 ** 32) | 0)) | 0;
2339
2491
 
2340
2492
  /**
@@ -2342,14 +2494,15 @@ const add3H = (low, Ah, Bh, Ch) => (Ah + Bh + Ch + ((low / 2 ** 32) | 0)) | 0;
2342
2494
  * b could have been faster, but there is no fast u64 in js, so s is 1.5x faster.
2343
2495
  * @module
2344
2496
  */
2345
- // Same as SHA512_IV, but swapped endianness: LE instead of BE. iv[1] is iv[0], etc.
2497
+ // Same IV words as `SHA512_IV`, but endian-swapped into LE u32 low/high halves
2498
+ // for the BLAKE2b u64 helpers below.
2346
2499
  const B2B_IV = /* @__PURE__ */ Uint32Array.from([
2347
2500
  0xf3bcc908, 0x6a09e667, 0x84caa73b, 0xbb67ae85, 0xfe94f82b, 0x3c6ef372, 0x5f1d36f1, 0xa54ff53a,
2348
2501
  0xade682d1, 0x510e527f, 0x2b3e6c1f, 0x9b05688c, 0xfb41bd6b, 0x1f83d9ab, 0x137e2179, 0x5be0cd19,
2349
2502
  ]);
2350
- // Temporary buffer
2503
+ // Shared synchronous BLAKE2b work vector as LE u32 low/high halves.
2351
2504
  const BBUF = /* @__PURE__ */ new Uint32Array(32);
2352
- // Mixing function G splitted in two halfs
2505
+ // BLAKE2b G mix split into two half-rounds over LE u32 low/high limbs.
2353
2506
  function G1b(a, b, c, d, msg, x) {
2354
2507
  // NOTE: V is LE here
2355
2508
  const Xl = msg[x], Xh = msg[x + 1]; // prettier-ignore
@@ -2374,6 +2527,7 @@ function G1b(a, b, c, d, msg, x) {
2374
2527
  ((BBUF[2 * c] = Cl), (BBUF[2 * c + 1] = Ch));
2375
2528
  ((BBUF[2 * d] = Dl), (BBUF[2 * d + 1] = Dh));
2376
2529
  }
2530
+ // Second half-round of the same LE-limb BLAKE2b G mix; `x` is the message word offset.
2377
2531
  function G2b(a, b, c, d, msg, x) {
2378
2532
  // NOTE: V is LE here
2379
2533
  const Xl = msg[x], Xh = msg[x + 1]; // prettier-ignore
@@ -2400,9 +2554,11 @@ function G2b(a, b, c, d, msg, x) {
2400
2554
  }
2401
2555
  function checkBlake2Opts(outputLen, opts = {}, keyLen, saltLen, persLen) {
2402
2556
  anumber(keyLen);
2403
- if (outputLen < 0 || outputLen > keyLen)
2557
+ // RFC 7693 §2.1 requires digest length nn in 1..keyLen.
2558
+ if (outputLen <= 0 || outputLen > keyLen)
2404
2559
  throw new Error('outputLen bigger than keyLen');
2405
2560
  const { key, salt, personalization } = opts;
2561
+ // This API uses `undefined` for the RFC 7693 `kk = 0` case, so a provided key must be non-empty.
2406
2562
  if (key !== undefined && (key.length < 1 || key.length > keyLen))
2407
2563
  throw new Error('"key" expected to be undefined or of length=1..' + keyLen);
2408
2564
  if (salt !== undefined)
@@ -2420,6 +2576,7 @@ class _BLAKE2 {
2420
2576
  pos = 0;
2421
2577
  blockLen;
2422
2578
  outputLen;
2579
+ canXOF = false;
2423
2580
  constructor(blockLen, outputLen) {
2424
2581
  anumber(blockLen);
2425
2582
  anumber(outputLen);
@@ -2449,7 +2606,7 @@ class _BLAKE2 {
2449
2606
  }
2450
2607
  const take = Math.min(blockLen - this.pos, len - pos);
2451
2608
  const dataOffset = offset + pos;
2452
- // full block && aligned to 4 bytes && not last in input
2609
+ // Zero-copy only for full, 4-byte-aligned, non-final blocks.
2453
2610
  if (take === blockLen && !(dataOffset % 4) && pos + take < len) {
2454
2611
  const data32 = new Uint32Array(buf, dataOffset, Math.floor((len - pos) / 4));
2455
2612
  swap32IfBE(data32);
@@ -2477,18 +2634,33 @@ class _BLAKE2 {
2477
2634
  swap32IfBE(buffer32);
2478
2635
  this.compress(buffer32, 0, true);
2479
2636
  swap32IfBE(buffer32);
2637
+ // Reject unaligned views explicitly instead of hiding them behind a full scratch copy.
2638
+ if (out.byteOffset & 3)
2639
+ throw new RangeError('"digestInto() output" expected 4-byte aligned byteOffset, got ' + out.byteOffset);
2640
+ const state = this.get();
2480
2641
  const out32 = u32(out);
2481
- this.get().forEach((v, i) => (out32[i] = swap8IfBE(v)));
2642
+ const full = Math.floor(this.outputLen / 4);
2643
+ for (let i = 0; i < full; i++)
2644
+ out32[i] = swap8IfBE(state[i]);
2645
+ const tail = this.outputLen % 4;
2646
+ if (!tail)
2647
+ return;
2648
+ const off = full * 4;
2649
+ const word = state[full];
2650
+ for (let i = 0; i < tail; i++)
2651
+ out[off + i] = word >>> (8 * i);
2482
2652
  }
2483
2653
  digest() {
2484
2654
  const { buffer, outputLen } = this;
2485
2655
  this.digestInto(buffer);
2656
+ // Return a copy so callers do not alias the instance scratch buffer used during finalization.
2486
2657
  const res = buffer.slice(0, outputLen);
2487
2658
  this.destroy();
2488
2659
  return res;
2489
2660
  }
2490
2661
  _cloneInto(to) {
2491
2662
  const { buffer, length, finished, destroyed, outputLen, pos } = this;
2663
+ // Recreate only `dkLen`; key/salt/personalization are already absorbed into the copied state.
2492
2664
  to ||= new this.constructor({ dkLen: outputLen });
2493
2665
  to.set(...this.get());
2494
2666
  to.buffer.set(buffer);
@@ -2504,9 +2676,9 @@ class _BLAKE2 {
2504
2676
  return this._cloneInto();
2505
2677
  }
2506
2678
  }
2507
- /** Internal blake2b hash class. */
2679
+ /** Internal blake2b hash class with state stored as LE u32 low/high halves. */
2508
2680
  class _BLAKE2b extends _BLAKE2 {
2509
- // Same as SHA-512, but LE
2681
+ // Same IV words as SHA-512 / BLAKE2b, encoded as LE u32 low/high halves.
2510
2682
  v0l = B2B_IV[0] | 0;
2511
2683
  v0h = B2B_IV[1] | 0;
2512
2684
  v1l = B2B_IV[2] | 0;
@@ -2533,6 +2705,8 @@ class _BLAKE2b extends _BLAKE2 {
2533
2705
  abytes(key, undefined, 'key');
2534
2706
  keyLength = key.length;
2535
2707
  }
2708
+ // RFC 7693 §2.5: xor `p[0] = 0x0101kknn` into the low 32 bits of `h[0]`;
2709
+ // the high 32 bits stay at `IV[0]`.
2536
2710
  this.v0l ^= this.outputLen | (keyLength << 8) | (0x01 << 16) | (0x01 << 24);
2537
2711
  if (salt !== undefined) {
2538
2712
  abytes(salt, undefined, 'salt');
@@ -2594,6 +2768,8 @@ class _BLAKE2b extends _BLAKE2 {
2594
2768
  }
2595
2769
  let j = 0;
2596
2770
  const s = BSIGMA;
2771
+ // SIGMA selects 64-bit message words; multiply by 2 because `msg` stores
2772
+ // each word as [low32, high32].
2597
2773
  for (let i = 0; i < 12; i++) {
2598
2774
  G1b(0, 4, 8, 12, msg, offset + 2 * s[j++]);
2599
2775
  G2b(0, 4, 8, 12, msg, offset + 2 * s[j++]);
@@ -2639,7 +2815,15 @@ class _BLAKE2b extends _BLAKE2 {
2639
2815
  /**
2640
2816
  * Blake2b hash function. 64-bit. 1.5x slower than blake2s in JS.
2641
2817
  * @param msg - message that would be hashed
2642
- * @param opts - dkLen output length, key for MAC mode, salt, personalization
2818
+ * @param opts - Optional output, MAC, salt, and personalization settings.
2819
+ * `dkLen` must be 1..64 bytes; `salt` and `personalization`, if present,
2820
+ * must be 16 bytes each. See {@link Blake2Opts}.
2821
+ * @returns Digest bytes.
2822
+ * @example
2823
+ * Hash a message with Blake2b.
2824
+ * ```ts
2825
+ * blake2b(new Uint8Array([97, 98, 99]));
2826
+ * ```
2643
2827
  */
2644
2828
  const blake2b = /* @__PURE__ */ createHasher((opts) => new _BLAKE2b(opts));
2645
2829
 
@@ -3431,8 +3615,8 @@ function validateSmartRollupAddress(value) {
3431
3615
 
3432
3616
  // IMPORTANT: THIS FILE IS AUTO GENERATED! DO NOT MANUALLY EDIT!
3433
3617
  const VERSION = {
3434
- "commitHash": "9647402fcc62c98bf3907a30214fea8871b30bea",
3435
- "version": "24.3.1-beta.1"
3618
+ "commitHash": "13f62cd47ea018312f100b660d0225604c757afa",
3619
+ "version": "25.0.0-rc.1"
3436
3620
  };
3437
3621
 
3438
3622
  const BLS12_381_DST = 'BLS_SIG_BLS12381G2_XMD:SHA-256_SSWU_RO_POP_';