cafe-utility 26.1.0 → 26.1.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.
- package/index.d.ts +2 -3
- package/index.js +23 -26
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -524,12 +524,11 @@ declare class Uint8ArrayWriter implements Uint8ArrayIO {
|
|
|
524
524
|
declare class Chunk {
|
|
525
525
|
span: bigint;
|
|
526
526
|
writer: Uint8ArrayWriter;
|
|
527
|
-
|
|
528
|
-
constructor(capacity: number, hashFn: (a: Uint8Array, b: Uint8Array) => Uint8Array, span?: bigint);
|
|
527
|
+
constructor(capacity: number, span?: bigint);
|
|
529
528
|
build(): Uint8Array;
|
|
530
529
|
hash(): Uint8Array;
|
|
531
530
|
}
|
|
532
|
-
declare function merkleStart(capacity: number
|
|
531
|
+
declare function merkleStart(capacity: number): Chunk[];
|
|
533
532
|
declare function merkleAppend(levels: Chunk[], data: Uint8Array, onChunk: (chunk: Chunk) => Promise<void>, level?: number): Promise<Chunk[]>;
|
|
534
533
|
declare function merkleFinalize(levels: Chunk[], onChunk: (chunk: Chunk) => Promise<void>, level?: number): Promise<Chunk>;
|
|
535
534
|
type Playbook<T> = {
|
package/index.js
CHANGED
|
@@ -2146,9 +2146,9 @@ function keccakPermutate(n) {
|
|
|
2146
2146
|
x = u ^ En,
|
|
2147
2147
|
b = s ^ Tn,
|
|
2148
2148
|
kn = (t << 1) | (r >>> 31),
|
|
2149
|
-
|
|
2149
|
+
Dn = (r << 1) | (t >>> 31),
|
|
2150
2150
|
$ = c ^ kn,
|
|
2151
|
-
A = f ^
|
|
2151
|
+
A = f ^ Dn
|
|
2152
2152
|
;(n[0] ^= p),
|
|
2153
2153
|
(n[1] ^= d),
|
|
2154
2154
|
(n[2] ^= m),
|
|
@@ -2204,9 +2204,9 @@ function keccakPermutate(n) {
|
|
|
2204
2204
|
E = (n[2] << 1) | (n[3] >>> 31),
|
|
2205
2205
|
T = (n[3] << 1) | (n[2] >>> 31),
|
|
2206
2206
|
k = (n[5] << 30) | (n[4] >>> 2),
|
|
2207
|
-
|
|
2208
|
-
|
|
2209
|
-
|
|
2207
|
+
D = (n[4] << 30) | (n[5] >>> 2),
|
|
2208
|
+
R = (n[6] << 28) | (n[7] >>> 4),
|
|
2209
|
+
S = (n[7] << 28) | (n[6] >>> 4),
|
|
2210
2210
|
C = (n[8] << 27) | (n[9] >>> 5),
|
|
2211
2211
|
I = (n[9] << 27) | (n[8] >>> 5),
|
|
2212
2212
|
L = (n[11] << 4) | (n[10] >>> 28),
|
|
@@ -2259,16 +2259,16 @@ function keccakPermutate(n) {
|
|
|
2259
2259
|
(n[7] = cn ^ (~xn & O)),
|
|
2260
2260
|
(n[8] = yn ^ (~M & B)),
|
|
2261
2261
|
(n[9] = xn ^ (~O & N)),
|
|
2262
|
-
(n[10] =
|
|
2263
|
-
(n[11] =
|
|
2262
|
+
(n[10] = R ^ (~W & H)),
|
|
2263
|
+
(n[11] = S ^ (~q & V)),
|
|
2264
2264
|
(n[12] = W ^ (~H & en)),
|
|
2265
2265
|
(n[13] = q ^ (~V & tn)),
|
|
2266
2266
|
(n[14] = H ^ (~en & dn)),
|
|
2267
2267
|
(n[15] = V ^ (~tn & mn)),
|
|
2268
|
-
(n[16] = en ^ (~dn &
|
|
2269
|
-
(n[17] = tn ^ (~mn &
|
|
2270
|
-
(n[18] = dn ^ (~
|
|
2271
|
-
(n[19] = mn ^ (~
|
|
2268
|
+
(n[16] = en ^ (~dn & R)),
|
|
2269
|
+
(n[17] = tn ^ (~mn & S)),
|
|
2270
|
+
(n[18] = dn ^ (~R & W)),
|
|
2271
|
+
(n[19] = mn ^ (~S & q)),
|
|
2272
2272
|
(n[20] = E ^ (~j & _)),
|
|
2273
2273
|
(n[21] = T ^ (~U & Q)),
|
|
2274
2274
|
(n[22] = j ^ (~_ & sn)),
|
|
@@ -2290,15 +2290,15 @@ function keccakPermutate(n) {
|
|
|
2290
2290
|
(n[38] = gn ^ (~C & L)),
|
|
2291
2291
|
(n[39] = wn ^ (~I & P)),
|
|
2292
2292
|
(n[40] = k ^ (~F & G)),
|
|
2293
|
-
(n[41] =
|
|
2293
|
+
(n[41] = D ^ (~z & Y)),
|
|
2294
2294
|
(n[42] = F ^ (~G & X)),
|
|
2295
2295
|
(n[43] = z ^ (~Y & nn)),
|
|
2296
2296
|
(n[44] = G ^ (~X & hn)),
|
|
2297
2297
|
(n[45] = Y ^ (~nn & pn)),
|
|
2298
2298
|
(n[46] = X ^ (~hn & k)),
|
|
2299
|
-
(n[47] = nn ^ (~pn &
|
|
2299
|
+
(n[47] = nn ^ (~pn & D)),
|
|
2300
2300
|
(n[48] = hn ^ (~k & F)),
|
|
2301
|
-
(n[49] = pn ^ (~
|
|
2301
|
+
(n[49] = pn ^ (~D & z)),
|
|
2302
2302
|
(n[0] ^= IOTA_CONSTANTS[e * 2]),
|
|
2303
2303
|
(n[1] ^= IOTA_CONSTANTS[e * 2 + 1])
|
|
2304
2304
|
}
|
|
@@ -2399,25 +2399,25 @@ class Uint8ArrayWriter {
|
|
|
2399
2399
|
}
|
|
2400
2400
|
}
|
|
2401
2401
|
class Chunk {
|
|
2402
|
-
constructor(e, t
|
|
2403
|
-
;(this.span =
|
|
2402
|
+
constructor(e, t = 0n) {
|
|
2403
|
+
;(this.span = t), (this.writer = new Uint8ArrayWriter(new Uint8Array(e)))
|
|
2404
2404
|
}
|
|
2405
2405
|
build() {
|
|
2406
2406
|
return concatBytes(numberToUint64(this.span, 'LE'), this.writer.buffer)
|
|
2407
2407
|
}
|
|
2408
2408
|
hash() {
|
|
2409
|
-
const e = log2Reduce(partition(this.writer.buffer, 32),
|
|
2410
|
-
return
|
|
2409
|
+
const e = log2Reduce(partition(this.writer.buffer, 32), keccak256)
|
|
2410
|
+
return keccak256(concatBytes(numberToUint64(this.span, 'LE'), e))
|
|
2411
2411
|
}
|
|
2412
2412
|
}
|
|
2413
|
-
function merkleStart(n
|
|
2414
|
-
return [new Chunk(n
|
|
2413
|
+
function merkleStart(n) {
|
|
2414
|
+
return [new Chunk(n)]
|
|
2415
2415
|
}
|
|
2416
2416
|
async function merkleElevate(n, e, t) {
|
|
2417
2417
|
await e(n[t]),
|
|
2418
|
-
n[t + 1] || n.push(new Chunk(n[t].writer.buffer.length, n[t].
|
|
2418
|
+
n[t + 1] || n.push(new Chunk(n[t].writer.buffer.length, n[t].span)),
|
|
2419
2419
|
merkleAppend(n, n[t].hash(), e, t + 1),
|
|
2420
|
-
(n[t] = new Chunk(n[t].writer.buffer.length
|
|
2420
|
+
(n[t] = new Chunk(n[t].writer.buffer.length))
|
|
2421
2421
|
}
|
|
2422
2422
|
async function merkleAppend(n, e, t, r = 0) {
|
|
2423
2423
|
n[r].writer.max() === 0 && (await merkleElevate(n, t, r))
|
|
@@ -3047,7 +3047,4 @@ class AsyncQueue {
|
|
|
3047
3047
|
raycast,
|
|
3048
3048
|
raycastCircle,
|
|
3049
3049
|
getLineIntersectionPoint
|
|
3050
|
-
})
|
|
3051
|
-
console.log(exports.Strings.randomAlphanumeric(135)),
|
|
3052
|
-
console.log(exports.Strings.randomAlphanumeric(136)),
|
|
3053
|
-
console.log(exports.Strings.randomAlphanumeric(137))
|
|
3050
|
+
})
|