cafe-utility 27.16.1 → 27.17.0

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.
Files changed (3) hide show
  1. package/index.d.ts +1 -0
  2. package/index.js +18 -18
  3. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -564,6 +564,7 @@ export declare class Uint8ArrayWriter {
564
564
  max(): number;
565
565
  }
566
566
  export declare class Chunk {
567
+ static hashFunction: (bytes: Uint8Array) => Uint8Array;
567
568
  span: bigint;
568
569
  writer: Uint8ArrayWriter;
569
570
  constructor(capacity: number, span?: bigint);
package/index.js CHANGED
@@ -219,7 +219,7 @@ function deleteDeep(n, e) {
219
219
  r = afterLast(e, '.')
220
220
  if (!t || !r) return
221
221
  const o = getDeep(n, t)
222
- delete o[r]
222
+ o && delete o[r]
223
223
  }
224
224
  function replaceDeep(n, e, t) {
225
225
  const r = getDeep(n, e)
@@ -2344,8 +2344,8 @@ function keccakPermutate(n) {
2344
2344
  L = (n[14] << 6) | (n[15] >>> 26),
2345
2345
  N = (n[15] << 6) | (n[14] >>> 26),
2346
2346
  j = (n[17] << 23) | (n[16] >>> 9),
2347
- z = (n[16] << 23) | (n[17] >>> 9),
2348
- F = (n[18] << 20) | (n[19] >>> 12),
2347
+ F = (n[16] << 23) | (n[17] >>> 9),
2348
+ z = (n[18] << 20) | (n[19] >>> 12),
2349
2349
  W = (n[19] << 20) | (n[18] >>> 12),
2350
2350
  q = (n[20] << 3) | (n[21] >>> 29),
2351
2351
  H = (n[21] << 3) | (n[20] >>> 29),
@@ -2355,8 +2355,8 @@ function keccakPermutate(n) {
2355
2355
  Z = (n[24] << 11) | (n[25] >>> 21),
2356
2356
  Q = (n[26] << 25) | (n[27] >>> 7),
2357
2357
  G = (n[27] << 25) | (n[26] >>> 7),
2358
- _ = (n[29] << 7) | (n[28] >>> 25),
2359
- Y = (n[28] << 7) | (n[29] >>> 25),
2358
+ Y = (n[29] << 7) | (n[28] >>> 25),
2359
+ _ = (n[28] << 7) | (n[29] >>> 25),
2360
2360
  X = (n[31] << 9) | (n[30] >>> 23),
2361
2361
  nn = (n[30] << 9) | (n[31] >>> 23),
2362
2362
  en = (n[33] << 13) | (n[32] >>> 19),
@@ -2387,15 +2387,15 @@ function keccakPermutate(n) {
2387
2387
  (n[7] = cn ^ (~xn & M)),
2388
2388
  (n[8] = yn ^ (~E & v)),
2389
2389
  (n[9] = xn ^ (~M & U)),
2390
- (n[10] = R ^ (~F & q)),
2390
+ (n[10] = R ^ (~z & q)),
2391
2391
  (n[11] = D ^ (~W & H)),
2392
- (n[12] = F ^ (~q & en)),
2392
+ (n[12] = z ^ (~q & en)),
2393
2393
  (n[13] = W ^ (~H & tn)),
2394
2394
  (n[14] = q ^ (~en & pn)),
2395
2395
  (n[15] = H ^ (~tn & mn)),
2396
2396
  (n[16] = en ^ (~pn & R)),
2397
2397
  (n[17] = tn ^ (~mn & D)),
2398
- (n[18] = pn ^ (~R & F)),
2398
+ (n[18] = pn ^ (~R & z)),
2399
2399
  (n[19] = mn ^ (~D & W)),
2400
2400
  (n[20] = O ^ (~L & Q)),
2401
2401
  (n[21] = k ^ (~N & G)),
@@ -2417,16 +2417,16 @@ function keccakPermutate(n) {
2417
2417
  (n[37] = on ^ (~wn & C)),
2418
2418
  (n[38] = gn ^ (~I & B)),
2419
2419
  (n[39] = wn ^ (~C & P)),
2420
- (n[40] = T ^ (~j & _)),
2421
- (n[41] = S ^ (~z & Y)),
2422
- (n[42] = j ^ (~_ & X)),
2423
- (n[43] = z ^ (~Y & nn)),
2424
- (n[44] = _ ^ (~X & hn)),
2425
- (n[45] = Y ^ (~nn & dn)),
2420
+ (n[40] = T ^ (~j & Y)),
2421
+ (n[41] = S ^ (~F & _)),
2422
+ (n[42] = j ^ (~Y & X)),
2423
+ (n[43] = F ^ (~_ & nn)),
2424
+ (n[44] = Y ^ (~X & hn)),
2425
+ (n[45] = _ ^ (~nn & dn)),
2426
2426
  (n[46] = X ^ (~hn & T)),
2427
2427
  (n[47] = nn ^ (~dn & S)),
2428
2428
  (n[48] = hn ^ (~T & j)),
2429
- (n[49] = dn ^ (~S & z)),
2429
+ (n[49] = dn ^ (~S & F)),
2430
2430
  (n[0] ^= IOTA_CONSTANTS[e * 2]),
2431
2431
  (n[1] ^= IOTA_CONSTANTS[e * 2 + 1])
2432
2432
  }
@@ -2720,11 +2720,11 @@ class Chunk {
2720
2720
  return concatBytes(numberToUint64(this.span, 'LE'), this.writer.buffer)
2721
2721
  }
2722
2722
  hash() {
2723
- const e = log2Reduce(partition(this.writer.buffer, 32), (t, r) => keccak256(concatBytes(t, r)))
2724
- return keccak256(concatBytes(numberToUint64(this.span, 'LE'), e))
2723
+ const e = log2Reduce(partition(this.writer.buffer, 32), (t, r) => Chunk.hashFunction(concatBytes(t, r)))
2724
+ return Chunk.hashFunction(concatBytes(numberToUint64(this.span, 'LE'), e))
2725
2725
  }
2726
2726
  }
2727
- exports.Chunk = Chunk
2727
+ ;(exports.Chunk = Chunk), (Chunk.hashFunction = keccak256)
2728
2728
  class MerkleTree {
2729
2729
  constructor(e, t = 4096) {
2730
2730
  ;(this.counters = [1]), (this.capacity = t), (this.chunks = [new Chunk(t)]), (this.onChunk = e)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cafe-utility",
3
- "version": "27.16.1",
3
+ "version": "27.17.0",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "exports": {