cafe-utility 36.1.5 → 36.1.7

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 (2) hide show
  1. package/index.js +16 -13
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -2136,18 +2136,18 @@ function keccakPermutate(n) {
2136
2136
  g = e ^ w,
2137
2137
  y = r ^ x,
2138
2138
  En = (u << 1) | (f >>> 31),
2139
- Mn = (f << 1) | (u >>> 31),
2139
+ Sn = (f << 1) | (u >>> 31),
2140
2140
  b = i ^ En,
2141
- A = o ^ Mn,
2142
- Sn = (l << 1) | (a >>> 31),
2141
+ A = o ^ Sn,
2142
+ Mn = (l << 1) | (a >>> 31),
2143
2143
  kn = (a << 1) | (l >>> 31),
2144
- $ = s ^ Sn,
2144
+ $ = s ^ Mn,
2145
2145
  E = c ^ kn,
2146
2146
  On = (e << 1) | (r >>> 31),
2147
2147
  Tn = (r << 1) | (e >>> 31),
2148
- M = u ^ On,
2149
- S = f ^ Tn
2150
- ;(n[0] ^= d), (n[1] ^= m), (n[2] ^= g), (n[3] ^= y), (n[4] ^= b), (n[5] ^= A), (n[6] ^= $), (n[7] ^= E), (n[8] ^= M), (n[9] ^= S), (n[10] ^= d), (n[11] ^= m), (n[12] ^= g), (n[13] ^= y), (n[14] ^= b), (n[15] ^= A), (n[16] ^= $), (n[17] ^= E), (n[18] ^= M), (n[19] ^= S), (n[20] ^= d), (n[21] ^= m), (n[22] ^= g), (n[23] ^= y), (n[24] ^= b), (n[25] ^= A), (n[26] ^= $), (n[27] ^= E), (n[28] ^= M), (n[29] ^= S), (n[30] ^= d), (n[31] ^= m), (n[32] ^= g), (n[33] ^= y), (n[34] ^= b), (n[35] ^= A), (n[36] ^= $), (n[37] ^= E), (n[38] ^= M), (n[39] ^= S), (n[40] ^= d), (n[41] ^= m), (n[42] ^= g), (n[43] ^= y), (n[44] ^= b), (n[45] ^= A), (n[46] ^= $), (n[47] ^= E), (n[48] ^= M), (n[49] ^= S)
2148
+ S = u ^ On,
2149
+ M = f ^ Tn
2150
+ ;(n[0] ^= d), (n[1] ^= m), (n[2] ^= g), (n[3] ^= y), (n[4] ^= b), (n[5] ^= A), (n[6] ^= $), (n[7] ^= E), (n[8] ^= S), (n[9] ^= M), (n[10] ^= d), (n[11] ^= m), (n[12] ^= g), (n[13] ^= y), (n[14] ^= b), (n[15] ^= A), (n[16] ^= $), (n[17] ^= E), (n[18] ^= S), (n[19] ^= M), (n[20] ^= d), (n[21] ^= m), (n[22] ^= g), (n[23] ^= y), (n[24] ^= b), (n[25] ^= A), (n[26] ^= $), (n[27] ^= E), (n[28] ^= S), (n[29] ^= M), (n[30] ^= d), (n[31] ^= m), (n[32] ^= g), (n[33] ^= y), (n[34] ^= b), (n[35] ^= A), (n[36] ^= $), (n[37] ^= E), (n[38] ^= S), (n[39] ^= M), (n[40] ^= d), (n[41] ^= m), (n[42] ^= g), (n[43] ^= y), (n[44] ^= b), (n[45] ^= A), (n[46] ^= $), (n[47] ^= E), (n[48] ^= S), (n[49] ^= M)
2151
2151
  const k = n[0],
2152
2152
  O = n[1],
2153
2153
  T = (n[2] << 1) | (n[3] >>> 31),
@@ -2659,11 +2659,13 @@ class ChunkSplitter {
2659
2659
  }
2660
2660
  }
2661
2661
  async elevate(t) {
2662
- if (((this.counters[t] = ++this.counters[t] % (4096 / this.refSize)), this.pending[t] || (this.pending[t] = []), await this.sealParities(t), t >= 1 && this.onIntermediateChunk && (this.onIntermediateChunk(this.chunks[t], this.hasParity[t] ?? !1), (this.hasParity[t] = !1)), this.encrypted)) {
2663
- const { address: e, key: r } = this.chunks[t].encryptedHash(),
2664
- i = new Uint8Array(64)
2665
- i.set(e), i.set(r, 32), this.pending[t].push({ entry: { chunk: this.chunks[t], key: r }, ref: i, span: this.chunks[t].span })
2666
- } else this.pending[t].push({ entry: { chunk: this.chunks[t] }, ref: this.chunks[t].hash(), span: this.chunks[t].span })
2662
+ ;(this.counters[t] = ++this.counters[t] % (4096 / this.refSize)), this.pending[t] || (this.pending[t] = []), await this.sealParities(t)
2663
+ const e = this.chunks[t].span
2664
+ if ((t >= 1 && this.onIntermediateChunk && (this.onIntermediateChunk(this.chunks[t], this.hasParity[t] ?? !1), (this.hasParity[t] = !1)), this.encrypted)) {
2665
+ const { address: r, key: i } = this.chunks[t].encryptedHash(),
2666
+ o = new Uint8Array(64)
2667
+ o.set(r), o.set(i, 32), this.pending[t].push({ entry: { chunk: this.chunks[t], key: i }, ref: o, span: e })
2668
+ } else this.pending[t].push({ entry: { chunk: this.chunks[t] }, ref: this.chunks[t].hash(), span: e })
2667
2669
  ;(this.chunks[t] = new Chunk()), this.pending[t].length >= this.maxShards && (await this.flushBatch(t))
2668
2670
  }
2669
2671
  async sealParities(t) {
@@ -2679,8 +2681,9 @@ class ChunkSplitter {
2679
2681
  async flushBatch(t) {
2680
2682
  this.chunks[t + 1] || (this.chunks.push(new Chunk()), this.counters.push(1), this.pending.push([]), this.hasParity.push(!1))
2681
2683
  const e = this.pending[t]
2682
- ;(this.pending[t] = []), this.pendingEntries[t + 1] || (this.pendingEntries[t + 1] = []), this.pendingEntries[t + 1].push(...e.map(r => r.entry))
2684
+ this.pending[t] = []
2683
2685
  for (const { ref: r, span: i } of e) await this.append(r, t + 1, i)
2686
+ this.pendingEntries[t + 1] || (this.pendingEntries[t + 1] = []), this.pendingEntries[t + 1].push(...e.map(r => r.entry)), e.length >= this.maxShards && (await this.sealParities(t + 1))
2684
2687
  }
2685
2688
  async finalize(t = 0) {
2686
2689
  return this.pending[t]?.length && (await this.flushBatch(t)), this.chunks[t + 1] ? (this.counters[t] === 1 ? (await this.elevate(t + 1), await this.flushBatch(t + 1), (this.chunks[t + 1] = this.chunks[t]), this.finalize(t + 1)) : (await this.elevate(t), await this.flushBatch(t), this.finalize(t + 1))) : (await this.sealParities(t), t >= 1 && this.onIntermediateChunk && this.onIntermediateChunk(this.chunks[t], this.hasParity[t] ?? !1), this.chunks[t])
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cafe-utility",
3
- "version": "36.1.5",
3
+ "version": "36.1.7",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "exports": {