@hinkal/common 0.0.81 → 0.0.82
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/assets/{snarkjsWorkerLauncher-BA0mEPPz.js → snarkjsWorkerLauncher-CaBCnle3.js} +102 -103
- package/assets/{snarkjsWorkerLogic-ekHpzAIW.js → snarkjsWorkerLogic-24nhppHI.js} +649 -644
- package/assets/{snarkjsWorkerLogic-L1vb0HFc.js → snarkjsWorkerLogic-BAbiO5gj.js} +897 -892
- package/assets/{utxoWorkerLogic-DrdOALJd.js → utxoWorkerLogic-DbwOF7_Q.js} +2 -2
- package/assets/{viteWorkerURL.constant-BnLC1_CH.js → viteWorkerURL.constant-D0iPNhG0.js} +3 -3
- package/assets/{zkProofWorkerLauncher-DbapdIeT.js → zkProofWorkerLauncher-ByXYyy7C.js} +1 -1
- package/assets/{zkProofWorkerLogic-DdXwxKze.js → zkProofWorkerLogic-C3y0gDgU.js} +4 -4
- package/{index-DdDIk6Jw.mjs → index-DhAeLLFR.mjs} +7494 -7508
- package/index.mjs +1 -1
- package/package.json +1 -1
- package/{snarkjsWorkerLogic-DI9paiU-.mjs → snarkjsWorkerLogic-De3osVcO.mjs} +648 -643
- package/{utxoWorkerLogic-CNa05j64.mjs → utxoWorkerLogic-fmNmJnfl.mjs} +1 -1
- package/{viteWorkerURL.constant-BnlGBO_0.mjs → viteWorkerURL.constant-Dxy-B-5E.mjs} +2 -2
- package/{zkProofWorkerLogic-O2AAP0BX.mjs → zkProofWorkerLogic-REfZ8M6M.mjs} +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { f as on, r as
|
|
2
|
-
import { c as Ye } from "./zkProofWorkerLauncher-
|
|
3
|
-
const
|
|
1
|
+
import { f as on, r as vn, e as Ua, u as zn, a as _o } from "./zkProofWorkerLogic-C3y0gDgU.js";
|
|
2
|
+
import { c as Ye } from "./zkProofWorkerLauncher-ByXYyy7C.js";
|
|
3
|
+
const go = [0, 1, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4];
|
|
4
4
|
function cn(c, t) {
|
|
5
5
|
if (!t || t == 10)
|
|
6
6
|
return BigInt(c);
|
|
@@ -8,34 +8,34 @@ function cn(c, t) {
|
|
|
8
8
|
return c.slice(0, 2) == "0x" ? BigInt(c) : BigInt("0x" + c);
|
|
9
9
|
}
|
|
10
10
|
const Be = cn;
|
|
11
|
-
function
|
|
11
|
+
function po(c, t) {
|
|
12
12
|
let e = BigInt(0);
|
|
13
13
|
t = BigInt(t);
|
|
14
14
|
for (let n = 0; n < c.length; n++)
|
|
15
15
|
e = e * t + BigInt(c[n]);
|
|
16
16
|
return e;
|
|
17
17
|
}
|
|
18
|
-
function
|
|
18
|
+
function ja(c) {
|
|
19
19
|
const t = c.toString(16);
|
|
20
|
-
return (t.length - 1) * 4 +
|
|
20
|
+
return (t.length - 1) * 4 + go[parseInt(t[0], 16)];
|
|
21
21
|
}
|
|
22
|
-
function
|
|
22
|
+
function ho(c) {
|
|
23
23
|
return BigInt(c) < BigInt(0);
|
|
24
24
|
}
|
|
25
|
-
function
|
|
25
|
+
function Lo(c) {
|
|
26
26
|
return !c;
|
|
27
27
|
}
|
|
28
|
-
function
|
|
28
|
+
function $a(c, t) {
|
|
29
29
|
return BigInt(c) << BigInt(t);
|
|
30
30
|
}
|
|
31
|
-
function
|
|
31
|
+
function Un(c, t) {
|
|
32
32
|
return BigInt(c) >> BigInt(t);
|
|
33
33
|
}
|
|
34
|
-
const
|
|
35
|
-
function
|
|
34
|
+
const mo = $a, bo = Un;
|
|
35
|
+
function yo(c) {
|
|
36
36
|
return (BigInt(c) & BigInt(1)) == BigInt(1);
|
|
37
37
|
}
|
|
38
|
-
function
|
|
38
|
+
function Co(c) {
|
|
39
39
|
let t = BigInt(c);
|
|
40
40
|
const e = [];
|
|
41
41
|
for (; t; ) {
|
|
@@ -48,177 +48,177 @@ function yo(c) {
|
|
|
48
48
|
}
|
|
49
49
|
return e;
|
|
50
50
|
}
|
|
51
|
-
function
|
|
51
|
+
function Ao(c) {
|
|
52
52
|
let t = BigInt(c);
|
|
53
53
|
const e = [];
|
|
54
54
|
for (; t; )
|
|
55
55
|
t & BigInt(1) ? e.push(1) : e.push(0), t = t >> BigInt(1);
|
|
56
56
|
return e;
|
|
57
57
|
}
|
|
58
|
-
function
|
|
58
|
+
function Ga(c) {
|
|
59
59
|
if (c > BigInt(Number.MAX_SAFE_INTEGER))
|
|
60
60
|
throw new Error("Number too big");
|
|
61
61
|
return Number(c);
|
|
62
62
|
}
|
|
63
|
-
function
|
|
63
|
+
function Fo(c, t) {
|
|
64
64
|
const e = [];
|
|
65
65
|
let n = BigInt(c);
|
|
66
66
|
for (t = BigInt(t); n; )
|
|
67
67
|
e.unshift(Number(n % t)), n = n / t;
|
|
68
68
|
return e;
|
|
69
69
|
}
|
|
70
|
-
function
|
|
70
|
+
function Eo(c, t) {
|
|
71
71
|
return BigInt(c) + BigInt(t);
|
|
72
72
|
}
|
|
73
|
-
function
|
|
73
|
+
function wo(c, t) {
|
|
74
74
|
return BigInt(c) - BigInt(t);
|
|
75
75
|
}
|
|
76
|
-
function
|
|
76
|
+
function Bo(c) {
|
|
77
77
|
return -BigInt(c);
|
|
78
78
|
}
|
|
79
|
-
function
|
|
79
|
+
function vo(c, t) {
|
|
80
80
|
return BigInt(c) * BigInt(t);
|
|
81
81
|
}
|
|
82
|
-
function
|
|
82
|
+
function xo(c) {
|
|
83
83
|
return BigInt(c) * BigInt(c);
|
|
84
84
|
}
|
|
85
|
-
function
|
|
85
|
+
function So(c, t) {
|
|
86
86
|
return BigInt(c) ** BigInt(t);
|
|
87
87
|
}
|
|
88
|
-
function
|
|
88
|
+
function Io(c, t) {
|
|
89
89
|
return BigInt(c) ** BigInt(t);
|
|
90
90
|
}
|
|
91
|
-
function
|
|
91
|
+
function Oo(c) {
|
|
92
92
|
return BigInt(c) >= 0 ? BigInt(c) : -BigInt(c);
|
|
93
93
|
}
|
|
94
|
-
function
|
|
94
|
+
function Po(c, t) {
|
|
95
95
|
return BigInt(c) / BigInt(t);
|
|
96
96
|
}
|
|
97
|
-
function
|
|
97
|
+
function ko(c, t) {
|
|
98
98
|
return BigInt(c) % BigInt(t);
|
|
99
99
|
}
|
|
100
|
-
function
|
|
100
|
+
function To(c, t) {
|
|
101
101
|
return BigInt(c) == BigInt(t);
|
|
102
102
|
}
|
|
103
|
-
function
|
|
103
|
+
function qo(c, t) {
|
|
104
104
|
return BigInt(c) != BigInt(t);
|
|
105
105
|
}
|
|
106
|
-
function
|
|
106
|
+
function Do(c, t) {
|
|
107
107
|
return BigInt(c) < BigInt(t);
|
|
108
108
|
}
|
|
109
|
-
function
|
|
109
|
+
function Mo(c, t) {
|
|
110
110
|
return BigInt(c) > BigInt(t);
|
|
111
111
|
}
|
|
112
|
-
function
|
|
112
|
+
function Ro(c, t) {
|
|
113
113
|
return BigInt(c) <= BigInt(t);
|
|
114
114
|
}
|
|
115
|
-
function
|
|
115
|
+
function No(c, t) {
|
|
116
116
|
return BigInt(c) >= BigInt(t);
|
|
117
117
|
}
|
|
118
|
-
function
|
|
118
|
+
function Za(c, t) {
|
|
119
119
|
return BigInt(c) & BigInt(t);
|
|
120
120
|
}
|
|
121
|
-
function
|
|
121
|
+
function zo(c, t) {
|
|
122
122
|
return BigInt(c) | BigInt(t);
|
|
123
123
|
}
|
|
124
|
-
function
|
|
124
|
+
function Uo(c, t) {
|
|
125
125
|
return BigInt(c) ^ BigInt(t);
|
|
126
126
|
}
|
|
127
|
-
function
|
|
127
|
+
function jo(c, t) {
|
|
128
128
|
return BigInt(c) && BigInt(t);
|
|
129
129
|
}
|
|
130
|
-
function
|
|
130
|
+
function $o(c, t) {
|
|
131
131
|
return BigInt(c) || BigInt(t);
|
|
132
132
|
}
|
|
133
|
-
function
|
|
133
|
+
function Go(c) {
|
|
134
134
|
return !BigInt(c);
|
|
135
135
|
}
|
|
136
|
-
function
|
|
136
|
+
function Wa(c, t, e, n) {
|
|
137
137
|
const a = "0000000" + e.toString(16), s = new Uint32Array(c.buffer, c.byteOffset + t, n / 4), g = ((a.length - 7) * 4 - 1 >> 5) + 1;
|
|
138
138
|
for (let d = 0; d < g; d++)
|
|
139
139
|
s[d] = parseInt(a.substring(a.length - 8 * d - 8, a.length - 8 * d), 16);
|
|
140
140
|
for (let d = g; d < s.length; d++)
|
|
141
141
|
s[d] = 0;
|
|
142
142
|
for (let d = s.length * 4; d < n; d++)
|
|
143
|
-
c[d] =
|
|
143
|
+
c[d] = Ga(Za(Un(e, d * 8), 255));
|
|
144
144
|
}
|
|
145
|
-
function
|
|
145
|
+
function Zo(c, t, e, n) {
|
|
146
146
|
const a = "0000000" + e.toString(16), s = new DataView(c.buffer, c.byteOffset + t, n), g = ((a.length - 7) * 4 - 1 >> 5) + 1;
|
|
147
147
|
for (let d = 0; d < g; d++)
|
|
148
148
|
s.setUint32(n - d * 4 - 4, parseInt(a.substring(a.length - 8 * d - 8, a.length - 8 * d), 16), !1);
|
|
149
149
|
for (let d = 0; d < n / 4 - g; d++)
|
|
150
150
|
s[d] = 0;
|
|
151
151
|
}
|
|
152
|
-
function
|
|
152
|
+
function Wo(c, t, e) {
|
|
153
153
|
e = e || c.byteLength, t = t || 0;
|
|
154
154
|
const n = new Uint32Array(c.buffer, c.byteOffset + t, e / 4), a = new Array(e / 4);
|
|
155
155
|
return n.forEach((s, g) => a[a.length - g - 1] = s.toString(16).padStart(8, "0")), cn(a.join(""), 16);
|
|
156
156
|
}
|
|
157
|
-
function
|
|
157
|
+
function Xo(c, t, e) {
|
|
158
158
|
e = e || c.byteLength, t = t || 0;
|
|
159
159
|
const n = new DataView(c.buffer, c.byteOffset + t, e), a = new Array(e / 4);
|
|
160
160
|
for (let s = 0; s < e / 4; s++)
|
|
161
161
|
a[s] = n.getUint32(s * 4, !1).toString(16).padStart(8, "0");
|
|
162
162
|
return cn(a.join(""), 16);
|
|
163
163
|
}
|
|
164
|
-
function
|
|
164
|
+
function Vo(c, t) {
|
|
165
165
|
return c.toString(t);
|
|
166
166
|
}
|
|
167
|
-
function
|
|
168
|
-
const t = new Uint8Array(Math.floor((
|
|
169
|
-
return
|
|
167
|
+
function Ho(c) {
|
|
168
|
+
const t = new Uint8Array(Math.floor((ja(c) - 1) / 8) + 1);
|
|
169
|
+
return Wa(t, 0, c, t.byteLength), t;
|
|
170
170
|
}
|
|
171
|
-
const
|
|
172
|
-
var
|
|
171
|
+
const Qo = Be(0), Jo = Be(1);
|
|
172
|
+
var Ko = /* @__PURE__ */ Object.freeze({
|
|
173
173
|
__proto__: null,
|
|
174
|
-
abs:
|
|
175
|
-
add:
|
|
176
|
-
band:
|
|
177
|
-
bitLength:
|
|
178
|
-
bits:
|
|
179
|
-
bor:
|
|
180
|
-
bxor:
|
|
181
|
-
div:
|
|
174
|
+
abs: Oo,
|
|
175
|
+
add: Eo,
|
|
176
|
+
band: Za,
|
|
177
|
+
bitLength: ja,
|
|
178
|
+
bits: Ao,
|
|
179
|
+
bor: zo,
|
|
180
|
+
bxor: Uo,
|
|
181
|
+
div: Po,
|
|
182
182
|
e: Be,
|
|
183
|
-
eq:
|
|
184
|
-
exp:
|
|
185
|
-
fromArray:
|
|
186
|
-
fromRprBE:
|
|
187
|
-
fromRprLE:
|
|
183
|
+
eq: To,
|
|
184
|
+
exp: Io,
|
|
185
|
+
fromArray: po,
|
|
186
|
+
fromRprBE: Xo,
|
|
187
|
+
fromRprLE: Wo,
|
|
188
188
|
fromString: cn,
|
|
189
|
-
geq:
|
|
190
|
-
gt:
|
|
191
|
-
isNegative:
|
|
192
|
-
isOdd:
|
|
193
|
-
isZero:
|
|
194
|
-
land:
|
|
195
|
-
leq:
|
|
196
|
-
lnot:
|
|
197
|
-
lor:
|
|
198
|
-
lt:
|
|
199
|
-
mod:
|
|
200
|
-
mul:
|
|
201
|
-
naf:
|
|
202
|
-
neg:
|
|
203
|
-
neq:
|
|
204
|
-
one:
|
|
205
|
-
pow:
|
|
206
|
-
shiftLeft:
|
|
207
|
-
shiftRight:
|
|
208
|
-
shl:
|
|
209
|
-
shr:
|
|
210
|
-
square:
|
|
211
|
-
sub:
|
|
212
|
-
toArray:
|
|
213
|
-
toLEBuff:
|
|
214
|
-
toNumber:
|
|
215
|
-
toRprBE:
|
|
216
|
-
toRprLE:
|
|
217
|
-
toString:
|
|
218
|
-
zero:
|
|
189
|
+
geq: No,
|
|
190
|
+
gt: Mo,
|
|
191
|
+
isNegative: ho,
|
|
192
|
+
isOdd: yo,
|
|
193
|
+
isZero: Lo,
|
|
194
|
+
land: jo,
|
|
195
|
+
leq: Ro,
|
|
196
|
+
lnot: Go,
|
|
197
|
+
lor: $o,
|
|
198
|
+
lt: Do,
|
|
199
|
+
mod: ko,
|
|
200
|
+
mul: vo,
|
|
201
|
+
naf: Co,
|
|
202
|
+
neg: Bo,
|
|
203
|
+
neq: qo,
|
|
204
|
+
one: Jo,
|
|
205
|
+
pow: So,
|
|
206
|
+
shiftLeft: $a,
|
|
207
|
+
shiftRight: Un,
|
|
208
|
+
shl: mo,
|
|
209
|
+
shr: bo,
|
|
210
|
+
square: xo,
|
|
211
|
+
sub: wo,
|
|
212
|
+
toArray: Fo,
|
|
213
|
+
toLEBuff: Ho,
|
|
214
|
+
toNumber: Ga,
|
|
215
|
+
toRprBE: Zo,
|
|
216
|
+
toRprLE: Wa,
|
|
217
|
+
toString: Vo,
|
|
218
|
+
zero: Qo
|
|
219
219
|
});
|
|
220
220
|
const oe = 1 << 30;
|
|
221
|
-
let
|
|
221
|
+
let Yo = class xn {
|
|
222
222
|
constructor(t) {
|
|
223
223
|
this.buffers = [], this.byteLength = t;
|
|
224
224
|
for (let e = 0; e < t; e += oe) {
|
|
@@ -236,7 +236,7 @@ let Ko = class vn {
|
|
|
236
236
|
const o = C + l > oe ? oe - C : l, y = new Uint8Array(this.buffers[d].buffer, this.buffers[d].byteOffset + C, o);
|
|
237
237
|
if (o == n)
|
|
238
238
|
return y.slice();
|
|
239
|
-
g || (n <= oe ? g = new Uint8Array(n) : g = new
|
|
239
|
+
g || (n <= oe ? g = new Uint8Array(n) : g = new xn(n)), g.set(y, n - l), l = l - o, d++, C = 0;
|
|
240
240
|
}
|
|
241
241
|
return g;
|
|
242
242
|
}
|
|
@@ -247,7 +247,7 @@ let Ko = class vn {
|
|
|
247
247
|
return;
|
|
248
248
|
const a = Math.floor(e / oe), s = Math.floor((e + n - 1) / oe);
|
|
249
249
|
if (a == s)
|
|
250
|
-
return t instanceof
|
|
250
|
+
return t instanceof xn && t.buffers.length == 1 ? this.buffers[a].set(t.buffers[0], e % oe) : this.buffers[a].set(t, e % oe);
|
|
251
251
|
let g = a, d = e % oe, C = n;
|
|
252
252
|
for (; C > 0; ) {
|
|
253
253
|
const l = d + C > oe ? oe - d : C, o = t.slice(n - C, n - C + l);
|
|
@@ -255,10 +255,10 @@ let Ko = class vn {
|
|
|
255
255
|
}
|
|
256
256
|
}
|
|
257
257
|
};
|
|
258
|
-
function
|
|
258
|
+
function tc(c) {
|
|
259
259
|
return globalThis.btoa(c);
|
|
260
260
|
}
|
|
261
|
-
|
|
261
|
+
tc(`(function thread(self) {
|
|
262
262
|
const MAXMEM = 32767;
|
|
263
263
|
let instance;
|
|
264
264
|
let memory;
|
|
@@ -384,14 +384,14 @@ Be("73eda753299d7d483339d80809a1d80553bda402fffe5bfeffffffff00000001", 16);
|
|
|
384
384
|
Be("21888242871839275222246405745257275088548364400416034343698204186575808495617");
|
|
385
385
|
Be("1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab", 16);
|
|
386
386
|
Be("21888242871839275222246405745257275088696311157297823662689037894645226208583");
|
|
387
|
-
const
|
|
388
|
-
async function
|
|
387
|
+
const Xa = Ko;
|
|
388
|
+
async function Va(c, t, e, n) {
|
|
389
389
|
if (e = e || 4096 * 64, typeof t != "number" && ["w+", "wx+", "r", "ax+", "a+"].indexOf(t) < 0)
|
|
390
390
|
throw new Error("Invalid open option");
|
|
391
391
|
const a = await on.promises.open(c, t), s = await a.stat();
|
|
392
|
-
return new
|
|
392
|
+
return new ec(a, s, e, n, c);
|
|
393
393
|
}
|
|
394
|
-
class
|
|
394
|
+
class ec {
|
|
395
395
|
constructor(t, e, n, a, s) {
|
|
396
396
|
for (this.fileName = s, this.fd = t, this.pos = 0, this.pageSize = a || 256; this.pageSize < e.blksize; )
|
|
397
397
|
this.pageSize *= 2;
|
|
@@ -610,16 +610,16 @@ class tc {
|
|
|
610
610
|
return g;
|
|
611
611
|
}
|
|
612
612
|
}
|
|
613
|
-
function
|
|
614
|
-
const t = c.initialSize || 1048576, e = new
|
|
613
|
+
function nc(c) {
|
|
614
|
+
const t = c.initialSize || 1048576, e = new Qa();
|
|
615
615
|
return e.o = c, e.o.data = new Uint8Array(t), e.allocSize = t, e.totalSize = 0, e.readOnly = !1, e.pos = 0, e;
|
|
616
616
|
}
|
|
617
|
-
function
|
|
618
|
-
const t = new
|
|
617
|
+
function ac(c) {
|
|
618
|
+
const t = new Qa();
|
|
619
619
|
return t.o = c, t.allocSize = c.data.byteLength, t.totalSize = c.data.byteLength, t.readOnly = !0, t.pos = 0, t;
|
|
620
620
|
}
|
|
621
|
-
const
|
|
622
|
-
class
|
|
621
|
+
const Sn = new Uint8Array(4), oa = new DataView(Sn.buffer), Ha = new Uint8Array(8), ca = new DataView(Ha.buffer);
|
|
622
|
+
class Qa {
|
|
623
623
|
constructor() {
|
|
624
624
|
this.pageSize = 16384;
|
|
625
625
|
}
|
|
@@ -656,15 +656,15 @@ class Ha {
|
|
|
656
656
|
}
|
|
657
657
|
async writeULE32(t, e) {
|
|
658
658
|
const n = this;
|
|
659
|
-
|
|
659
|
+
oa.setUint32(0, t, !0), await n.write(Sn, e);
|
|
660
660
|
}
|
|
661
661
|
async writeUBE32(t, e) {
|
|
662
662
|
const n = this;
|
|
663
|
-
|
|
663
|
+
oa.setUint32(0, t, !1), await n.write(Sn, e);
|
|
664
664
|
}
|
|
665
665
|
async writeULE64(t, e) {
|
|
666
666
|
const n = this;
|
|
667
|
-
|
|
667
|
+
ca.setUint32(0, t & 4294967295, !0), ca.setUint32(4, Math.floor(t / 4294967296), !0), await n.write(Ha, e);
|
|
668
668
|
}
|
|
669
669
|
async readULE32(t) {
|
|
670
670
|
const n = await this.read(4, t);
|
|
@@ -696,8 +696,8 @@ class Ha {
|
|
|
696
696
|
}
|
|
697
697
|
}
|
|
698
698
|
const ne = 1 << 22;
|
|
699
|
-
function
|
|
700
|
-
const t = c.initialSize || 0, e = new
|
|
699
|
+
function ic(c) {
|
|
700
|
+
const t = c.initialSize || 0, e = new Ka();
|
|
701
701
|
e.o = c;
|
|
702
702
|
const n = t ? Math.floor((t - 1) / ne) + 1 : 0;
|
|
703
703
|
e.o.data = [];
|
|
@@ -705,12 +705,12 @@ function ac(c) {
|
|
|
705
705
|
e.o.data.push(new Uint8Array(ne));
|
|
706
706
|
return n && e.o.data.push(new Uint8Array(t - ne * (n - 1))), e.totalSize = 0, e.readOnly = !1, e.pos = 0, e;
|
|
707
707
|
}
|
|
708
|
-
function
|
|
709
|
-
const t = new
|
|
708
|
+
function oc(c) {
|
|
709
|
+
const t = new Ka();
|
|
710
710
|
return t.o = c, t.totalSize = (c.data.length - 1) * ne + c.data[c.data.length - 1].byteLength, t.readOnly = !0, t.pos = 0, t;
|
|
711
711
|
}
|
|
712
|
-
const
|
|
713
|
-
class
|
|
712
|
+
const In = new Uint8Array(4), sa = new DataView(In.buffer), Ja = new Uint8Array(8), ra = new DataView(Ja.buffer);
|
|
713
|
+
class Ka {
|
|
714
714
|
constructor() {
|
|
715
715
|
this.pageSize = 16384;
|
|
716
716
|
}
|
|
@@ -760,15 +760,15 @@ class Ja {
|
|
|
760
760
|
}
|
|
761
761
|
async writeULE32(t, e) {
|
|
762
762
|
const n = this;
|
|
763
|
-
|
|
763
|
+
sa.setUint32(0, t, !0), await n.write(In, e);
|
|
764
764
|
}
|
|
765
765
|
async writeUBE32(t, e) {
|
|
766
766
|
const n = this;
|
|
767
|
-
|
|
767
|
+
sa.setUint32(0, t, !1), await n.write(In, e);
|
|
768
768
|
}
|
|
769
769
|
async writeULE64(t, e) {
|
|
770
770
|
const n = this;
|
|
771
|
-
|
|
771
|
+
ra.setUint32(0, t & 4294967295, !0), ra.setUint32(4, Math.floor(t / 4294967296), !0), await n.write(Ja, e);
|
|
772
772
|
}
|
|
773
773
|
async readULE32(t) {
|
|
774
774
|
const n = await this.read(4, t);
|
|
@@ -803,22 +803,22 @@ class Ja {
|
|
|
803
803
|
return g;
|
|
804
804
|
}
|
|
805
805
|
}
|
|
806
|
-
const
|
|
807
|
-
async function
|
|
806
|
+
const cc = 1024, sc = 512, rc = 2, lc = 0, Ya = 65536, ti = 8192;
|
|
807
|
+
async function ei(c, t, e) {
|
|
808
808
|
if (typeof c == "string" && (c = {
|
|
809
809
|
type: "file",
|
|
810
810
|
fileName: c,
|
|
811
|
-
cacheSize: t ||
|
|
812
|
-
pageSize: e ||
|
|
811
|
+
cacheSize: t || Ya,
|
|
812
|
+
pageSize: e || ti
|
|
813
813
|
}), c.type == "file")
|
|
814
|
-
return await
|
|
814
|
+
return await Va(c.fileName, cc | sc | rc, c.cacheSize, c.pageSize);
|
|
815
815
|
if (c.type == "mem")
|
|
816
|
-
return
|
|
816
|
+
return nc(c);
|
|
817
817
|
if (c.type == "bigMem")
|
|
818
|
-
return
|
|
818
|
+
return ic(c);
|
|
819
819
|
throw new Error("Invalid FastFile type: " + c.type);
|
|
820
820
|
}
|
|
821
|
-
async function
|
|
821
|
+
async function ni(c, t, e) {
|
|
822
822
|
if (c instanceof Uint8Array && (c = {
|
|
823
823
|
type: "mem",
|
|
824
824
|
data: c
|
|
@@ -832,18 +832,18 @@ async function ei(c, t, e) {
|
|
|
832
832
|
}) : typeof c == "string" && (c = {
|
|
833
833
|
type: "file",
|
|
834
834
|
fileName: c,
|
|
835
|
-
cacheSize: t ||
|
|
836
|
-
pageSize: e ||
|
|
835
|
+
cacheSize: t || Ya,
|
|
836
|
+
pageSize: e || ti
|
|
837
837
|
}), c.type == "file")
|
|
838
|
-
return await
|
|
838
|
+
return await Va(c.fileName, lc, c.cacheSize, c.pageSize);
|
|
839
839
|
if (c.type == "mem")
|
|
840
|
-
return await
|
|
840
|
+
return await ac(c);
|
|
841
841
|
if (c.type == "bigMem")
|
|
842
|
-
return await
|
|
842
|
+
return await oc(c);
|
|
843
843
|
throw new Error("Invalid FastFile type: " + c.type);
|
|
844
844
|
}
|
|
845
|
-
async function
|
|
846
|
-
const s = await
|
|
845
|
+
async function la(c, t, e, n, a) {
|
|
846
|
+
const s = await ni(c, n, a), g = await s.read(4);
|
|
847
847
|
let d = "";
|
|
848
848
|
for (let y = 0; y < 4; y++)
|
|
849
849
|
d += String.fromCharCode(g[y]);
|
|
@@ -862,20 +862,20 @@ async function ra(c, t, e, n, a) {
|
|
|
862
862
|
}
|
|
863
863
|
return { fd: s, sections: o };
|
|
864
864
|
}
|
|
865
|
-
async function
|
|
866
|
-
const g = await
|
|
865
|
+
async function uc(c, t, e, n, a, s) {
|
|
866
|
+
const g = await ei(c, a, s), d = new Uint8Array(4);
|
|
867
867
|
for (let C = 0; C < 4; C++)
|
|
868
868
|
d[C] = t.charCodeAt(C);
|
|
869
869
|
return await g.write(d, 0), await g.writeULE32(e), await g.writeULE32(n), g;
|
|
870
870
|
}
|
|
871
|
-
async function
|
|
871
|
+
async function ua(c, t) {
|
|
872
872
|
if (typeof c.writingSection < "u")
|
|
873
873
|
throw new Error("Already writing a section");
|
|
874
874
|
await c.writeULE32(t), c.writingSection = {
|
|
875
875
|
pSectionSize: c.pos
|
|
876
876
|
}, await c.writeULE64(0);
|
|
877
877
|
}
|
|
878
|
-
async function
|
|
878
|
+
async function da(c) {
|
|
879
879
|
if (typeof c.writingSection > "u")
|
|
880
880
|
throw new Error("Not writing a section");
|
|
881
881
|
const t = c.pos - c.writingSection.pSectionSize - 8, e = c.pos;
|
|
@@ -897,21 +897,21 @@ async function Ze(c, t) {
|
|
|
897
897
|
throw new Error("Invalid section size reading");
|
|
898
898
|
delete c.readingSection;
|
|
899
899
|
}
|
|
900
|
-
async function
|
|
900
|
+
async function dc(c, t, e, n) {
|
|
901
901
|
const a = new Uint8Array(e);
|
|
902
|
-
|
|
902
|
+
Xa.toRprLE(a, 0, t, e), await c.write(a, n);
|
|
903
903
|
}
|
|
904
904
|
async function we(c, t, e) {
|
|
905
905
|
const n = await c.read(t, e);
|
|
906
|
-
return
|
|
906
|
+
return Xa.fromRprLE(n, 0, t);
|
|
907
907
|
}
|
|
908
908
|
async function Ae(c, t, e, n, a) {
|
|
909
909
|
if (n = typeof n > "u" ? 0 : n, a = typeof a > "u" ? t[e][0].size - n : a, n + a > t[e][0].size)
|
|
910
910
|
throw new Error("Reading out of the range of the section");
|
|
911
911
|
let s;
|
|
912
|
-
return a < 1 << 30 ? s = new Uint8Array(a) : s = new
|
|
912
|
+
return a < 1 << 30 ? s = new Uint8Array(a) : s = new Yo(a), await c.readToBuffer(s, 0, a, t[e][0].p + n), s;
|
|
913
913
|
}
|
|
914
|
-
const
|
|
914
|
+
const fc = [0, 1, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4];
|
|
915
915
|
function sn(c, t) {
|
|
916
916
|
if (!t || t == 10)
|
|
917
917
|
return BigInt(c);
|
|
@@ -919,7 +919,7 @@ function sn(c, t) {
|
|
|
919
919
|
return c.slice(0, 2) == "0x" ? BigInt(c) : BigInt("0x" + c);
|
|
920
920
|
}
|
|
921
921
|
const ee = sn;
|
|
922
|
-
function
|
|
922
|
+
function _c(c, t) {
|
|
923
923
|
let e = BigInt(0);
|
|
924
924
|
t = BigInt(t);
|
|
925
925
|
for (let n = 0; n < c.length; n++)
|
|
@@ -928,12 +928,12 @@ function fc(c, t) {
|
|
|
928
928
|
}
|
|
929
929
|
function We(c) {
|
|
930
930
|
const t = c.toString(16);
|
|
931
|
-
return (t.length - 1) * 4 +
|
|
931
|
+
return (t.length - 1) * 4 + fc[parseInt(t[0], 16)];
|
|
932
932
|
}
|
|
933
|
-
function
|
|
933
|
+
function ai(c) {
|
|
934
934
|
return BigInt(c) < BigInt(0);
|
|
935
935
|
}
|
|
936
|
-
function
|
|
936
|
+
function ii(c) {
|
|
937
937
|
return !c;
|
|
938
938
|
}
|
|
939
939
|
function tn(c, t) {
|
|
@@ -942,11 +942,11 @@ function tn(c, t) {
|
|
|
942
942
|
function xe(c, t) {
|
|
943
943
|
return BigInt(c) >> BigInt(t);
|
|
944
944
|
}
|
|
945
|
-
const
|
|
946
|
-
function
|
|
945
|
+
const gc = tn, pc = xe;
|
|
946
|
+
function jn(c) {
|
|
947
947
|
return (BigInt(c) & BigInt(1)) == BigInt(1);
|
|
948
948
|
}
|
|
949
|
-
function
|
|
949
|
+
function hc(c) {
|
|
950
950
|
let t = BigInt(c);
|
|
951
951
|
const e = [];
|
|
952
952
|
for (; t; ) {
|
|
@@ -959,47 +959,47 @@ function pc(c) {
|
|
|
959
959
|
}
|
|
960
960
|
return e;
|
|
961
961
|
}
|
|
962
|
-
function
|
|
962
|
+
function oi(c) {
|
|
963
963
|
let t = BigInt(c);
|
|
964
964
|
const e = [];
|
|
965
965
|
for (; t; )
|
|
966
966
|
t & BigInt(1) ? e.push(1) : e.push(0), t = t >> BigInt(1);
|
|
967
967
|
return e;
|
|
968
968
|
}
|
|
969
|
-
function
|
|
969
|
+
function ci(c) {
|
|
970
970
|
if (c > BigInt(Number.MAX_SAFE_INTEGER))
|
|
971
971
|
throw new Error("Number too big");
|
|
972
972
|
return Number(c);
|
|
973
973
|
}
|
|
974
|
-
function
|
|
974
|
+
function Lc(c, t) {
|
|
975
975
|
const e = [];
|
|
976
976
|
let n = BigInt(c);
|
|
977
977
|
for (t = BigInt(t); n; )
|
|
978
978
|
e.unshift(Number(n % t)), n = n / t;
|
|
979
979
|
return e;
|
|
980
980
|
}
|
|
981
|
-
function
|
|
981
|
+
function $n(c, t) {
|
|
982
982
|
return BigInt(c) + BigInt(t);
|
|
983
983
|
}
|
|
984
984
|
function he(c, t) {
|
|
985
985
|
return BigInt(c) - BigInt(t);
|
|
986
986
|
}
|
|
987
|
-
function
|
|
987
|
+
function si(c) {
|
|
988
988
|
return -BigInt(c);
|
|
989
989
|
}
|
|
990
|
-
function
|
|
990
|
+
function ri(c, t) {
|
|
991
991
|
return BigInt(c) * BigInt(t);
|
|
992
992
|
}
|
|
993
|
-
function
|
|
993
|
+
function mc(c) {
|
|
994
994
|
return BigInt(c) * BigInt(c);
|
|
995
995
|
}
|
|
996
996
|
function Xe(c, t) {
|
|
997
997
|
return BigInt(c) ** BigInt(t);
|
|
998
998
|
}
|
|
999
|
-
function
|
|
999
|
+
function bc(c, t) {
|
|
1000
1000
|
return BigInt(c) ** BigInt(t);
|
|
1001
1001
|
}
|
|
1002
|
-
function
|
|
1002
|
+
function yc(c) {
|
|
1003
1003
|
return BigInt(c) >= 0 ? BigInt(c) : -BigInt(c);
|
|
1004
1004
|
}
|
|
1005
1005
|
function Se(c, t) {
|
|
@@ -1011,37 +1011,37 @@ function _e(c, t) {
|
|
|
1011
1011
|
function Fe(c, t) {
|
|
1012
1012
|
return BigInt(c) == BigInt(t);
|
|
1013
1013
|
}
|
|
1014
|
-
function
|
|
1014
|
+
function Cc(c, t) {
|
|
1015
1015
|
return BigInt(c) != BigInt(t);
|
|
1016
1016
|
}
|
|
1017
|
-
function
|
|
1017
|
+
function Ac(c, t) {
|
|
1018
1018
|
return BigInt(c) < BigInt(t);
|
|
1019
1019
|
}
|
|
1020
|
-
function
|
|
1020
|
+
function On(c, t) {
|
|
1021
1021
|
return BigInt(c) > BigInt(t);
|
|
1022
1022
|
}
|
|
1023
|
-
function
|
|
1023
|
+
function Fc(c, t) {
|
|
1024
1024
|
return BigInt(c) <= BigInt(t);
|
|
1025
1025
|
}
|
|
1026
|
-
function
|
|
1026
|
+
function li(c, t) {
|
|
1027
1027
|
return BigInt(c) >= BigInt(t);
|
|
1028
1028
|
}
|
|
1029
|
-
function
|
|
1029
|
+
function Gn(c, t) {
|
|
1030
1030
|
return BigInt(c) & BigInt(t);
|
|
1031
1031
|
}
|
|
1032
|
-
function
|
|
1032
|
+
function Ec(c, t) {
|
|
1033
1033
|
return BigInt(c) | BigInt(t);
|
|
1034
1034
|
}
|
|
1035
|
-
function
|
|
1035
|
+
function wc(c, t) {
|
|
1036
1036
|
return BigInt(c) ^ BigInt(t);
|
|
1037
1037
|
}
|
|
1038
|
-
function
|
|
1038
|
+
function Bc(c, t) {
|
|
1039
1039
|
return BigInt(c) && BigInt(t);
|
|
1040
1040
|
}
|
|
1041
|
-
function
|
|
1041
|
+
function vc(c, t) {
|
|
1042
1042
|
return BigInt(c) || BigInt(t);
|
|
1043
1043
|
}
|
|
1044
|
-
function
|
|
1044
|
+
function xc(c) {
|
|
1045
1045
|
return !BigInt(c);
|
|
1046
1046
|
}
|
|
1047
1047
|
function je(c, t, e, n) {
|
|
@@ -1051,9 +1051,9 @@ function je(c, t, e, n) {
|
|
|
1051
1051
|
for (let d = g; d < s.length; d++)
|
|
1052
1052
|
s[d] = 0;
|
|
1053
1053
|
for (let d = s.length * 4; d < n; d++)
|
|
1054
|
-
c[d] =
|
|
1054
|
+
c[d] = ci(Gn(xe(e, d * 8), 255));
|
|
1055
1055
|
}
|
|
1056
|
-
function
|
|
1056
|
+
function ui(c, t, e, n) {
|
|
1057
1057
|
const a = "0000000" + e.toString(16), s = new DataView(c.buffer, c.byteOffset + t, n), g = ((a.length - 7) * 4 - 1 >> 5) + 1;
|
|
1058
1058
|
for (let d = 0; d < g; d++)
|
|
1059
1059
|
s.setUint32(n - d * 4 - 4, parseInt(a.substring(a.length - 8 * d - 8, a.length - 8 * d), 16), !1);
|
|
@@ -1065,73 +1065,73 @@ function $e(c, t, e) {
|
|
|
1065
1065
|
const n = new Uint32Array(c.buffer, t, e / 4), a = new Array(e / 4);
|
|
1066
1066
|
return n.forEach((s, g) => a[a.length - g - 1] = s.toString(16).padStart(8, "0")), sn(a.join(""), 16);
|
|
1067
1067
|
}
|
|
1068
|
-
function
|
|
1068
|
+
function di(c, t, e) {
|
|
1069
1069
|
e = e || c.byteLength, t = t || 0;
|
|
1070
1070
|
const n = new DataView(c.buffer, c.byteOffset + t, e), a = new Array(e / 4);
|
|
1071
1071
|
for (let s = 0; s < e / 4; s++)
|
|
1072
1072
|
a[s] = n.getUint32(s * 4, !1).toString(16).padStart(8, "0");
|
|
1073
1073
|
return sn(a.join(""), 16);
|
|
1074
1074
|
}
|
|
1075
|
-
function
|
|
1075
|
+
function fi(c, t) {
|
|
1076
1076
|
return c.toString(t);
|
|
1077
1077
|
}
|
|
1078
1078
|
function Ie(c) {
|
|
1079
1079
|
const t = new Uint8Array(Math.floor((We(c) - 1) / 8) + 1);
|
|
1080
1080
|
return je(t, 0, c, t.byteLength), t;
|
|
1081
1081
|
}
|
|
1082
|
-
const
|
|
1083
|
-
var
|
|
1082
|
+
const _i = ee(0), Ee = ee(1);
|
|
1083
|
+
var Sc = /* @__PURE__ */ Object.freeze({
|
|
1084
1084
|
__proto__: null,
|
|
1085
|
-
abs:
|
|
1086
|
-
add:
|
|
1087
|
-
band:
|
|
1085
|
+
abs: yc,
|
|
1086
|
+
add: $n,
|
|
1087
|
+
band: Gn,
|
|
1088
1088
|
bitLength: We,
|
|
1089
|
-
bits:
|
|
1090
|
-
bor:
|
|
1091
|
-
bxor:
|
|
1089
|
+
bits: oi,
|
|
1090
|
+
bor: Ec,
|
|
1091
|
+
bxor: wc,
|
|
1092
1092
|
div: Se,
|
|
1093
1093
|
e: ee,
|
|
1094
1094
|
eq: Fe,
|
|
1095
|
-
exp:
|
|
1096
|
-
fromArray:
|
|
1097
|
-
fromRprBE:
|
|
1095
|
+
exp: bc,
|
|
1096
|
+
fromArray: _c,
|
|
1097
|
+
fromRprBE: di,
|
|
1098
1098
|
fromRprLE: $e,
|
|
1099
1099
|
fromString: sn,
|
|
1100
|
-
geq:
|
|
1101
|
-
gt:
|
|
1102
|
-
isNegative:
|
|
1103
|
-
isOdd:
|
|
1104
|
-
isZero:
|
|
1105
|
-
land:
|
|
1106
|
-
leq:
|
|
1107
|
-
lnot:
|
|
1108
|
-
lor:
|
|
1109
|
-
lt:
|
|
1100
|
+
geq: li,
|
|
1101
|
+
gt: On,
|
|
1102
|
+
isNegative: ai,
|
|
1103
|
+
isOdd: jn,
|
|
1104
|
+
isZero: ii,
|
|
1105
|
+
land: Bc,
|
|
1106
|
+
leq: Fc,
|
|
1107
|
+
lnot: xc,
|
|
1108
|
+
lor: vc,
|
|
1109
|
+
lt: Ac,
|
|
1110
1110
|
mod: _e,
|
|
1111
|
-
mul:
|
|
1112
|
-
naf:
|
|
1113
|
-
neg:
|
|
1114
|
-
neq:
|
|
1111
|
+
mul: ri,
|
|
1112
|
+
naf: hc,
|
|
1113
|
+
neg: si,
|
|
1114
|
+
neq: Cc,
|
|
1115
1115
|
one: Ee,
|
|
1116
1116
|
pow: Xe,
|
|
1117
1117
|
shiftLeft: tn,
|
|
1118
1118
|
shiftRight: xe,
|
|
1119
|
-
shl:
|
|
1120
|
-
shr:
|
|
1121
|
-
square:
|
|
1119
|
+
shl: gc,
|
|
1120
|
+
shr: pc,
|
|
1121
|
+
square: mc,
|
|
1122
1122
|
sub: he,
|
|
1123
|
-
toArray:
|
|
1123
|
+
toArray: Lc,
|
|
1124
1124
|
toLEBuff: Ie,
|
|
1125
|
-
toNumber:
|
|
1126
|
-
toRprBE:
|
|
1125
|
+
toNumber: ci,
|
|
1126
|
+
toRprBE: ui,
|
|
1127
1127
|
toRprLE: je,
|
|
1128
|
-
toString:
|
|
1129
|
-
zero:
|
|
1128
|
+
toString: fi,
|
|
1129
|
+
zero: _i
|
|
1130
1130
|
});
|
|
1131
|
-
function
|
|
1132
|
-
if (
|
|
1131
|
+
function fa(c, t, e) {
|
|
1132
|
+
if (ii(e))
|
|
1133
1133
|
return c.one;
|
|
1134
|
-
const n =
|
|
1134
|
+
const n = oi(e);
|
|
1135
1135
|
if (n.length == 0)
|
|
1136
1136
|
return c.one;
|
|
1137
1137
|
let a = t;
|
|
@@ -1139,29 +1139,29 @@ function da(c, t, e) {
|
|
|
1139
1139
|
a = c.square(a), n[s] && (a = c.mul(a, t));
|
|
1140
1140
|
return a;
|
|
1141
1141
|
}
|
|
1142
|
-
function
|
|
1142
|
+
function Ic(c) {
|
|
1143
1143
|
if (c.m % 2 == 1)
|
|
1144
1144
|
if (Fe(_e(c.p, 4), 1))
|
|
1145
1145
|
if (Fe(_e(c.p, 8), 1))
|
|
1146
1146
|
if (Fe(_e(c.p, 16), 1))
|
|
1147
|
-
Ic(c);
|
|
1148
|
-
else if (Fe(_e(c.p, 16), 9))
|
|
1149
1147
|
Oc(c);
|
|
1148
|
+
else if (Fe(_e(c.p, 16), 9))
|
|
1149
|
+
Pc(c);
|
|
1150
1150
|
else
|
|
1151
1151
|
throw new Error("Field withot sqrt");
|
|
1152
1152
|
else if (Fe(_e(c.p, 8), 5))
|
|
1153
|
-
|
|
1153
|
+
kc(c);
|
|
1154
1154
|
else
|
|
1155
1155
|
throw new Error("Field withot sqrt");
|
|
1156
1156
|
else
|
|
1157
|
-
Fe(_e(c.p, 4), 3) &&
|
|
1157
|
+
Fe(_e(c.p, 4), 3) && Tc(c);
|
|
1158
1158
|
else {
|
|
1159
1159
|
const t = _e(Xe(c.p, c.m / 2), 4);
|
|
1160
|
-
t == 1 ?
|
|
1160
|
+
t == 1 ? qc(c) : t == 3 ? Dc(c) : Mc(c);
|
|
1161
1161
|
}
|
|
1162
1162
|
}
|
|
1163
|
-
function
|
|
1164
|
-
for (c.sqrt_q = Xe(c.p, c.m), c.sqrt_s = 0, c.sqrt_t = he(c.sqrt_q, 1); !
|
|
1163
|
+
function Oc(c) {
|
|
1164
|
+
for (c.sqrt_q = Xe(c.p, c.m), c.sqrt_s = 0, c.sqrt_t = he(c.sqrt_q, 1); !jn(c.sqrt_t); )
|
|
1165
1165
|
c.sqrt_s = c.sqrt_s + 1, c.sqrt_t = Se(c.sqrt_t, 2);
|
|
1166
1166
|
let t = c.one;
|
|
1167
1167
|
for (; c.eq(t, c.one); ) {
|
|
@@ -1189,17 +1189,17 @@ function Ic(c) {
|
|
|
1189
1189
|
return n.geq(d, n.zero) ? d : n.neg(d);
|
|
1190
1190
|
};
|
|
1191
1191
|
}
|
|
1192
|
-
function
|
|
1192
|
+
function Pc(c) {
|
|
1193
1193
|
c.sqrt = function() {
|
|
1194
1194
|
throw new Error("Sqrt alg 4 not implemented");
|
|
1195
1195
|
};
|
|
1196
1196
|
}
|
|
1197
|
-
function
|
|
1197
|
+
function kc(c) {
|
|
1198
1198
|
c.sqrt = function() {
|
|
1199
1199
|
throw new Error("Sqrt alg 3 not implemented");
|
|
1200
1200
|
};
|
|
1201
1201
|
}
|
|
1202
|
-
function
|
|
1202
|
+
function Tc(c) {
|
|
1203
1203
|
c.sqrt_q = Xe(c.p, c.m), c.sqrt_e1 = Se(he(c.sqrt_q, 3), 4), c.sqrt = function(t) {
|
|
1204
1204
|
if (this.isZero(t))
|
|
1205
1205
|
return this.zero;
|
|
@@ -1210,12 +1210,12 @@ function kc(c) {
|
|
|
1210
1210
|
return c.geq(a, c.zero) ? a : c.neg(a);
|
|
1211
1211
|
};
|
|
1212
1212
|
}
|
|
1213
|
-
function
|
|
1213
|
+
function qc(c) {
|
|
1214
1214
|
c.sqrt = function() {
|
|
1215
1215
|
throw new Error("Sqrt alg 10 not implemented");
|
|
1216
1216
|
};
|
|
1217
1217
|
}
|
|
1218
|
-
function
|
|
1218
|
+
function Dc(c) {
|
|
1219
1219
|
c.sqrt_q = Xe(c.p, c.m / 2), c.sqrt_e34 = Se(he(c.sqrt_q, 3), 4), c.sqrt_e12 = Se(he(c.sqrt_q, 1), 2), c.frobenius = function(t, e) {
|
|
1220
1220
|
return t % 2 == 1 ? c.conjugate(e) : e;
|
|
1221
1221
|
}, c.sqrt = function(t) {
|
|
@@ -1233,7 +1233,7 @@ function qc(c) {
|
|
|
1233
1233
|
return e.geq(d, e.zero) ? d : e.neg(d);
|
|
1234
1234
|
};
|
|
1235
1235
|
}
|
|
1236
|
-
function
|
|
1236
|
+
function Mc(c) {
|
|
1237
1237
|
c.sqrt = function() {
|
|
1238
1238
|
throw new Error("Sqrt alg 8 not implemented");
|
|
1239
1239
|
};
|
|
@@ -1241,10 +1241,10 @@ function Dc(c) {
|
|
|
1241
1241
|
function Le(c, t, e, n, a) {
|
|
1242
1242
|
c[t] = c[t] + c[e] >>> 0, c[a] = (c[a] ^ c[t]) >>> 0, c[a] = (c[a] << 16 | c[a] >>> 16 & 65535) >>> 0, c[n] = c[n] + c[a] >>> 0, c[e] = (c[e] ^ c[n]) >>> 0, c[e] = (c[e] << 12 | c[e] >>> 20 & 4095) >>> 0, c[t] = c[t] + c[e] >>> 0, c[a] = (c[a] ^ c[t]) >>> 0, c[a] = (c[a] << 8 | c[a] >>> 24 & 255) >>> 0, c[n] = c[n] + c[a] >>> 0, c[e] = (c[e] ^ c[n]) >>> 0, c[e] = (c[e] << 7 | c[e] >>> 25 & 127) >>> 0;
|
|
1243
1243
|
}
|
|
1244
|
-
function
|
|
1244
|
+
function Rc(c) {
|
|
1245
1245
|
Le(c, 0, 4, 8, 12), Le(c, 1, 5, 9, 13), Le(c, 2, 6, 10, 14), Le(c, 3, 7, 11, 15), Le(c, 0, 5, 10, 15), Le(c, 1, 6, 11, 12), Le(c, 2, 7, 8, 13), Le(c, 3, 4, 9, 14);
|
|
1246
1246
|
}
|
|
1247
|
-
class
|
|
1247
|
+
class Nc {
|
|
1248
1248
|
constructor(t) {
|
|
1249
1249
|
t = t || [0, 0, 0, 0, 0, 0, 0, 0], this.state = [
|
|
1250
1250
|
1634760805,
|
|
@@ -1269,7 +1269,7 @@ class Rc {
|
|
|
1269
1269
|
return this.idx == 16 && this.update(), this.buff[this.idx++];
|
|
1270
1270
|
}
|
|
1271
1271
|
nextU64() {
|
|
1272
|
-
return
|
|
1272
|
+
return $n(ri(this.nextU32(), 4294967296), this.nextU32());
|
|
1273
1273
|
}
|
|
1274
1274
|
nextBool() {
|
|
1275
1275
|
return (this.nextU32() & 1) == 1;
|
|
@@ -1278,13 +1278,13 @@ class Rc {
|
|
|
1278
1278
|
for (let t = 0; t < 16; t++)
|
|
1279
1279
|
this.buff[t] = this.state[t];
|
|
1280
1280
|
for (let t = 0; t < 10; t++)
|
|
1281
|
-
|
|
1281
|
+
Rc(this.buff);
|
|
1282
1282
|
for (let t = 0; t < 16; t++)
|
|
1283
1283
|
this.buff[t] = this.buff[t] + this.state[t] >>> 0;
|
|
1284
1284
|
this.idx = 0, this.state[12] = this.state[12] + 1 >>> 0, this.state[12] == 0 && (this.state[13] = this.state[13] + 1 >>> 0, this.state[13] == 0 && (this.state[14] = this.state[14] + 1 >>> 0, this.state[14] == 0 && (this.state[15] = this.state[15] + 1 >>> 0)));
|
|
1285
1285
|
}
|
|
1286
1286
|
}
|
|
1287
|
-
function
|
|
1287
|
+
function gi(c) {
|
|
1288
1288
|
let t = new Uint8Array(c);
|
|
1289
1289
|
if (process.browser)
|
|
1290
1290
|
if (typeof globalThis.crypto < "u")
|
|
@@ -1296,17 +1296,17 @@ function _i(c) {
|
|
|
1296
1296
|
on.randomFillSync(t);
|
|
1297
1297
|
return t;
|
|
1298
1298
|
}
|
|
1299
|
-
function
|
|
1300
|
-
const c =
|
|
1299
|
+
function zc() {
|
|
1300
|
+
const c = gi(32), t = new Uint32Array(c.buffer), e = [];
|
|
1301
1301
|
for (let n = 0; n < 8; n++)
|
|
1302
1302
|
e.push(t[n]);
|
|
1303
1303
|
return e;
|
|
1304
1304
|
}
|
|
1305
1305
|
let Qe = null;
|
|
1306
|
-
function
|
|
1307
|
-
return Qe || (Qe = new
|
|
1306
|
+
function Zn() {
|
|
1307
|
+
return Qe || (Qe = new Nc(zc()), Qe);
|
|
1308
1308
|
}
|
|
1309
|
-
class
|
|
1309
|
+
class Uc {
|
|
1310
1310
|
constructor(t, e, n) {
|
|
1311
1311
|
this.F = e, this.G = t, this.opMulGF = n;
|
|
1312
1312
|
let a = e.sqrt_t || e.t, s = e.sqrt_s || e.s, g = e.one;
|
|
@@ -1330,7 +1330,7 @@ class zc {
|
|
|
1330
1330
|
fft(t) {
|
|
1331
1331
|
if (t.length <= 1)
|
|
1332
1332
|
return t;
|
|
1333
|
-
const e =
|
|
1333
|
+
const e = _a(t.length - 1) + 1;
|
|
1334
1334
|
this._setRoots(e);
|
|
1335
1335
|
const n = 1 << e;
|
|
1336
1336
|
if (t.length != n)
|
|
@@ -1340,7 +1340,7 @@ class zc {
|
|
|
1340
1340
|
ifft(t) {
|
|
1341
1341
|
if (t.length <= 1)
|
|
1342
1342
|
return t;
|
|
1343
|
-
const e =
|
|
1343
|
+
const e = _a(t.length - 1) + 1;
|
|
1344
1344
|
this._setRoots(e);
|
|
1345
1345
|
const n = 1 << e;
|
|
1346
1346
|
if (t.length != n)
|
|
@@ -1351,7 +1351,7 @@ class zc {
|
|
|
1351
1351
|
return g;
|
|
1352
1352
|
}
|
|
1353
1353
|
}
|
|
1354
|
-
function
|
|
1354
|
+
function _a(c) {
|
|
1355
1355
|
return (c & 4294901760 ? (c &= 4294901760, 16) : 0) | (c & 4278255360 ? (c &= 4278255360, 8) : 0) | (c & 4042322160 ? (c &= 4042322160, 4) : 0) | (c & 3435973836 ? (c &= 3435973836, 2) : 0) | (c & 2863311530) !== 0;
|
|
1356
1356
|
}
|
|
1357
1357
|
function en(c, t, e, n, a) {
|
|
@@ -1368,7 +1368,7 @@ function en(c, t, e, n, a) {
|
|
|
1368
1368
|
l[o] = c.G.add(d[o], c.opMulGF(C[o], c.roots[e][o])), l[o + g] = c.G.sub(d[o], c.opMulGF(C[o], c.roots[e][o]));
|
|
1369
1369
|
return l;
|
|
1370
1370
|
}
|
|
1371
|
-
class
|
|
1371
|
+
class jc {
|
|
1372
1372
|
constructor(t) {
|
|
1373
1373
|
this.type = "F1", this.one = BigInt(1), this.zero = BigInt(0), this.p = BigInt(t), this.m = 1, this.negone = this.p - this.one, this.two = BigInt(2), this.half = this.p >> this.one, this.bitLength = We(this.p), this.mask = (this.one << BigInt(this.bitLength)) - this.one, this.n64 = Math.floor((this.bitLength - 1) / 64) + 1, this.n32 = this.n64 * 2, this.n8 = this.n64 * 8, this.R = this.e(this.one << BigInt(this.n64 * 64)), this.Ri = this.inv(this.R);
|
|
1374
1374
|
const e = this.negone >> this.one;
|
|
@@ -1378,7 +1378,7 @@ class Uc {
|
|
|
1378
1378
|
this.nqr = this.nqr + this.one, n = this.pow(this.nqr, e);
|
|
1379
1379
|
for (this.s = 0, this.t = this.negone; (this.t & this.one) == this.zero; )
|
|
1380
1380
|
this.s = this.s + 1, this.t = this.t >> this.one;
|
|
1381
|
-
this.nqr_to_t = this.pow(this.nqr, this.t),
|
|
1381
|
+
this.nqr_to_t = this.pow(this.nqr, this.t), Ic(this), this.FFT = new Uc(this, this, this.mul.bind(this)), this.fft = this.FFT.fft.bind(this.FFT), this.ifft = this.FFT.ifft.bind(this.FFT), this.w = this.FFT.w, this.wi = this.FFT.wi, this.shift = this.square(this.nqr), this.k = this.exp(this.nqr, 2 ** this.s);
|
|
1382
1382
|
}
|
|
1383
1383
|
e(t, e) {
|
|
1384
1384
|
let n;
|
|
@@ -1451,10 +1451,10 @@ class Uc {
|
|
|
1451
1451
|
return t % e;
|
|
1452
1452
|
}
|
|
1453
1453
|
pow(t, e) {
|
|
1454
|
-
return
|
|
1454
|
+
return fa(this, t, e);
|
|
1455
1455
|
}
|
|
1456
1456
|
exp(t, e) {
|
|
1457
|
-
return
|
|
1457
|
+
return fa(this, t, e);
|
|
1458
1458
|
}
|
|
1459
1459
|
band(t, e) {
|
|
1460
1460
|
const n = t & e & this.mask;
|
|
@@ -1530,7 +1530,7 @@ class Uc {
|
|
|
1530
1530
|
const t = this.bitLength * 2 / 8;
|
|
1531
1531
|
let e = this.zero;
|
|
1532
1532
|
for (let n = 0; n < t; n++)
|
|
1533
|
-
e = (e << BigInt(8)) + BigInt(
|
|
1533
|
+
e = (e << BigInt(8)) + BigInt(gi(1)[0]);
|
|
1534
1534
|
return e % this.p;
|
|
1535
1535
|
}
|
|
1536
1536
|
toString(t, e) {
|
|
@@ -1563,7 +1563,7 @@ class Uc {
|
|
|
1563
1563
|
}
|
|
1564
1564
|
// Returns a buffer with Big Endian Representation
|
|
1565
1565
|
toRprBE(t, e, n) {
|
|
1566
|
-
|
|
1566
|
+
ui(t, e, n, this.n64 * 8);
|
|
1567
1567
|
}
|
|
1568
1568
|
// Returns a buffer with Big Endian Montgomery Representation
|
|
1569
1569
|
toRprBEM(t, e, n) {
|
|
@@ -1578,7 +1578,7 @@ class Uc {
|
|
|
1578
1578
|
}
|
|
1579
1579
|
// Pases a buffer with Big Endian Representation
|
|
1580
1580
|
fromRprBE(t, e) {
|
|
1581
|
-
return
|
|
1581
|
+
return di(t, e, this.n8);
|
|
1582
1582
|
}
|
|
1583
1583
|
fromRprLEM(t, e) {
|
|
1584
1584
|
return this.mul(this.fromRprLE(t, e), this.Ri);
|
|
@@ -1608,7 +1608,7 @@ be.bigInt2U32LE = function(t, e) {
|
|
|
1608
1608
|
be.isOcamNum = function(c) {
|
|
1609
1609
|
return !(!Array.isArray(c) || c.length != 3 || typeof c[0] != "number" || typeof c[1] != "number" || !Array.isArray(c[2]));
|
|
1610
1610
|
};
|
|
1611
|
-
var
|
|
1611
|
+
var $c = function(t, e, n) {
|
|
1612
1612
|
const a = n || "int";
|
|
1613
1613
|
if (t.modules[a])
|
|
1614
1614
|
return a;
|
|
@@ -2334,7 +2334,7 @@ var jc = function(t, e, n) {
|
|
|
2334
2334
|
));
|
|
2335
2335
|
}
|
|
2336
2336
|
return d(), C(), o(), l(), y(), E(), m(), x(), O(), L(), I(), w(), S(), t.exportFunction(a + "_copy"), t.exportFunction(a + "_zero"), t.exportFunction(a + "_one"), t.exportFunction(a + "_isZero"), t.exportFunction(a + "_eq"), t.exportFunction(a + "_gte"), t.exportFunction(a + "_add"), t.exportFunction(a + "_sub"), t.exportFunction(a + "_mul"), t.exportFunction(a + "_square"), t.exportFunction(a + "_squareOld"), t.exportFunction(a + "_div"), t.exportFunction(a + "_inverseMod"), a;
|
|
2337
|
-
},
|
|
2337
|
+
}, Wn = function(t, e, n, a, s, g, d) {
|
|
2338
2338
|
const C = t.addFunction(e);
|
|
2339
2339
|
C.addParam("base", "i32"), C.addParam("scalar", "i32"), C.addParam("scalarLength", "i32"), C.addParam("r", "i32"), C.addLocal("i", "i32"), C.addLocal("b", "i32");
|
|
2340
2340
|
const l = C.getCodeBuilder(), o = l.i32_const(t.alloc(n));
|
|
@@ -2382,8 +2382,8 @@ var jc = function(t, e, n) {
|
|
|
2382
2382
|
);
|
|
2383
2383
|
return E;
|
|
2384
2384
|
}
|
|
2385
|
-
},
|
|
2386
|
-
function
|
|
2385
|
+
}, Xn = Gc;
|
|
2386
|
+
function Gc(c, t) {
|
|
2387
2387
|
const e = c.modules[t].n64 * 8, n = c.addFunction(t + "_batchInverse");
|
|
2388
2388
|
n.addParam("pIn", "i32"), n.addParam("inStep", "i32"), n.addParam("n", "i32"), n.addParam("pOut", "i32"), n.addParam("outStep", "i32"), n.addLocal("itAux", "i32"), n.addLocal("itIn", "i32"), n.addLocal("itOut", "i32"), n.addLocal("i", "i32");
|
|
2389
2389
|
const a = n.getCodeBuilder(), s = a.i32_const(c.alloc(e));
|
|
@@ -2490,8 +2490,8 @@ function $c(c, t) {
|
|
|
2490
2490
|
)
|
|
2491
2491
|
);
|
|
2492
2492
|
}
|
|
2493
|
-
var
|
|
2494
|
-
function
|
|
2493
|
+
var pi = Zc;
|
|
2494
|
+
function Zc(c, t, e, n, a, s) {
|
|
2495
2495
|
typeof s > "u" && (n < a ? s = !0 : s = !1);
|
|
2496
2496
|
const g = c.addFunction(t);
|
|
2497
2497
|
g.addParam("pIn", "i32"), g.addParam("n", "i32"), g.addParam("pOut", "i32"), g.addLocal("i", "i32"), g.addLocal("itIn", "i32"), g.addLocal("itOut", "i32");
|
|
@@ -2546,8 +2546,8 @@ function Gc(c, t, e, n, a, s) {
|
|
|
2546
2546
|
))
|
|
2547
2547
|
);
|
|
2548
2548
|
}
|
|
2549
|
-
var
|
|
2550
|
-
function
|
|
2549
|
+
var Wc = Xc;
|
|
2550
|
+
function Xc(c, t, e, n, a, s) {
|
|
2551
2551
|
typeof s > "u" && (n < a ? s = !0 : s = !1);
|
|
2552
2552
|
const g = c.addFunction(t);
|
|
2553
2553
|
g.addParam("pIn1", "i32"), g.addParam("pIn2", "i32"), g.addParam("n", "i32"), g.addParam("pOut", "i32"), g.addLocal("i", "i32"), g.addLocal("itIn1", "i32"), g.addLocal("itIn2", "i32"), g.addLocal("itOut", "i32");
|
|
@@ -2619,25 +2619,25 @@ function Wc(c, t, e, n, a, s) {
|
|
|
2619
2619
|
);
|
|
2620
2620
|
}
|
|
2621
2621
|
var re = {};
|
|
2622
|
-
function
|
|
2622
|
+
function hi(c, t) {
|
|
2623
2623
|
return c === t ? 0 : c > t ? 1 : -1;
|
|
2624
2624
|
}
|
|
2625
|
-
function
|
|
2625
|
+
function Vn(c) {
|
|
2626
2626
|
return c * c;
|
|
2627
2627
|
}
|
|
2628
|
-
function
|
|
2628
|
+
function Li(c) {
|
|
2629
2629
|
return c % 2n !== 0n;
|
|
2630
2630
|
}
|
|
2631
|
-
function
|
|
2631
|
+
function Hn(c) {
|
|
2632
2632
|
return c % 2n === 0n;
|
|
2633
2633
|
}
|
|
2634
2634
|
function rn(c) {
|
|
2635
2635
|
return c < 0n;
|
|
2636
2636
|
}
|
|
2637
|
-
function
|
|
2637
|
+
function Vc(c) {
|
|
2638
2638
|
return c > 0n;
|
|
2639
2639
|
}
|
|
2640
|
-
function
|
|
2640
|
+
function mi(c) {
|
|
2641
2641
|
return rn(c) ? c.toString(2).length - 1 : c.toString(2).length;
|
|
2642
2642
|
}
|
|
2643
2643
|
function Ve(c) {
|
|
@@ -2646,52 +2646,52 @@ function Ve(c) {
|
|
|
2646
2646
|
function Oe(c) {
|
|
2647
2647
|
return Ve(c) === 1n;
|
|
2648
2648
|
}
|
|
2649
|
-
function
|
|
2649
|
+
function bi(c, t) {
|
|
2650
2650
|
for (var e = 0n, n = 1n, a = t, s = Ve(c), g, d, C; s !== 0n; )
|
|
2651
2651
|
g = a / s, d = e, C = a, e = n, a = s, n = d - g * n, s = C - g * s;
|
|
2652
2652
|
if (!Oe(a))
|
|
2653
2653
|
throw new Error(c.toString() + " and " + t.toString() + " are not co-prime");
|
|
2654
|
-
return
|
|
2654
|
+
return hi(e, 0n) === -1 && (e = e + t), rn(c) ? -e : e;
|
|
2655
2655
|
}
|
|
2656
|
-
function
|
|
2656
|
+
function yi(c, t, e) {
|
|
2657
2657
|
if (e === 0n)
|
|
2658
2658
|
throw new Error("Cannot take modPow with modulus 0");
|
|
2659
2659
|
var n = 1n, a = c % e;
|
|
2660
|
-
for (rn(t) && (t = t * -1n, a =
|
|
2660
|
+
for (rn(t) && (t = t * -1n, a = bi(a, e)); Vc(t); ) {
|
|
2661
2661
|
if (a === 0n)
|
|
2662
2662
|
return 0n;
|
|
2663
|
-
|
|
2663
|
+
Li(t) && (n = n * a % e), t = t / 2n, a = Vn(a) % e;
|
|
2664
2664
|
}
|
|
2665
2665
|
return n;
|
|
2666
2666
|
}
|
|
2667
|
-
function
|
|
2667
|
+
function Hc(c, t) {
|
|
2668
2668
|
return c = c >= 0n ? c : -c, t = t >= 0n ? t : -t, c === t ? 0 : c > t ? 1 : -1;
|
|
2669
2669
|
}
|
|
2670
|
-
function
|
|
2671
|
-
return t === 0n ? !1 : Oe(t) ? !0 :
|
|
2670
|
+
function ga(c, t) {
|
|
2671
|
+
return t === 0n ? !1 : Oe(t) ? !0 : Hc(t, 2n) === 0 ? Hn(c) : c % t === 0n;
|
|
2672
2672
|
}
|
|
2673
|
-
function
|
|
2673
|
+
function Qc(c) {
|
|
2674
2674
|
var t = Ve(c);
|
|
2675
2675
|
if (Oe(t))
|
|
2676
2676
|
return !1;
|
|
2677
2677
|
if (t === 2n || t === 3n || t === 5n)
|
|
2678
2678
|
return !0;
|
|
2679
|
-
if (
|
|
2679
|
+
if (Hn(t) || ga(t, 3n) || ga(t, 5n))
|
|
2680
2680
|
return !1;
|
|
2681
2681
|
if (t < 49n)
|
|
2682
2682
|
return !0;
|
|
2683
2683
|
}
|
|
2684
|
-
function
|
|
2684
|
+
function Jc(c) {
|
|
2685
2685
|
return c - 1n;
|
|
2686
2686
|
}
|
|
2687
|
-
function
|
|
2688
|
-
for (var e =
|
|
2687
|
+
function pa(c, t) {
|
|
2688
|
+
for (var e = Jc(c), n = e, a = 0, s, g, d; Hn(n); )
|
|
2689
2689
|
n = n / 2n, a++;
|
|
2690
2690
|
t:
|
|
2691
2691
|
for (g = 0; g < t.length; g++)
|
|
2692
|
-
if (!(c < t[g]) && (d =
|
|
2692
|
+
if (!(c < t[g]) && (d = yi(BigInt(t[g]), n, c), !(Oe(d) || d === e))) {
|
|
2693
2693
|
for (s = a - 1; s != 0; s--) {
|
|
2694
|
-
if (d =
|
|
2694
|
+
if (d = Vn(d) % c, Oe(d))
|
|
2695
2695
|
return !1;
|
|
2696
2696
|
if (d === e)
|
|
2697
2697
|
continue t;
|
|
@@ -2700,33 +2700,33 @@ function ga(c, t) {
|
|
|
2700
2700
|
}
|
|
2701
2701
|
return !0;
|
|
2702
2702
|
}
|
|
2703
|
-
function
|
|
2704
|
-
var t =
|
|
2703
|
+
function Kc(c) {
|
|
2704
|
+
var t = Qc(c);
|
|
2705
2705
|
if (t !== void 0)
|
|
2706
2706
|
return t;
|
|
2707
|
-
var e = Ve(c), n =
|
|
2707
|
+
var e = Ve(c), n = mi(e);
|
|
2708
2708
|
if (n <= 64)
|
|
2709
|
-
return
|
|
2709
|
+
return pa(e, [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37]);
|
|
2710
2710
|
for (var a = Math.log(2) * Number(n), s = Math.ceil(a), g = [], d = 0; d < s; d++)
|
|
2711
2711
|
g.push(BigInt(d + 2));
|
|
2712
|
-
return
|
|
2712
|
+
return pa(e, g);
|
|
2713
2713
|
}
|
|
2714
|
-
re.bitLength =
|
|
2715
|
-
re.isOdd =
|
|
2714
|
+
re.bitLength = mi;
|
|
2715
|
+
re.isOdd = Li;
|
|
2716
2716
|
re.isNegative = rn;
|
|
2717
2717
|
re.abs = Ve;
|
|
2718
2718
|
re.isUnit = Oe;
|
|
2719
|
-
re.compare =
|
|
2720
|
-
re.modInv =
|
|
2721
|
-
re.modPow =
|
|
2722
|
-
re.isPrime =
|
|
2723
|
-
re.square =
|
|
2724
|
-
const
|
|
2725
|
-
var
|
|
2726
|
-
const s = BigInt(e), g = Math.floor((
|
|
2719
|
+
re.compare = hi;
|
|
2720
|
+
re.modInv = bi;
|
|
2721
|
+
re.modPow = yi;
|
|
2722
|
+
re.isPrime = Kc;
|
|
2723
|
+
re.square = Vn;
|
|
2724
|
+
const Yc = $c, ge = be, ts = Wn, es = Xn, pn = pi, hn = Wc, { bitLength: ns, modInv: Ln, modPow: ha, isPrime: La, isOdd: as, square: is } = re;
|
|
2725
|
+
var Qn = function(t, e, n, a) {
|
|
2726
|
+
const s = BigInt(e), g = Math.floor((ns(s - 1n) - 1) / 64) + 1, d = g * 2, C = g * 8, l = n || "f1m";
|
|
2727
2727
|
if (t.modules[l])
|
|
2728
2728
|
return l;
|
|
2729
|
-
const o =
|
|
2729
|
+
const o = Yc(t, g, a), y = t.alloc(C, ge.bigInt2BytesLE(s, C)), E = t.alloc(ge.bigInt2BytesLE(is(1n << BigInt(g * 64)) % s, C)), m = t.alloc(ge.bigInt2BytesLE((1n << BigInt(g * 64)) % s, C)), x = t.alloc(ge.bigInt2BytesLE(0n, C)), O = s - 1n, L = O >> 1n, I = t.alloc(C, ge.bigInt2BytesLE(L, C)), v = L + 1n, U = t.alloc(C, ge.bigInt2BytesLE(v, C));
|
|
2730
2730
|
t.modules[l] = {
|
|
2731
2731
|
pq: y,
|
|
2732
2732
|
pR2: E,
|
|
@@ -3249,13 +3249,13 @@ var Hn = function(t, e, n, a) {
|
|
|
3249
3249
|
z.addCode(b.call(l + "_fromMontgomery", b.getLocal("x"), b.getLocal("r"))), z.addCode(b.call(o + "_inverseMod", b.getLocal("r"), b.i32_const(y), b.getLocal("r"))), z.addCode(b.call(l + "_toMontgomery", b.getLocal("r"), b.getLocal("r")));
|
|
3250
3250
|
}
|
|
3251
3251
|
let nt = 2n;
|
|
3252
|
-
if (
|
|
3253
|
-
for (;
|
|
3252
|
+
if (La(s))
|
|
3253
|
+
for (; ha(nt, L, s) !== O; )
|
|
3254
3254
|
nt = nt + 1n;
|
|
3255
3255
|
let J = 0, ft = O;
|
|
3256
|
-
for (; !
|
|
3256
|
+
for (; !as(ft) && ft !== 0n; )
|
|
3257
3257
|
J++, ft = ft >> 1n;
|
|
3258
|
-
const at = t.alloc(C, ge.bigInt2BytesLE(ft, C)), _t =
|
|
3258
|
+
const at = t.alloc(C, ge.bigInt2BytesLE(ft, C)), _t = ha(nt, ft, s), zt = t.alloc(ge.bigInt2BytesLE((_t << BigInt(g * 64)) % s, C)), G = ft + 1n >> 1n, K = t.alloc(C, ge.bigInt2BytesLE(G, C));
|
|
3259
3259
|
function P() {
|
|
3260
3260
|
const z = t.addFunction(l + "_sqrt");
|
|
3261
3261
|
z.addParam("n", "i32"), z.addParam("r", "i32"), z.addLocal("m", "i32"), z.addLocal("i", "i32"), z.addLocal("j", "i32");
|
|
@@ -3379,7 +3379,7 @@ var Hn = function(t, e, n, a) {
|
|
|
3379
3379
|
b.ret(b.call(o + "_eq", b.getLocal("x"), b.i32_const(m)))
|
|
3380
3380
|
);
|
|
3381
3381
|
}
|
|
3382
|
-
return t.exportFunction(o + "_copy", l + "_copy"), t.exportFunction(o + "_zero", l + "_zero"), t.exportFunction(o + "_isZero", l + "_isZero"), t.exportFunction(o + "_eq", l + "_eq"), W(), S(), F(), r(), j(), T(), D(), A(), M(), H(), h(), R(), ut(), w(), q(), u(),
|
|
3382
|
+
return t.exportFunction(o + "_copy", l + "_copy"), t.exportFunction(o + "_zero", l + "_zero"), t.exportFunction(o + "_isZero", l + "_isZero"), t.exportFunction(o + "_eq", l + "_eq"), W(), S(), F(), r(), j(), T(), D(), A(), M(), H(), h(), R(), ut(), w(), q(), u(), es(t, l), pn(t, l + "_batchToMontgomery", l + "_toMontgomery", C, C), pn(t, l + "_batchFromMontgomery", l + "_fromMontgomery", C, C), pn(t, l + "_batchNeg", l + "_neg", C, C), hn(t, l + "_batchAdd", l + "_add", C, C), hn(t, l + "_batchSub", l + "_sub", C, C), hn(t, l + "_batchMul", l + "_mul", C, C), t.exportFunction(l + "_add"), t.exportFunction(l + "_sub"), t.exportFunction(l + "_neg"), t.exportFunction(l + "_isNegative"), t.exportFunction(l + "_isOne"), t.exportFunction(l + "_sign"), t.exportFunction(l + "_mReduct"), t.exportFunction(l + "_mul"), t.exportFunction(l + "_square"), t.exportFunction(l + "_squareOld"), t.exportFunction(l + "_fromMontgomery"), t.exportFunction(l + "_toMontgomery"), t.exportFunction(l + "_inverse"), t.exportFunction(l + "_one"), t.exportFunction(l + "_load"), t.exportFunction(l + "_timesScalar"), ts(
|
|
3383
3383
|
t,
|
|
3384
3384
|
l + "_exp",
|
|
3385
3385
|
C,
|
|
@@ -3387,17 +3387,17 @@ var Hn = function(t, e, n, a) {
|
|
|
3387
3387
|
l + "_square",
|
|
3388
3388
|
o + "_copy",
|
|
3389
3389
|
l + "_one"
|
|
3390
|
-
), t.exportFunction(l + "_exp"), t.exportFunction(l + "_batchInverse"),
|
|
3390
|
+
), t.exportFunction(l + "_exp"), t.exportFunction(l + "_batchInverse"), La(s) && (P(), i(), t.exportFunction(l + "_sqrt"), t.exportFunction(l + "_isSquare")), t.exportFunction(l + "_batchToMontgomery"), t.exportFunction(l + "_batchFromMontgomery"), l;
|
|
3391
3391
|
};
|
|
3392
|
-
const
|
|
3393
|
-
var
|
|
3394
|
-
const g = BigInt(e), d = Math.floor((
|
|
3392
|
+
const os = Qn, { bitLength: cs } = re;
|
|
3393
|
+
var Ci = function(t, e, n, a, s) {
|
|
3394
|
+
const g = BigInt(e), d = Math.floor((cs(g - 1n) - 1) / 64) + 1, C = d * 8, l = n || "f1";
|
|
3395
3395
|
if (t.modules[l])
|
|
3396
3396
|
return l;
|
|
3397
3397
|
t.modules[l] = {
|
|
3398
3398
|
n64: d
|
|
3399
3399
|
};
|
|
3400
|
-
const o = s || "int", y =
|
|
3400
|
+
const o = s || "int", y = os(t, g, a, o), E = t.modules[y].pR2, m = t.modules[y].pq, x = t.modules[y].pePlusOne;
|
|
3401
3401
|
function O() {
|
|
3402
3402
|
const U = t.alloc(C), w = t.addFunction(l + "_mul");
|
|
3403
3403
|
w.addParam("x", "i32"), w.addParam("y", "i32"), w.addParam("r", "i32");
|
|
@@ -3426,8 +3426,8 @@ var yi = function(t, e, n, a, s) {
|
|
|
3426
3426
|
}
|
|
3427
3427
|
return O(), L(), I(), v(), t.exportFunction(y + "_add", l + "_add"), t.exportFunction(y + "_sub", l + "_sub"), t.exportFunction(y + "_neg", l + "_neg"), t.exportFunction(l + "_mul"), t.exportFunction(l + "_square"), t.exportFunction(l + "_inverse"), t.exportFunction(l + "_isNegative"), t.exportFunction(y + "_copy", l + "_copy"), t.exportFunction(y + "_zero", l + "_zero"), t.exportFunction(y + "_one", l + "_one"), t.exportFunction(y + "_isZero", l + "_isZero"), t.exportFunction(y + "_eq", l + "_eq"), l;
|
|
3428
3428
|
};
|
|
3429
|
-
const
|
|
3430
|
-
var
|
|
3429
|
+
const ss = Wn, rs = Xn, mn = be;
|
|
3430
|
+
var Ai = function(t, e, n, a) {
|
|
3431
3431
|
if (t.modules[n])
|
|
3432
3432
|
return n;
|
|
3433
3433
|
const s = t.modules[a].n64 * 8, g = t.modules[a].q;
|
|
@@ -3723,7 +3723,7 @@ var Ci = function(t, e, n, a) {
|
|
|
3723
3723
|
A.ret(A.i32_const(1))
|
|
3724
3724
|
);
|
|
3725
3725
|
}
|
|
3726
|
-
return F(), R(), U(), w(), v(), m(), x(), O(), d(), l(), o(), y(), L(), I(), S(), r(), C(), h(), E(), t.exportFunction(n + "_isZero"), t.exportFunction(n + "_isOne"), t.exportFunction(n + "_zero"), t.exportFunction(n + "_one"), t.exportFunction(n + "_copy"), t.exportFunction(n + "_mul"), t.exportFunction(n + "_mul1"), t.exportFunction(n + "_square"), t.exportFunction(n + "_add"), t.exportFunction(n + "_sub"), t.exportFunction(n + "_neg"), t.exportFunction(n + "_sign"), t.exportFunction(n + "_conjugate"), t.exportFunction(n + "_fromMontgomery"), t.exportFunction(n + "_toMontgomery"), t.exportFunction(n + "_eq"), t.exportFunction(n + "_inverse"),
|
|
3726
|
+
return F(), R(), U(), w(), v(), m(), x(), O(), d(), l(), o(), y(), L(), I(), S(), r(), C(), h(), E(), t.exportFunction(n + "_isZero"), t.exportFunction(n + "_isOne"), t.exportFunction(n + "_zero"), t.exportFunction(n + "_one"), t.exportFunction(n + "_copy"), t.exportFunction(n + "_mul"), t.exportFunction(n + "_mul1"), t.exportFunction(n + "_square"), t.exportFunction(n + "_add"), t.exportFunction(n + "_sub"), t.exportFunction(n + "_neg"), t.exportFunction(n + "_sign"), t.exportFunction(n + "_conjugate"), t.exportFunction(n + "_fromMontgomery"), t.exportFunction(n + "_toMontgomery"), t.exportFunction(n + "_eq"), t.exportFunction(n + "_inverse"), rs(t, n), ss(
|
|
3727
3727
|
t,
|
|
3728
3728
|
n + "_exp",
|
|
3729
3729
|
s * 2,
|
|
@@ -3733,8 +3733,8 @@ var Ci = function(t, e, n, a) {
|
|
|
3733
3733
|
n + "_one"
|
|
3734
3734
|
), j(), T(), t.exportFunction(n + "_exp"), t.exportFunction(n + "_timesScalar"), t.exportFunction(n + "_batchInverse"), t.exportFunction(n + "_sqrt"), t.exportFunction(n + "_isSquare"), t.exportFunction(n + "_isNegative"), n;
|
|
3735
3735
|
};
|
|
3736
|
-
const
|
|
3737
|
-
var
|
|
3736
|
+
const ls = Wn, us = Xn;
|
|
3737
|
+
var Fi = function(t, e, n, a) {
|
|
3738
3738
|
if (t.modules[n])
|
|
3739
3739
|
return n;
|
|
3740
3740
|
const s = t.modules[a].n64 * 8;
|
|
@@ -3991,7 +3991,7 @@ var Ai = function(t, e, n, a) {
|
|
|
3991
3991
|
)
|
|
3992
3992
|
);
|
|
3993
3993
|
}
|
|
3994
|
-
return U(), F(), L(), I(), O(), y(), E(), g(), C(), l(), S(), m(), x(), v(), w(), d(), o(), t.exportFunction(n + "_isZero"), t.exportFunction(n + "_isOne"), t.exportFunction(n + "_zero"), t.exportFunction(n + "_one"), t.exportFunction(n + "_copy"), t.exportFunction(n + "_mul"), t.exportFunction(n + "_square"), t.exportFunction(n + "_add"), t.exportFunction(n + "_sub"), t.exportFunction(n + "_neg"), t.exportFunction(n + "_sign"), t.exportFunction(n + "_fromMontgomery"), t.exportFunction(n + "_toMontgomery"), t.exportFunction(n + "_eq"), t.exportFunction(n + "_inverse"),
|
|
3994
|
+
return U(), F(), L(), I(), O(), y(), E(), g(), C(), l(), S(), m(), x(), v(), w(), d(), o(), t.exportFunction(n + "_isZero"), t.exportFunction(n + "_isOne"), t.exportFunction(n + "_zero"), t.exportFunction(n + "_one"), t.exportFunction(n + "_copy"), t.exportFunction(n + "_mul"), t.exportFunction(n + "_square"), t.exportFunction(n + "_add"), t.exportFunction(n + "_sub"), t.exportFunction(n + "_neg"), t.exportFunction(n + "_sign"), t.exportFunction(n + "_fromMontgomery"), t.exportFunction(n + "_toMontgomery"), t.exportFunction(n + "_eq"), t.exportFunction(n + "_inverse"), us(t, n), ls(
|
|
3995
3995
|
t,
|
|
3996
3996
|
n + "_exp",
|
|
3997
3997
|
s * 3,
|
|
@@ -4000,7 +4000,7 @@ var Ai = function(t, e, n, a) {
|
|
|
4000
4000
|
n + "_copy",
|
|
4001
4001
|
n + "_one"
|
|
4002
4002
|
), t.exportFunction(n + "_exp"), t.exportFunction(n + "_timesScalar"), t.exportFunction(n + "_batchInverse"), t.exportFunction(n + "_isNegative"), n;
|
|
4003
|
-
},
|
|
4003
|
+
}, ds = function(t, e, n, a, s, g, d, C) {
|
|
4004
4004
|
const l = t.addFunction(e);
|
|
4005
4005
|
l.addParam("base", "i32"), l.addParam("scalar", "i32"), l.addParam("scalarLength", "i32"), l.addParam("r", "i32"), l.addLocal("old0", "i32"), l.addLocal("nbits", "i32"), l.addLocal("i", "i32"), l.addLocal("last", "i32"), l.addLocal("cur", "i32"), l.addLocal("carry", "i32"), l.addLocal("p", "i32");
|
|
4006
4006
|
const o = l.getCodeBuilder(), y = o.i32_const(t.alloc(n));
|
|
@@ -4183,7 +4183,7 @@ var Ai = function(t, e, n, a) {
|
|
|
4183
4183
|
)),
|
|
4184
4184
|
o.i32_store(o.i32_const(0), o.getLocal("old0"))
|
|
4185
4185
|
);
|
|
4186
|
-
},
|
|
4186
|
+
}, fs = function(t, e, n, a, s) {
|
|
4187
4187
|
const d = t.modules[e].n64 * 8;
|
|
4188
4188
|
function C() {
|
|
4189
4189
|
const E = t.addFunction(n + "_getChunk");
|
|
@@ -4575,8 +4575,8 @@ var Ai = function(t, e, n, a) {
|
|
|
4575
4575
|
}
|
|
4576
4576
|
C(), y(), l(), o(), t.exportFunction(n), t.exportFunction(n + "_chunk");
|
|
4577
4577
|
};
|
|
4578
|
-
const
|
|
4579
|
-
var
|
|
4578
|
+
const ma = ds, qe = pi, ba = fs;
|
|
4579
|
+
var Ei = function(t, e, n, a) {
|
|
4580
4580
|
const s = t.modules[n].n64, g = s * 8;
|
|
4581
4581
|
if (t.modules[e])
|
|
4582
4582
|
return e;
|
|
@@ -5474,7 +5474,7 @@ var Fi = function(t, e, n, a) {
|
|
|
5474
5474
|
)
|
|
5475
5475
|
);
|
|
5476
5476
|
}
|
|
5477
|
-
return C(), d(), E(), y(), o(), l(), ut(), I(), x(), m(), L(), O(), h(), r(), F(), j(), R(), A(), D(), T(), S(), w(), U(), v(), H(), G(), K(), nt(), M(), J(), at(), ft(), _t(), zt(), qe(t, e + "_batchLEMtoU", e + "_LEMtoU", g * 2, g * 2), qe(t, e + "_batchLEMtoC", e + "_LEMtoC", g * 2, g), qe(t, e + "_batchUtoLEM", e + "_UtoLEM", g * 2, g * 2), qe(t, e + "_batchCtoLEM", e + "_CtoLEM", g, g * 2, !0), qe(t, e + "_batchToJacobian", e + "_toJacobian", g * 2, g * 3, !0),
|
|
5477
|
+
return C(), d(), E(), y(), o(), l(), ut(), I(), x(), m(), L(), O(), h(), r(), F(), j(), R(), A(), D(), T(), S(), w(), U(), v(), H(), G(), K(), nt(), M(), J(), at(), ft(), _t(), zt(), qe(t, e + "_batchLEMtoU", e + "_LEMtoU", g * 2, g * 2), qe(t, e + "_batchLEMtoC", e + "_LEMtoC", g * 2, g), qe(t, e + "_batchUtoLEM", e + "_UtoLEM", g * 2, g * 2), qe(t, e + "_batchCtoLEM", e + "_CtoLEM", g, g * 2, !0), qe(t, e + "_batchToJacobian", e + "_toJacobian", g * 2, g * 3, !0), ba(t, e, e + "_multiexp", e + "_add", g * 3), ba(t, e, e + "_multiexpAffine", e + "_addMixed", g * 2), ma(
|
|
5478
5478
|
t,
|
|
5479
5479
|
e + "_timesScalar",
|
|
5480
5480
|
g * 3,
|
|
@@ -5483,7 +5483,7 @@ var Fi = function(t, e, n, a) {
|
|
|
5483
5483
|
e + "_sub",
|
|
5484
5484
|
e + "_copy",
|
|
5485
5485
|
e + "_zero"
|
|
5486
|
-
),
|
|
5486
|
+
), ma(
|
|
5487
5487
|
t,
|
|
5488
5488
|
e + "_timesScalarAffine",
|
|
5489
5489
|
g * 2,
|
|
@@ -5494,11 +5494,11 @@ var Fi = function(t, e, n, a) {
|
|
|
5494
5494
|
e + "_zero"
|
|
5495
5495
|
), t.exportFunction(e + "_isZero"), t.exportFunction(e + "_isZeroAffine"), t.exportFunction(e + "_eq"), t.exportFunction(e + "_eqMixed"), t.exportFunction(e + "_eqAffine"), t.exportFunction(e + "_copy"), t.exportFunction(e + "_copyAffine"), t.exportFunction(e + "_zero"), t.exportFunction(e + "_zeroAffine"), t.exportFunction(e + "_double"), t.exportFunction(e + "_doubleAffine"), t.exportFunction(e + "_add"), t.exportFunction(e + "_addMixed"), t.exportFunction(e + "_addAffine"), t.exportFunction(e + "_neg"), t.exportFunction(e + "_negAffine"), t.exportFunction(e + "_sub"), t.exportFunction(e + "_subMixed"), t.exportFunction(e + "_subAffine"), t.exportFunction(e + "_fromMontgomery"), t.exportFunction(e + "_fromMontgomeryAffine"), t.exportFunction(e + "_toMontgomery"), t.exportFunction(e + "_toMontgomeryAffine"), t.exportFunction(e + "_timesScalar"), t.exportFunction(e + "_timesScalarAffine"), t.exportFunction(e + "_normalize"), t.exportFunction(e + "_LEMtoU"), t.exportFunction(e + "_LEMtoC"), t.exportFunction(e + "_UtoLEM"), t.exportFunction(e + "_CtoLEM"), t.exportFunction(e + "_batchLEMtoU"), t.exportFunction(e + "_batchLEMtoC"), t.exportFunction(e + "_batchUtoLEM"), t.exportFunction(e + "_batchCtoLEM"), t.exportFunction(e + "_toAffine"), t.exportFunction(e + "_toJacobian"), t.exportFunction(e + "_batchToAffine"), t.exportFunction(e + "_batchToJacobian"), t.exportFunction(e + "_inCurve"), t.exportFunction(e + "_inCurveAffine"), e;
|
|
5496
5496
|
};
|
|
5497
|
-
const { isOdd:
|
|
5498
|
-
var
|
|
5497
|
+
const { isOdd: _s, modInv: ya, modPow: De } = re, Je = be;
|
|
5498
|
+
var wi = function(t, e, n, a, s) {
|
|
5499
5499
|
const d = t.modules[a].n64 * 8, l = t.modules[n].n64 * 8, o = t.modules[a].q;
|
|
5500
5500
|
let y = o - 1n, E = 0;
|
|
5501
|
-
for (; !
|
|
5501
|
+
for (; !_s(y); )
|
|
5502
5502
|
E++, y = y >> 1n;
|
|
5503
5503
|
let m = 2n;
|
|
5504
5504
|
for (; De(m, o >> 1n, o) === 1n; )
|
|
@@ -5519,12 +5519,12 @@ var Ei = function(t, e, n, a, s) {
|
|
|
5519
5519
|
U[q] = U[q - 1] * 2n;
|
|
5520
5520
|
const w = [];
|
|
5521
5521
|
for (let q = 0; q <= E; q++) {
|
|
5522
|
-
const u =
|
|
5522
|
+
const u = ya(U[q], o) * I % o;
|
|
5523
5523
|
w.push(...Je.bigInt2BytesLE(u, d));
|
|
5524
5524
|
}
|
|
5525
5525
|
const S = t.alloc(w), F = De(m, 2n, o), r = [], h = [];
|
|
5526
5526
|
for (let q = 0; q <= E; q++) {
|
|
5527
|
-
const u = De(F, 2n ** BigInt(q), o), W =
|
|
5527
|
+
const u = De(F, 2n ** BigInt(q), o), W = ya(o + 1n - u, o);
|
|
5528
5528
|
r.push(...Je.bigInt2BytesLE(u * I % o, d)), h.push(...Je.bigInt2BytesLE(W * I % o, d));
|
|
5529
5529
|
}
|
|
5530
5530
|
const R = t.alloc(r), j = t.alloc(h);
|
|
@@ -6517,7 +6517,7 @@ var Ei = function(t, e, n, a, s) {
|
|
|
6517
6517
|
);
|
|
6518
6518
|
}
|
|
6519
6519
|
at(), ft(), J(), nt(), M(), H(), ut(), _t(), zt(), G(), P(), i(), K(), t.exportFunction(e + "_fft"), t.exportFunction(e + "_ifft"), t.exportFunction(e + "_rawfft"), t.exportFunction(e + "_fftJoin"), t.exportFunction(e + "_fftJoinExt"), t.exportFunction(e + "_fftJoinExtInv"), t.exportFunction(e + "_fftMix"), t.exportFunction(e + "_fftFinal"), t.exportFunction(e + "_prepareLagrangeEvaluation");
|
|
6520
|
-
},
|
|
6520
|
+
}, Bi = function(t, e, n) {
|
|
6521
6521
|
const s = t.modules[n].n64 * 8;
|
|
6522
6522
|
function g() {
|
|
6523
6523
|
const C = t.addFunction(e + "_zero");
|
|
@@ -6610,7 +6610,7 @@ var Ei = function(t, e, n, a, s) {
|
|
|
6610
6610
|
);
|
|
6611
6611
|
}
|
|
6612
6612
|
return g(), d(), t.exportFunction(e + "_zero"), t.exportFunction(e + "_constructLC"), e;
|
|
6613
|
-
},
|
|
6613
|
+
}, vi = function(t, e, n) {
|
|
6614
6614
|
const s = t.modules[n].n64 * 8;
|
|
6615
6615
|
function g() {
|
|
6616
6616
|
const l = t.addFunction(e + "_buildABC");
|
|
@@ -6880,7 +6880,7 @@ var Ei = function(t, e, n, a, s) {
|
|
|
6880
6880
|
);
|
|
6881
6881
|
}
|
|
6882
6882
|
return g(), d(), C(), t.exportFunction(e + "_buildABC"), t.exportFunction(e + "_joinABC"), t.exportFunction(e + "_batchAdd"), e;
|
|
6883
|
-
},
|
|
6883
|
+
}, xi = function(t, e, n, a, s, g, d, C) {
|
|
6884
6884
|
const l = t.addFunction(e);
|
|
6885
6885
|
l.addParam("pIn", "i32"), l.addParam("n", "i32"), l.addParam("pFirst", "i32"), l.addParam("pInc", "i32"), l.addParam("pOut", "i32"), l.addLocal("pOldFree", "i32"), l.addLocal("i", "i32"), l.addLocal("pFrom", "i32"), l.addLocal("pTo", "i32");
|
|
6886
6886
|
const o = l.getCodeBuilder(), y = o.i32_const(t.alloc(d));
|
|
@@ -6917,19 +6917,19 @@ var Ei = function(t, e, n, a, s) {
|
|
|
6917
6917
|
))
|
|
6918
6918
|
), t.exportFunction(e);
|
|
6919
6919
|
};
|
|
6920
|
-
const Nt = be,
|
|
6921
|
-
var
|
|
6920
|
+
const Nt = be, gs = Qn, ps = Ci, Ca = Ai, hs = Fi, Aa = Ei, bn = wi, Ls = Bi, ms = vi, Me = xi, { bitLength: bs, modInv: ys, isOdd: Fa, isNegative: Cs } = re;
|
|
6921
|
+
var As = function(t, e) {
|
|
6922
6922
|
const n = e || "bn128";
|
|
6923
6923
|
if (t.modules[n])
|
|
6924
6924
|
return n;
|
|
6925
|
-
const a = 21888242871839275222246405745257275088696311157297823662689037894645226208583n, s = 21888242871839275222246405745257275088548364400416034343698204186575808495617n, g = Math.floor((
|
|
6926
|
-
|
|
6927
|
-
const x = t.alloc(Nt.bigInt2BytesLE(w(3n), l)), O =
|
|
6928
|
-
bn(t, "frm", "frm", "frm", "frm_mul"),
|
|
6929
|
-
const L =
|
|
6925
|
+
const a = 21888242871839275222246405745257275088696311157297823662689037894645226208583n, s = 21888242871839275222246405745257275088548364400416034343698204186575808495617n, g = Math.floor((bs(a - 1n) - 1) / 64) + 1, d = g * 8, C = d, l = d, o = l * 2, y = l * 12, E = t.alloc(Nt.bigInt2BytesLE(s, C)), m = gs(t, a, "f1m");
|
|
6926
|
+
ps(t, s, "fr", "frm");
|
|
6927
|
+
const x = t.alloc(Nt.bigInt2BytesLE(w(3n), l)), O = Aa(t, "g1m", "f1m", x);
|
|
6928
|
+
bn(t, "frm", "frm", "frm", "frm_mul"), Ls(t, "pol", "frm"), ms(t, "qap", "frm");
|
|
6929
|
+
const L = Ca(t, "f1m_neg", "f2m", "f1m"), I = t.alloc([
|
|
6930
6930
|
...Nt.bigInt2BytesLE(w(19485874751759354771024239261021720505790618469301721065564631296452457478373n), l),
|
|
6931
6931
|
...Nt.bigInt2BytesLE(w(266929791119991161246907387137283842545076965332900288569378510910307636690n), l)
|
|
6932
|
-
]), v =
|
|
6932
|
+
]), v = Aa(t, "g2m", "f2m", I);
|
|
6933
6933
|
function U(Y, f) {
|
|
6934
6934
|
const _ = t.addFunction(Y);
|
|
6935
6935
|
_.addParam("pG", "i32"), _.addParam("pFr", "i32"), _.addParam("pr", "i32");
|
|
@@ -7030,7 +7030,7 @@ var Cs = function(t, e) {
|
|
|
7030
7030
|
...Nt.bigInt2BytesLE(w(9), l),
|
|
7031
7031
|
...Nt.bigInt2BytesLE(w(1), l)
|
|
7032
7032
|
]), H = t.alloc([
|
|
7033
|
-
...Nt.bigInt2BytesLE(w(
|
|
7033
|
+
...Nt.bigInt2BytesLE(w(ys(2n, a)), l),
|
|
7034
7034
|
...Nt.bigInt2BytesLE(0n, l)
|
|
7035
7035
|
]), ut = M, nt = t.alloc([
|
|
7036
7036
|
...Nt.bigInt2BytesLE(w(19485874751759354771024239261021720505790618469301721065564631296452457478373n), l),
|
|
@@ -7050,7 +7050,7 @@ var Cs = function(t, e) {
|
|
|
7050
7050
|
);
|
|
7051
7051
|
}
|
|
7052
7052
|
J();
|
|
7053
|
-
const ft =
|
|
7053
|
+
const ft = hs(t, n + "_mulNR6", "f6m", "f2m");
|
|
7054
7054
|
function at() {
|
|
7055
7055
|
const Y = t.addFunction(n + "_mulNR12");
|
|
7056
7056
|
Y.addParam("x", "i32"), Y.addParam("pr", "i32");
|
|
@@ -7075,7 +7075,7 @@ var Cs = function(t, e) {
|
|
|
7075
7075
|
);
|
|
7076
7076
|
}
|
|
7077
7077
|
at();
|
|
7078
|
-
const _t =
|
|
7078
|
+
const _t = Ca(t, n + "_mulNR12", "ftm", ft), G = At(29793968203157093288n), K = t.alloc(G), P = 3 * o, i = G.length - 1, u = G.reduce((Y, f) => Y + (f != 0 ? 1 : 0), 0) + i + 1, W = 3 * 2 * d, z = 3 * d * 2 + u * P;
|
|
7079
7079
|
t.modules[n] = {
|
|
7080
7080
|
n64: g,
|
|
7081
7081
|
pG1gen: F,
|
|
@@ -7097,7 +7097,7 @@ var Cs = function(t, e) {
|
|
|
7097
7097
|
let f = Y;
|
|
7098
7098
|
const _ = [];
|
|
7099
7099
|
for (; f > 0n; ) {
|
|
7100
|
-
if (
|
|
7100
|
+
if (Fa(f)) {
|
|
7101
7101
|
const Z = 2 - Number(f % 4n);
|
|
7102
7102
|
_.push(Z), f = f - BigInt(Z);
|
|
7103
7103
|
} else
|
|
@@ -7110,7 +7110,7 @@ var Cs = function(t, e) {
|
|
|
7110
7110
|
let f = Y;
|
|
7111
7111
|
const _ = [];
|
|
7112
7112
|
for (; f > 0n; )
|
|
7113
|
-
|
|
7113
|
+
Fa(f) ? _.push(1) : _.push(0), f = f >> 1n;
|
|
7114
7114
|
return _;
|
|
7115
7115
|
}
|
|
7116
7116
|
function Lt() {
|
|
@@ -7504,7 +7504,7 @@ var Cs = function(t, e) {
|
|
|
7504
7504
|
(ct * rt - st * ot) % a,
|
|
7505
7505
|
(ct * ot + st * rt) % a
|
|
7506
7506
|
];
|
|
7507
|
-
return
|
|
7507
|
+
return Cs(gt[0]) && (gt[0] = gt[0] + a), gt;
|
|
7508
7508
|
}
|
|
7509
7509
|
}
|
|
7510
7510
|
function $t() {
|
|
@@ -7737,19 +7737,19 @@ var Cs = function(t, e) {
|
|
|
7737
7737
|
Wt(Y), t.exportFunction(n + "_pairingEq" + Y);
|
|
7738
7738
|
wt(), t.exportFunction(n + "_pairing"), t.exportFunction(n + "_prepareG1"), t.exportFunction(n + "_prepareG2"), t.exportFunction(n + "_millerLoop"), t.exportFunction(n + "_finalExponentiation"), t.exportFunction(n + "_finalExponentiationOld"), t.exportFunction(n + "__mulBy024"), t.exportFunction(n + "__mulBy024Old"), t.exportFunction(n + "__cyclotomicSquare"), t.exportFunction(n + "__cyclotomicExp_w0");
|
|
7739
7739
|
};
|
|
7740
|
-
const Mt = be,
|
|
7741
|
-
var
|
|
7740
|
+
const Mt = be, Fs = Qn, Es = Ci, Ea = Ai, ws = Fi, wa = Ei, yn = wi, Bs = Bi, vs = vi, Re = xi, { bitLength: Ba, isOdd: va, isNegative: xs } = re;
|
|
7741
|
+
var Ss = function(t, e) {
|
|
7742
7742
|
const n = e || "bls12381";
|
|
7743
7743
|
if (t.modules[n])
|
|
7744
7744
|
return n;
|
|
7745
|
-
const a = 0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaabn, s = 0x73eda753299d7d483339d80809a1d80553bda402fffe5bfeffffffff00000001n, g = Math.floor((
|
|
7746
|
-
|
|
7747
|
-
const L = t.alloc(Mt.bigInt2BytesLE(F(4n), C)), I =
|
|
7748
|
-
yn(t, "frm", "frm", "frm", "frm_mul"),
|
|
7749
|
-
const v =
|
|
7745
|
+
const a = 0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaabn, s = 0x73eda753299d7d483339d80809a1d80553bda402fffe5bfeffffffff00000001n, g = Math.floor((Ba(a - 1n) - 1) / 64) + 1, d = g * 8, C = d, l = C * 2, o = C * 12, y = Math.floor((Ba(s - 1n) - 1) / 64) + 1, E = y * 8, m = E, x = t.alloc(Mt.bigInt2BytesLE(s, m)), O = Fs(t, a, "f1m", "intq");
|
|
7746
|
+
Es(t, s, "fr", "frm", "intr");
|
|
7747
|
+
const L = t.alloc(Mt.bigInt2BytesLE(F(4n), C)), I = wa(t, "g1m", "f1m", L);
|
|
7748
|
+
yn(t, "frm", "frm", "frm", "frm_mul"), Bs(t, "pol", "frm"), vs(t, "qap", "frm");
|
|
7749
|
+
const v = Ea(t, "f1m_neg", "f2m", "f1m"), U = t.alloc([
|
|
7750
7750
|
...Mt.bigInt2BytesLE(F(4n), C),
|
|
7751
7751
|
...Mt.bigInt2BytesLE(F(4n), C)
|
|
7752
|
-
]), w =
|
|
7752
|
+
]), w = wa(t, "g2m", "f2m", U);
|
|
7753
7753
|
function S(f, _) {
|
|
7754
7754
|
const Z = t.addFunction(f);
|
|
7755
7755
|
Z.addParam("pG", "i32"), Z.addParam("pFr", "i32"), Z.addParam("pr", "i32");
|
|
@@ -7861,7 +7861,7 @@ var xs = function(t, e) {
|
|
|
7861
7861
|
);
|
|
7862
7862
|
}
|
|
7863
7863
|
nt();
|
|
7864
|
-
const J =
|
|
7864
|
+
const J = ws(t, v + "_mulNR", "f6m", "f2m");
|
|
7865
7865
|
function ft() {
|
|
7866
7866
|
const f = t.addFunction(J + "_mulNR");
|
|
7867
7867
|
f.addParam("x", "i32"), f.addParam("pr", "i32");
|
|
@@ -7890,7 +7890,7 @@ var xs = function(t, e) {
|
|
|
7890
7890
|
);
|
|
7891
7891
|
}
|
|
7892
7892
|
ft();
|
|
7893
|
-
const at =
|
|
7893
|
+
const at = Ea(t, J + "_mulNR", "ftm", J), zt = At(0xd201000000010000n), G = t.alloc(zt), K = 3 * l, P = zt.length - 1, q = zt.reduce((f, _) => f + (_ != 0 ? 1 : 0), 0) + P + 1, u = 3 * 2 * d, W = 3 * d * 2 + q * K, z = !0, b = 15132376222941642752n;
|
|
7894
7894
|
t.modules[n] = {
|
|
7895
7895
|
n64q: g,
|
|
7896
7896
|
n64r: y,
|
|
@@ -7914,7 +7914,7 @@ var xs = function(t, e) {
|
|
|
7914
7914
|
let _ = f;
|
|
7915
7915
|
const Z = [];
|
|
7916
7916
|
for (; _ > 0n; ) {
|
|
7917
|
-
if (
|
|
7917
|
+
if (va(_)) {
|
|
7918
7918
|
const Q = 2 - Number(_ % 4n);
|
|
7919
7919
|
Z.push(Q), _ = _ - BigInt(Q);
|
|
7920
7920
|
} else
|
|
@@ -7927,7 +7927,7 @@ var xs = function(t, e) {
|
|
|
7927
7927
|
let _ = f;
|
|
7928
7928
|
const Z = [];
|
|
7929
7929
|
for (; _ > 0n; )
|
|
7930
|
-
|
|
7930
|
+
va(_) ? Z.push(1) : Z.push(0), _ = _ >> 1n;
|
|
7931
7931
|
return Z;
|
|
7932
7932
|
}
|
|
7933
7933
|
function Lt() {
|
|
@@ -8320,7 +8320,7 @@ var xs = function(t, e) {
|
|
|
8320
8320
|
(st * ot - rt * gt) % a,
|
|
8321
8321
|
(st * gt + rt * ot) % a
|
|
8322
8322
|
];
|
|
8323
|
-
return
|
|
8323
|
+
return xs(Bt[0]) && (Bt[0] = Bt[0] + a), Bt;
|
|
8324
8324
|
}
|
|
8325
8325
|
}
|
|
8326
8326
|
function Jt() {
|
|
@@ -8637,47 +8637,47 @@ var xs = function(t, e) {
|
|
|
8637
8637
|
for (let f = 1; f <= 5; f++)
|
|
8638
8638
|
vt(f), t.exportFunction(n + "_pairingEq" + f);
|
|
8639
8639
|
Wt(), t.exportFunction(n + "_pairing"), t.exportFunction(n + "_prepareG1"), t.exportFunction(n + "_prepareG2"), t.exportFunction(n + "_millerLoop"), t.exportFunction(n + "_finalExponentiation"), t.exportFunction(n + "_finalExponentiationOld"), t.exportFunction(n + "__cyclotomicSquare"), t.exportFunction(n + "__cyclotomicExp_w0"), t.exportFunction(J + "_mul1"), t.exportFunction(J + "_mul01"), t.exportFunction(at + "_mul014"), t.exportFunction(I + "_inGroupAffine"), t.exportFunction(I + "_inGroup"), t.exportFunction(w + "_inGroupAffine"), t.exportFunction(w + "_inGroup");
|
|
8640
|
-
},
|
|
8641
|
-
function
|
|
8640
|
+
}, Is = As, Os = Ss;
|
|
8641
|
+
function Pn(c) {
|
|
8642
8642
|
if (typeof c == "bigint" || c.eq !== void 0)
|
|
8643
8643
|
return c.toString(10);
|
|
8644
8644
|
if (c instanceof Uint8Array)
|
|
8645
8645
|
return $e(c, 0);
|
|
8646
8646
|
if (Array.isArray(c))
|
|
8647
|
-
return c.map(
|
|
8647
|
+
return c.map(Pn);
|
|
8648
8648
|
if (typeof c == "object") {
|
|
8649
8649
|
const t = {};
|
|
8650
8650
|
return Object.keys(c).forEach((n) => {
|
|
8651
|
-
t[n] =
|
|
8651
|
+
t[n] = Pn(c[n]);
|
|
8652
8652
|
}), t;
|
|
8653
8653
|
} else
|
|
8654
8654
|
return c;
|
|
8655
8655
|
}
|
|
8656
|
-
function
|
|
8656
|
+
function kn(c) {
|
|
8657
8657
|
if (typeof c == "string" && /^[0-9]+$/.test(c))
|
|
8658
8658
|
return BigInt(c);
|
|
8659
8659
|
if (typeof c == "string" && /^0x[0-9a-fA-F]+$/.test(c))
|
|
8660
8660
|
return BigInt(c);
|
|
8661
8661
|
if (Array.isArray(c))
|
|
8662
|
-
return c.map(
|
|
8662
|
+
return c.map(kn);
|
|
8663
8663
|
if (typeof c == "object") {
|
|
8664
8664
|
if (c === null)
|
|
8665
8665
|
return null;
|
|
8666
8666
|
const t = {};
|
|
8667
8667
|
return Object.keys(c).forEach((n) => {
|
|
8668
|
-
t[n] =
|
|
8668
|
+
t[n] = kn(c[n]);
|
|
8669
8669
|
}), t;
|
|
8670
8670
|
} else
|
|
8671
8671
|
return c;
|
|
8672
8672
|
}
|
|
8673
|
-
function
|
|
8673
|
+
function Ps(c) {
|
|
8674
8674
|
let t = BigInt(0), e = c.length, n = 0;
|
|
8675
8675
|
const a = new DataView(c.buffer, c.byteOffset, c.byteLength);
|
|
8676
8676
|
for (; e > 0; )
|
|
8677
8677
|
e >= 4 ? (e -= 4, t += BigInt(a.getUint32(e)) << BigInt(n * 8), n += 4) : e >= 2 ? (e -= 2, t += BigInt(a.getUint16(e)) << BigInt(n * 8), n += 2) : (e -= 1, t += BigInt(a.getUint8(e)) << BigInt(n * 8), n += 1);
|
|
8678
8678
|
return t;
|
|
8679
8679
|
}
|
|
8680
|
-
function
|
|
8680
|
+
function ks(c, t) {
|
|
8681
8681
|
let e = c;
|
|
8682
8682
|
const n = new Uint8Array(t), a = new DataView(n.buffer);
|
|
8683
8683
|
let s = t;
|
|
@@ -8687,14 +8687,14 @@ function Ps(c, t) {
|
|
|
8687
8687
|
throw new Error("Number does not fit in this length");
|
|
8688
8688
|
return n;
|
|
8689
8689
|
}
|
|
8690
|
-
function
|
|
8690
|
+
function Ts(c) {
|
|
8691
8691
|
let t = BigInt(0), e = 0;
|
|
8692
8692
|
const n = new DataView(c.buffer, c.byteOffset, c.byteLength);
|
|
8693
8693
|
for (; e < c.length; )
|
|
8694
8694
|
e + 4 <= c.length ? (t += BigInt(n.getUint32(e, !0)) << BigInt(e * 8), e += 4) : e + 2 <= c.length ? (t += BigInt(n.getUint16(e, !0)) << BigInt(e * 8), e += 2) : (t += BigInt(n.getUint8(e, !0)) << BigInt(e * 8), e += 1);
|
|
8695
8695
|
return t;
|
|
8696
8696
|
}
|
|
8697
|
-
function
|
|
8697
|
+
function Si(c, t) {
|
|
8698
8698
|
let e = c;
|
|
8699
8699
|
typeof t > "u" && (t = Math.floor((We(c) - 1) / 8) + 1, t == 0 && (t = 1));
|
|
8700
8700
|
const n = new Uint8Array(t), a = new DataView(n.buffer);
|
|
@@ -8705,66 +8705,66 @@ function xi(c, t) {
|
|
|
8705
8705
|
throw new Error("Number does not fit in this length");
|
|
8706
8706
|
return n;
|
|
8707
8707
|
}
|
|
8708
|
-
function
|
|
8708
|
+
function Tn(c, t) {
|
|
8709
8709
|
if (typeof t == "bigint" || t.eq !== void 0)
|
|
8710
8710
|
return t.toString(10);
|
|
8711
8711
|
if (t instanceof Uint8Array)
|
|
8712
8712
|
return c.toString(c.e(t));
|
|
8713
8713
|
if (Array.isArray(t))
|
|
8714
|
-
return t.map(
|
|
8714
|
+
return t.map(Tn.bind(this, c));
|
|
8715
8715
|
if (typeof t == "object") {
|
|
8716
8716
|
const e = {};
|
|
8717
8717
|
return Object.keys(t).forEach((a) => {
|
|
8718
|
-
e[a] =
|
|
8718
|
+
e[a] = Tn(c, t[a]);
|
|
8719
8719
|
}), e;
|
|
8720
8720
|
} else
|
|
8721
8721
|
return t;
|
|
8722
8722
|
}
|
|
8723
|
-
function
|
|
8723
|
+
function qn(c, t) {
|
|
8724
8724
|
if (typeof t == "string" && /^[0-9]+$/.test(t))
|
|
8725
8725
|
return c.e(t);
|
|
8726
8726
|
if (typeof t == "string" && /^0x[0-9a-fA-F]+$/.test(t))
|
|
8727
8727
|
return c.e(t);
|
|
8728
8728
|
if (Array.isArray(t))
|
|
8729
|
-
return t.map(
|
|
8729
|
+
return t.map(qn.bind(this, c));
|
|
8730
8730
|
if (typeof t == "object") {
|
|
8731
8731
|
if (t === null)
|
|
8732
8732
|
return null;
|
|
8733
8733
|
const e = {};
|
|
8734
8734
|
return Object.keys(t).forEach((a) => {
|
|
8735
|
-
e[a] =
|
|
8735
|
+
e[a] = qn(c, t[a]);
|
|
8736
8736
|
}), e;
|
|
8737
8737
|
} else
|
|
8738
8738
|
return t;
|
|
8739
8739
|
}
|
|
8740
8740
|
const ze = [];
|
|
8741
8741
|
for (let c = 0; c < 256; c++)
|
|
8742
|
-
ze[c] =
|
|
8743
|
-
function
|
|
8742
|
+
ze[c] = qs(c, 8);
|
|
8743
|
+
function qs(c, t) {
|
|
8744
8744
|
let e = 0, n = c;
|
|
8745
8745
|
for (let a = 0; a < t; a++)
|
|
8746
8746
|
e <<= 1, e = e | n & 1, n >>= 1;
|
|
8747
8747
|
return e;
|
|
8748
8748
|
}
|
|
8749
|
-
function
|
|
8749
|
+
function Ii(c, t) {
|
|
8750
8750
|
return (ze[c >>> 24] | ze[c >>> 16 & 255] << 8 | ze[c >>> 8 & 255] << 16 | ze[c & 255] << 24) >>> 32 - t;
|
|
8751
8751
|
}
|
|
8752
8752
|
function le(c) {
|
|
8753
8753
|
return (c & 4294901760 ? (c &= 4294901760, 16) : 0) | (c & 4278255360 ? (c &= 4278255360, 8) : 0) | (c & 4042322160 ? (c &= 4042322160, 4) : 0) | (c & 3435973836 ? (c &= 3435973836, 2) : 0) | (c & 2863311530) !== 0;
|
|
8754
8754
|
}
|
|
8755
|
-
function
|
|
8755
|
+
function Oi(c, t) {
|
|
8756
8756
|
const e = c.byteLength / t, n = le(e);
|
|
8757
8757
|
if (e != 1 << n)
|
|
8758
8758
|
throw new Error("Invalid number of pointers");
|
|
8759
8759
|
for (let a = 0; a < e; a++) {
|
|
8760
|
-
const s =
|
|
8760
|
+
const s = Ii(a, n);
|
|
8761
8761
|
if (a > s) {
|
|
8762
8762
|
const g = c.slice(a * t, (a + 1) * t);
|
|
8763
8763
|
c.set(c.slice(s * t, (s + 1) * t), a * t), c.set(g, s * t);
|
|
8764
8764
|
}
|
|
8765
8765
|
}
|
|
8766
8766
|
}
|
|
8767
|
-
function
|
|
8767
|
+
function Jn(c, t) {
|
|
8768
8768
|
const e = new Uint8Array(t * c.length);
|
|
8769
8769
|
for (let n = 0; n < c.length; n++)
|
|
8770
8770
|
e.set(c[n], n * t);
|
|
@@ -8776,21 +8776,21 @@ function nn(c, t) {
|
|
|
8776
8776
|
n[a] = c.slice(a * t, a * t + t);
|
|
8777
8777
|
return n;
|
|
8778
8778
|
}
|
|
8779
|
-
var
|
|
8779
|
+
var Ds = /* @__PURE__ */ Object.freeze({
|
|
8780
8780
|
__proto__: null,
|
|
8781
|
-
array2buffer:
|
|
8782
|
-
beBuff2int:
|
|
8783
|
-
beInt2Buff:
|
|
8784
|
-
bitReverse:
|
|
8785
|
-
buffReverseBits:
|
|
8781
|
+
array2buffer: Jn,
|
|
8782
|
+
beBuff2int: Ps,
|
|
8783
|
+
beInt2Buff: ks,
|
|
8784
|
+
bitReverse: Ii,
|
|
8785
|
+
buffReverseBits: Oi,
|
|
8786
8786
|
buffer2array: nn,
|
|
8787
|
-
leBuff2int:
|
|
8788
|
-
leInt2Buff:
|
|
8787
|
+
leBuff2int: Ts,
|
|
8788
|
+
leInt2Buff: Si,
|
|
8789
8789
|
log2: le,
|
|
8790
|
-
stringifyBigInts:
|
|
8791
|
-
stringifyFElements:
|
|
8792
|
-
unstringifyBigInts:
|
|
8793
|
-
unstringifyFElements:
|
|
8790
|
+
stringifyBigInts: Pn,
|
|
8791
|
+
stringifyFElements: Tn,
|
|
8792
|
+
unstringifyBigInts: kn,
|
|
8793
|
+
unstringifyFElements: qn
|
|
8794
8794
|
});
|
|
8795
8795
|
const ce = 1 << 30;
|
|
8796
8796
|
class Vt {
|
|
@@ -8863,7 +8863,7 @@ function me(c, t, e, n) {
|
|
|
8863
8863
|
return o;
|
|
8864
8864
|
};
|
|
8865
8865
|
}
|
|
8866
|
-
class
|
|
8866
|
+
class xa {
|
|
8867
8867
|
constructor(t, e, n, a) {
|
|
8868
8868
|
if (this.tm = t, this.prefix = e, this.p = a, this.n8 = n, this.type = "F1", this.m = 1, this.half = xe(a, Ee), this.bitLength = We(a), this.mask = he(tn(Ee, this.bitLength), Ee), this.pOp1 = t.alloc(n), this.pOp2 = t.alloc(n), this.pOp3 = t.alloc(n), this.tm.instance.exports[e + "_zero"](this.pOp1), this.zero = this.tm.getBuff(this.pOp1, this.n8), this.tm.instance.exports[e + "_one"](this.pOp1), this.one = this.tm.getBuff(this.pOp1, this.n8), this.negone = this.neg(this.one), this.two = this.add(this.one, this.one), this.n64 = Math.floor(n / 8), this.n32 = Math.floor(n / 4), this.n64 * 8 != this.n8)
|
|
8869
8869
|
throw new Error("n8 must be a multiple of 8");
|
|
@@ -8873,7 +8873,7 @@ class va {
|
|
|
8873
8873
|
this.nqr = this.add(this.nqr, this.one), s = this.exp(this.nqr, this.half);
|
|
8874
8874
|
this.shift = this.mul(this.nqr, this.nqr), this.shiftInv = this.inv(this.shift), this.s = 0;
|
|
8875
8875
|
let g = he(this.p, Ee);
|
|
8876
|
-
for (; !
|
|
8876
|
+
for (; !jn(g); )
|
|
8877
8877
|
this.s = this.s + 1, g = xe(g, Ee);
|
|
8878
8878
|
this.w = [], this.w[this.s] = this.exp(this.nqr, g);
|
|
8879
8879
|
for (let d = this.s - 1; d >= 0; d--)
|
|
@@ -8943,27 +8943,27 @@ class va {
|
|
|
8943
8943
|
if (t instanceof Uint8Array)
|
|
8944
8944
|
return t;
|
|
8945
8945
|
let n = ee(t, e);
|
|
8946
|
-
|
|
8947
|
-
const a =
|
|
8946
|
+
ai(n) ? (n = si(n), On(n, this.p) && (n = _e(n, this.p)), n = he(this.p, n)) : On(n, this.p) && (n = _e(n, this.p));
|
|
8947
|
+
const a = Si(n, this.n8);
|
|
8948
8948
|
return this.toMontgomery(a);
|
|
8949
8949
|
}
|
|
8950
8950
|
toString(t, e) {
|
|
8951
8951
|
const n = this.fromMontgomery(t), a = $e(n, 0);
|
|
8952
|
-
return
|
|
8952
|
+
return fi(a, e);
|
|
8953
8953
|
}
|
|
8954
8954
|
fromRng(t) {
|
|
8955
8955
|
let e;
|
|
8956
8956
|
const n = new Uint8Array(this.n8);
|
|
8957
8957
|
do {
|
|
8958
|
-
e =
|
|
8958
|
+
e = _i;
|
|
8959
8959
|
for (let a = 0; a < this.n64; a++)
|
|
8960
|
-
e =
|
|
8961
|
-
e =
|
|
8962
|
-
} while (
|
|
8960
|
+
e = $n(e, tn(t.nextU64(), 64 * a));
|
|
8961
|
+
e = Gn(e, this.mask);
|
|
8962
|
+
} while (li(e, this.p));
|
|
8963
8963
|
return je(n, 0, e, this.n8), n;
|
|
8964
8964
|
}
|
|
8965
8965
|
random() {
|
|
8966
|
-
return this.fromRng(
|
|
8966
|
+
return this.fromRng(Zn());
|
|
8967
8967
|
}
|
|
8968
8968
|
toObject(t) {
|
|
8969
8969
|
const e = this.fromMontgomery(t);
|
|
@@ -8992,7 +8992,7 @@ class va {
|
|
|
8992
8992
|
async batchInverse(t) {
|
|
8993
8993
|
let e = !1;
|
|
8994
8994
|
const n = this.n8, a = this.n8;
|
|
8995
|
-
Array.isArray(t) ? (t =
|
|
8995
|
+
Array.isArray(t) ? (t = Jn(t, n), e = !0) : t = t.slice(0, t.byteLength);
|
|
8996
8996
|
const s = Math.floor(t.byteLength / n);
|
|
8997
8997
|
if (s * n !== t.byteLength)
|
|
8998
8998
|
throw new Error("Invalid buffer size");
|
|
@@ -9026,7 +9026,7 @@ class va {
|
|
|
9026
9026
|
return e ? nn(l, a) : l;
|
|
9027
9027
|
}
|
|
9028
9028
|
}
|
|
9029
|
-
class
|
|
9029
|
+
class Sa {
|
|
9030
9030
|
constructor(t, e, n) {
|
|
9031
9031
|
this.tm = t, this.prefix = e, this.F = n, this.type = "F2", this.m = n.m * 2, this.n8 = this.F.n8 * 2, this.n32 = this.F.n32 * 2, this.n64 = this.F.n64 * 2, this.pOp1 = t.alloc(n.n8 * 2), this.pOp2 = t.alloc(n.n8 * 2), this.pOp3 = t.alloc(n.n8 * 2), this.tm.instance.exports[e + "_zero"](this.pOp1), this.zero = t.getBuff(this.pOp1, this.n8), this.tm.instance.exports[e + "_one"](this.pOp1), this.one = t.getBuff(this.pOp1, this.n8), this.negone = this.neg(this.one), this.two = this.add(this.one, this.one);
|
|
9032
9032
|
}
|
|
@@ -9108,7 +9108,7 @@ class xa {
|
|
|
9108
9108
|
return a.set(e), a.set(n, this.F.n8), a;
|
|
9109
9109
|
}
|
|
9110
9110
|
random() {
|
|
9111
|
-
return this.fromRng(
|
|
9111
|
+
return this.fromRng(Zn());
|
|
9112
9112
|
}
|
|
9113
9113
|
toObject(t) {
|
|
9114
9114
|
const e = this.F.toObject(t.slice(0, this.F.n8)), n = this.F.toObject(t.slice(this.F.n8, this.F.n8 * 2));
|
|
@@ -9125,7 +9125,7 @@ class xa {
|
|
|
9125
9125
|
return t.slice(this.F.n8);
|
|
9126
9126
|
}
|
|
9127
9127
|
}
|
|
9128
|
-
class
|
|
9128
|
+
class Ms {
|
|
9129
9129
|
constructor(t, e, n) {
|
|
9130
9130
|
this.tm = t, this.prefix = e, this.F = n, this.type = "F3", this.m = n.m * 3, this.n8 = this.F.n8 * 3, this.n32 = this.F.n32 * 3, this.n64 = this.F.n64 * 3, this.pOp1 = t.alloc(n.n8 * 3), this.pOp2 = t.alloc(n.n8 * 3), this.pOp3 = t.alloc(n.n8 * 3), this.tm.instance.exports[e + "_zero"](this.pOp1), this.zero = t.getBuff(this.pOp1, this.n8), this.tm.instance.exports[e + "_one"](this.pOp1), this.one = t.getBuff(this.pOp1, this.n8), this.negone = this.neg(this.one), this.two = this.add(this.one, this.one);
|
|
9131
9131
|
}
|
|
@@ -9204,7 +9204,7 @@ class Ds {
|
|
|
9204
9204
|
return s.set(e), s.set(n, this.F.n8), s.set(a, this.F.n8 * 2), s;
|
|
9205
9205
|
}
|
|
9206
9206
|
random() {
|
|
9207
|
-
return this.fromRng(
|
|
9207
|
+
return this.fromRng(Zn());
|
|
9208
9208
|
}
|
|
9209
9209
|
toObject(t) {
|
|
9210
9210
|
const e = this.F.toObject(t.slice(0, this.F.n8)), n = this.F.toObject(t.slice(this.F.n8, this.F.n8 * 2)), a = this.F.toObject(t.slice(this.F.n8 * 2, this.F.n8 * 3));
|
|
@@ -9224,7 +9224,7 @@ class Ds {
|
|
|
9224
9224
|
return t.slice(this.F.n8 * 2);
|
|
9225
9225
|
}
|
|
9226
9226
|
}
|
|
9227
|
-
class
|
|
9227
|
+
class Ia {
|
|
9228
9228
|
constructor(t, e, n, a, s, g) {
|
|
9229
9229
|
this.tm = t, this.prefix = e, this.F = n, this.pOp1 = t.alloc(n.n8 * 3), this.pOp2 = t.alloc(n.n8 * 3), this.pOp3 = t.alloc(n.n8 * 3), this.tm.instance.exports[e + "_zero"](this.pOp1), this.zero = this.tm.getBuff(this.pOp1, n.n8 * 3), this.tm.instance.exports[e + "_zeroAffine"](this.pOp1), this.zeroAffine = this.tm.getBuff(this.pOp1, n.n8 * 2), this.one = this.tm.getBuff(a, n.n8 * 3), this.g = this.one, this.oneAffine = this.tm.getBuff(a, n.n8 * 2), this.gAffine = this.oneAffine, this.b = this.tm.getBuff(s, n.n8), g && (this.cofactor = Ie(g)), this.negone = this.neg(this.one), this.two = this.add(this.one, this.one), this.batchLEMtoC = me(t, e + "_batchLEMtoC", n.n8 * 2, n.n8), this.batchLEMtoU = me(t, e + "_batchLEMtoU", n.n8 * 2, n.n8 * 2), this.batchCtoLEM = me(t, e + "_batchCtoLEM", n.n8, n.n8 * 2), this.batchUtoLEM = me(t, e + "_batchUtoLEM", n.n8 * 2, n.n8 * 2), this.batchToJacobian = me(t, e + "_batchToJacobian", n.n8 * 2, n.n8 * 3), this.batchToAffine = me(t, e + "_batchToAffine", n.n8 * 3, n.n8 * 2);
|
|
9230
9230
|
}
|
|
@@ -9453,7 +9453,7 @@ class Sa {
|
|
|
9453
9453
|
return this.toAffine(t).slice(this.F.n8);
|
|
9454
9454
|
}
|
|
9455
9455
|
}
|
|
9456
|
-
function
|
|
9456
|
+
function Pi(c) {
|
|
9457
9457
|
let e, n;
|
|
9458
9458
|
c && (c.onmessage = function(o) {
|
|
9459
9459
|
let y;
|
|
@@ -9537,24 +9537,24 @@ function Oi(c) {
|
|
|
9537
9537
|
}
|
|
9538
9538
|
return l;
|
|
9539
9539
|
}
|
|
9540
|
-
var
|
|
9540
|
+
var Rs = Worker;
|
|
9541
9541
|
const Cn = 25;
|
|
9542
|
-
class
|
|
9542
|
+
class Oa {
|
|
9543
9543
|
constructor() {
|
|
9544
9544
|
this.promise = new Promise((t, e) => {
|
|
9545
9545
|
this.reject = e, this.resolve = t;
|
|
9546
9546
|
});
|
|
9547
9547
|
}
|
|
9548
9548
|
}
|
|
9549
|
-
function
|
|
9549
|
+
function Ns(c) {
|
|
9550
9550
|
return new Promise((t) => setTimeout(t, c));
|
|
9551
9551
|
}
|
|
9552
|
-
function
|
|
9552
|
+
function zs(c) {
|
|
9553
9553
|
return process.browser ? globalThis.btoa(c) : Buffer.from(c).toString("base64");
|
|
9554
9554
|
}
|
|
9555
|
-
const
|
|
9556
|
-
async function
|
|
9557
|
-
const e = new
|
|
9555
|
+
const Us = zs("(" + Pi.toString() + ")(self)"), js = "data:application/javascript;base64," + Us;
|
|
9556
|
+
async function $s(c, t) {
|
|
9557
|
+
const e = new Gs();
|
|
9558
9558
|
e.memory = new WebAssembly.Memory({ initial: Cn }), e.u8 = new Uint8Array(e.memory.buffer), e.u32 = new Uint32Array(e.memory.buffer);
|
|
9559
9559
|
const n = await WebAssembly.compile(c.code);
|
|
9560
9560
|
if (e.instance = await WebAssembly.instantiate(n, {
|
|
@@ -9562,7 +9562,7 @@ async function js(c, t) {
|
|
|
9562
9562
|
memory: e.memory
|
|
9563
9563
|
}
|
|
9564
9564
|
}), e.singleThread = t, e.initalPFree = e.u32[0], e.pq = c.pq, e.pr = c.pr, e.pG1gen = c.pG1gen, e.pG1zero = c.pG1zero, e.pG2gen = c.pG2gen, e.pG2zero = c.pG2zero, e.pOneT = c.pOneT, t)
|
|
9565
|
-
e.code = c.code, e.taskManager =
|
|
9565
|
+
e.code = c.code, e.taskManager = Pi(), await e.taskManager([{
|
|
9566
9566
|
cmd: "INIT",
|
|
9567
9567
|
init: Cn,
|
|
9568
9568
|
code: e.code.slice()
|
|
@@ -9572,7 +9572,7 @@ async function js(c, t) {
|
|
|
9572
9572
|
let s;
|
|
9573
9573
|
typeof navigator == "object" && navigator.hardwareConcurrency ? s = navigator.hardwareConcurrency : s = on.cpus().length, s == 0 && (s = 2), s > 64 && (s = 64), e.concurrency = s;
|
|
9574
9574
|
for (let d = 0; d < s; d++)
|
|
9575
|
-
e.workers[d] = new
|
|
9575
|
+
e.workers[d] = new Rs(js), e.workers[d].addEventListener("message", a(d)), e.working[d] = !1;
|
|
9576
9576
|
const g = [];
|
|
9577
9577
|
for (let d = 0; d < e.workers.length; d++) {
|
|
9578
9578
|
const C = c.code.slice();
|
|
@@ -9592,7 +9592,7 @@ async function js(c, t) {
|
|
|
9592
9592
|
};
|
|
9593
9593
|
}
|
|
9594
9594
|
}
|
|
9595
|
-
class
|
|
9595
|
+
class Gs {
|
|
9596
9596
|
constructor() {
|
|
9597
9597
|
this.actionQueue = [], this.oldPFree = 0;
|
|
9598
9598
|
}
|
|
@@ -9609,7 +9609,7 @@ class $s {
|
|
|
9609
9609
|
postAction(t, e, n, a) {
|
|
9610
9610
|
if (this.working[t])
|
|
9611
9611
|
throw new Error("Posting a job t a working worker");
|
|
9612
|
-
return this.working[t] = !0, this.pendingDeferreds[t] = a || new
|
|
9612
|
+
return this.working[t] = !0, this.pendingDeferreds[t] = a || new Oa(), this.workers[t].postMessage(e, n), this.pendingDeferreds[t].promise;
|
|
9613
9613
|
}
|
|
9614
9614
|
processWorks() {
|
|
9615
9615
|
for (let t = 0; t < this.workers.length && this.actionQueue.length > 0; t++)
|
|
@@ -9619,7 +9619,7 @@ class $s {
|
|
|
9619
9619
|
}
|
|
9620
9620
|
}
|
|
9621
9621
|
queueAction(t, e) {
|
|
9622
|
-
const n = new
|
|
9622
|
+
const n = new Oa();
|
|
9623
9623
|
if (this.singleThread) {
|
|
9624
9624
|
const a = this.taskManager(t);
|
|
9625
9625
|
n.resolve(a);
|
|
@@ -9653,7 +9653,7 @@ class $s {
|
|
|
9653
9653
|
async terminate() {
|
|
9654
9654
|
for (let t = 0; t < this.workers.length; t++)
|
|
9655
9655
|
this.workers[t].postMessage([{ cmd: "TERMINATE" }]);
|
|
9656
|
-
await
|
|
9656
|
+
await Ns(200);
|
|
9657
9657
|
}
|
|
9658
9658
|
}
|
|
9659
9659
|
function An(c, t) {
|
|
@@ -9710,7 +9710,7 @@ function An(c, t) {
|
|
|
9710
9710
|
return w;
|
|
9711
9711
|
};
|
|
9712
9712
|
}
|
|
9713
|
-
function
|
|
9713
|
+
function Zs(c) {
|
|
9714
9714
|
const t = c.tm;
|
|
9715
9715
|
c.pairing = function(n, a) {
|
|
9716
9716
|
t.startSyncOp();
|
|
@@ -9777,7 +9777,7 @@ function Gs(c) {
|
|
|
9777
9777
|
return this.tm.endSyncOp(), s;
|
|
9778
9778
|
};
|
|
9779
9779
|
}
|
|
9780
|
-
const
|
|
9780
|
+
const Pa = [
|
|
9781
9781
|
1,
|
|
9782
9782
|
1,
|
|
9783
9783
|
1,
|
|
@@ -9811,7 +9811,7 @@ const Oa = [
|
|
|
9811
9811
|
17,
|
|
9812
9812
|
17
|
|
9813
9813
|
];
|
|
9814
|
-
function
|
|
9814
|
+
function ka(c, t) {
|
|
9815
9815
|
const e = c[t], n = e.tm;
|
|
9816
9816
|
async function a(g, d, C, l, o) {
|
|
9817
9817
|
if (!(g instanceof Uint8Array))
|
|
@@ -9832,7 +9832,7 @@ function Pa(c, t) {
|
|
|
9832
9832
|
const x = Math.floor(d.byteLength / m);
|
|
9833
9833
|
if (x * m != d.byteLength)
|
|
9834
9834
|
throw new Error("Scalar size does not match");
|
|
9835
|
-
const O =
|
|
9835
|
+
const O = Pa[le(m)], L = Math.floor((x * 8 - 1) / O) + 1, I = [];
|
|
9836
9836
|
for (let w = 0; w < L; w++) {
|
|
9837
9837
|
const S = [
|
|
9838
9838
|
{ cmd: "ALLOCSET", var: 0, buff: g },
|
|
@@ -9874,7 +9874,7 @@ function Pa(c, t) {
|
|
|
9874
9874
|
const x = Math.floor(g.byteLength / m), O = Math.floor(d.byteLength / x);
|
|
9875
9875
|
if (O * x != d.byteLength)
|
|
9876
9876
|
throw new Error("Scalar size does not match");
|
|
9877
|
-
const L =
|
|
9877
|
+
const L = Pa[le(x)], I = Math.floor((O * 8 - 1) / L) + 1;
|
|
9878
9878
|
let v;
|
|
9879
9879
|
v = Math.floor(x / (n.concurrency / I)), v > 4194304 && (v = 4194304), v < 1024 && (v = 1024);
|
|
9880
9880
|
const U = [];
|
|
@@ -9903,7 +9903,7 @@ function Fn(c, t) {
|
|
|
9903
9903
|
let L, I, v, U, w, S, F, r;
|
|
9904
9904
|
t == "G1" ? (y == "affine" ? (L = e.F.n8 * 2, U = "g1m_batchToJacobian") : L = e.F.n8 * 3, I = e.F.n8 * 3, o && (r = "g1m_fftFinal"), F = "g1m_fftJoin", S = "g1m_fftMix", E == "affine" ? (v = e.F.n8 * 2, w = "g1m_batchToAffine") : v = e.F.n8 * 3) : t == "G2" ? (y == "affine" ? (L = e.F.n8 * 2, U = "g2m_batchToJacobian") : L = e.F.n8 * 3, I = e.F.n8 * 3, o && (r = "g2m_fftFinal"), F = "g2m_fftJoin", S = "g2m_fftMix", E == "affine" ? (v = e.F.n8 * 2, w = "g2m_batchToAffine") : v = e.F.n8 * 3) : t == "Fr" && (L = e.n8, I = e.n8, v = e.n8, o && (r = "frm_fftFinal"), S = "frm_fftMix", F = "frm_fftJoin");
|
|
9905
9905
|
let h = !1;
|
|
9906
|
-
Array.isArray(l) ? (l =
|
|
9906
|
+
Array.isArray(l) ? (l = Jn(l, L), h = !0) : l = l.slice(0, l.byteLength);
|
|
9907
9907
|
const R = l.byteLength / L, j = le(R);
|
|
9908
9908
|
if (1 << j != R)
|
|
9909
9909
|
throw new Error("fft must be multiple of 2");
|
|
@@ -9914,7 +9914,7 @@ function Fn(c, t) {
|
|
|
9914
9914
|
let T;
|
|
9915
9915
|
o && (T = n.inv(n.e(R)));
|
|
9916
9916
|
let D;
|
|
9917
|
-
|
|
9917
|
+
Oi(l, L);
|
|
9918
9918
|
let A, M = Math.min(1 << O, R), H = R / M;
|
|
9919
9919
|
for (; H < a.concurrency && M >= 16; )
|
|
9920
9920
|
H *= 2, M /= 2;
|
|
@@ -10197,9 +10197,9 @@ function Fn(c, t) {
|
|
|
10197
10197
|
return w;
|
|
10198
10198
|
};
|
|
10199
10199
|
}
|
|
10200
|
-
async function
|
|
10201
|
-
const t = await
|
|
10202
|
-
return e.q = ee(c.wasm.q.toString()), e.r = ee(c.wasm.r.toString()), e.name = c.name, e.tm = t, e.prePSize = c.wasm.prePSize, e.preQSize = c.wasm.preQSize, e.Fr = new
|
|
10200
|
+
async function ki(c) {
|
|
10201
|
+
const t = await $s(c.wasm, c.singleThread), e = {};
|
|
10202
|
+
return e.q = ee(c.wasm.q.toString()), e.r = ee(c.wasm.r.toString()), e.name = c.name, e.tm = t, e.prePSize = c.wasm.prePSize, e.preQSize = c.wasm.preQSize, e.Fr = new xa(t, "frm", c.n8r, c.r), e.F1 = new xa(t, "f1m", c.n8q, c.q), e.F2 = new Sa(t, "f2m", e.F1), e.G1 = new Ia(t, "g1m", e.F1, c.wasm.pG1gen, c.wasm.pG1b, c.cofactorG1), e.G2 = new Ia(t, "g2m", e.F2, c.wasm.pG2gen, c.wasm.pG2b, c.cofactorG2), e.F6 = new Ms(t, "f6m", e.F2), e.F12 = new Sa(t, "ftm", e.F6), e.Gt = e.F12, An(e, "G1"), An(e, "G2"), An(e, "Fr"), ka(e, "G1"), ka(e, "G2"), Fn(e, "G1"), Fn(e, "G2"), Fn(e, "Fr"), Zs(e), e.array2buffer = function(n, a) {
|
|
10203
10203
|
const s = new Uint8Array(a * n.length);
|
|
10204
10204
|
for (let g = 0; g < n.length; g++)
|
|
10205
10205
|
s.set(n[g], g * a);
|
|
@@ -10214,20 +10214,20 @@ async function Pi(c) {
|
|
|
10214
10214
|
function Pe(c) {
|
|
10215
10215
|
return BigInt(c);
|
|
10216
10216
|
}
|
|
10217
|
-
function
|
|
10217
|
+
function Ti(c) {
|
|
10218
10218
|
return c < 0n;
|
|
10219
10219
|
}
|
|
10220
|
-
function
|
|
10220
|
+
function Ws(c) {
|
|
10221
10221
|
return c === 0n;
|
|
10222
10222
|
}
|
|
10223
|
-
function
|
|
10224
|
-
return
|
|
10223
|
+
function Xs(c) {
|
|
10224
|
+
return Ti(c) ? c.toString(2).length - 1 : c.toString(2).length;
|
|
10225
10225
|
}
|
|
10226
10226
|
function En(c) {
|
|
10227
10227
|
const t = [], e = Pe(c);
|
|
10228
10228
|
return t.push(Number(e & 0xFFn)), t.push(Number(e >> 8n & 0xFFn)), t.push(Number(e >> 16n & 0xFFn)), t.push(Number(e >> 24n & 0xFFn)), t;
|
|
10229
10229
|
}
|
|
10230
|
-
function
|
|
10230
|
+
function Vs(c) {
|
|
10231
10231
|
for (var t = [], e = 0; e < c.length; e++) {
|
|
10232
10232
|
var n = c.charCodeAt(e);
|
|
10233
10233
|
n < 128 ? t.push(n) : n < 2048 ? t.push(
|
|
@@ -10247,56 +10247,56 @@ function Xs(c) {
|
|
|
10247
10247
|
return t;
|
|
10248
10248
|
}
|
|
10249
10249
|
function Ne(c) {
|
|
10250
|
-
const t =
|
|
10250
|
+
const t = Vs(c);
|
|
10251
10251
|
return [...Rt(t.length), ...t];
|
|
10252
10252
|
}
|
|
10253
|
-
function
|
|
10253
|
+
function qi(c) {
|
|
10254
10254
|
const t = [];
|
|
10255
10255
|
let e = Pe(c);
|
|
10256
|
-
if (
|
|
10256
|
+
if (Ti(e))
|
|
10257
10257
|
throw new Error("Number cannot be negative");
|
|
10258
|
-
for (; !
|
|
10258
|
+
for (; !Ws(e); )
|
|
10259
10259
|
t.push(Number(e & 0x7Fn)), e = e >> 7n;
|
|
10260
10260
|
t.length == 0 && t.push(0);
|
|
10261
10261
|
for (let n = 0; n < t.length - 1; n++)
|
|
10262
10262
|
t[n] = t[n] | 128;
|
|
10263
10263
|
return t;
|
|
10264
10264
|
}
|
|
10265
|
-
function
|
|
10265
|
+
function Di(c) {
|
|
10266
10266
|
let t, e;
|
|
10267
|
-
const n =
|
|
10267
|
+
const n = Xs(c);
|
|
10268
10268
|
c < 0 ? (e = !0, t = (1n << BigInt(n)) + c) : (e = !1, t = Pe(c));
|
|
10269
|
-
const a = 7 - n % 7, s = (1n << BigInt(a)) - 1n << BigInt(n), g = (1 << 7 - a) - 1 | 128, d =
|
|
10269
|
+
const a = 7 - n % 7, s = (1n << BigInt(a)) - 1n << BigInt(n), g = (1 << 7 - a) - 1 | 128, d = qi(t + s);
|
|
10270
10270
|
return e || (d[d.length - 1] = d[d.length - 1] & g), d;
|
|
10271
10271
|
}
|
|
10272
|
-
function
|
|
10272
|
+
function Dn(c) {
|
|
10273
10273
|
let t = Pe(c);
|
|
10274
10274
|
if (t > 0xFFFFFFFFn)
|
|
10275
10275
|
throw new Error("Number too big");
|
|
10276
10276
|
if (t > 0x7FFFFFFFn && (t = t - 0x100000000n), t < -2147483648n)
|
|
10277
10277
|
throw new Error("Number too small");
|
|
10278
|
-
return
|
|
10278
|
+
return Di(t);
|
|
10279
10279
|
}
|
|
10280
|
-
function
|
|
10280
|
+
function Hs(c) {
|
|
10281
10281
|
let t = Pe(c);
|
|
10282
10282
|
if (t > 0xFFFFFFFFFFFFFFFFn)
|
|
10283
10283
|
throw new Error("Number too big");
|
|
10284
10284
|
if (t > 0x7FFFFFFFFFFFFFFFn && (t = t - 0x10000000000000000n), t < -9223372036854775808n)
|
|
10285
10285
|
throw new Error("Number too small");
|
|
10286
|
-
return
|
|
10286
|
+
return Di(t);
|
|
10287
10287
|
}
|
|
10288
10288
|
function Rt(c) {
|
|
10289
10289
|
let t = Pe(c);
|
|
10290
10290
|
if (t > 0xFFFFFFFFn)
|
|
10291
10291
|
throw new Error("Number too big");
|
|
10292
|
-
return
|
|
10292
|
+
return qi(t);
|
|
10293
10293
|
}
|
|
10294
|
-
function
|
|
10294
|
+
function Ta(c) {
|
|
10295
10295
|
return Array.from(c, function(t) {
|
|
10296
10296
|
return ("0" + (t & 255).toString(16)).slice(-2);
|
|
10297
10297
|
}).join("");
|
|
10298
10298
|
}
|
|
10299
|
-
class
|
|
10299
|
+
class Qs {
|
|
10300
10300
|
constructor(t) {
|
|
10301
10301
|
this.func = t, this.functionName = t.functionName, this.module = t.module;
|
|
10302
10302
|
}
|
|
@@ -10425,10 +10425,10 @@ class Hs {
|
|
|
10425
10425
|
return [...t, 26];
|
|
10426
10426
|
}
|
|
10427
10427
|
i64_const(t) {
|
|
10428
|
-
return [66, ...
|
|
10428
|
+
return [66, ...Hs(t)];
|
|
10429
10429
|
}
|
|
10430
10430
|
i32_const(t) {
|
|
10431
|
-
return [65, ...
|
|
10431
|
+
return [65, ...Dn(t)];
|
|
10432
10432
|
}
|
|
10433
10433
|
i64_eqz(t) {
|
|
10434
10434
|
return [...t, 80];
|
|
@@ -10620,7 +10620,7 @@ const wn = {
|
|
|
10620
10620
|
func: 96,
|
|
10621
10621
|
emptyblock: 64
|
|
10622
10622
|
};
|
|
10623
|
-
class
|
|
10623
|
+
class qa {
|
|
10624
10624
|
constructor(t, e, n, a, s) {
|
|
10625
10625
|
if (n == "import")
|
|
10626
10626
|
this.fnType = "import", this.moduleName = a, this.fieldName = s;
|
|
@@ -10676,10 +10676,10 @@ class Ta {
|
|
|
10676
10676
|
this.code.push(...[].concat(...t));
|
|
10677
10677
|
}
|
|
10678
10678
|
getCodeBuilder() {
|
|
10679
|
-
return new
|
|
10679
|
+
return new Qs(this);
|
|
10680
10680
|
}
|
|
10681
10681
|
}
|
|
10682
|
-
class
|
|
10682
|
+
class Mi {
|
|
10683
10683
|
constructor() {
|
|
10684
10684
|
this.functions = [], this.functionIdxByName = {}, this.nImportFunctions = 0, this.nInternalFunctions = 0, this.memory = {
|
|
10685
10685
|
pagesSize: 1,
|
|
@@ -10705,7 +10705,7 @@ class Di {
|
|
|
10705
10705
|
if (typeof this.functionIdxByName[t] < "u")
|
|
10706
10706
|
throw new Error(`Function already defined: ${t}`);
|
|
10707
10707
|
const e = this.functions.length;
|
|
10708
|
-
return this.functionIdxByName[t] = e, this.functions.push(new
|
|
10708
|
+
return this.functionIdxByName[t] = e, this.functions.push(new qa(this, t, "internal")), this.nInternalFunctions++, this.functions[e];
|
|
10709
10709
|
}
|
|
10710
10710
|
addIimportFunction(t, e, n) {
|
|
10711
10711
|
if (typeof this.functionIdxByName[t] < "u")
|
|
@@ -10714,7 +10714,7 @@ class Di {
|
|
|
10714
10714
|
throw new Error(`Import functions must be declared before internal: ${t}`);
|
|
10715
10715
|
let a = n || t;
|
|
10716
10716
|
const s = this.functions.length;
|
|
10717
|
-
return this.functionIdxByName[t] = s, this.functions.push(new
|
|
10717
|
+
return this.functionIdxByName[t] = s, this.functions.push(new qa(this, t, "import", e, a)), this.nImportFunctions++, this.functions[s];
|
|
10718
10718
|
}
|
|
10719
10719
|
setMemory(t, e, n) {
|
|
10720
10720
|
this.memory = {
|
|
@@ -10757,11 +10757,11 @@ class Di {
|
|
|
10757
10757
|
this.signatures = [];
|
|
10758
10758
|
const t = {};
|
|
10759
10759
|
if (this.functionsTable.length > 0) {
|
|
10760
|
-
const e = this.functions[this.functionsTable[0]].getSignature(), n = "s_" +
|
|
10760
|
+
const e = this.functions[this.functionsTable[0]].getSignature(), n = "s_" + Ta(e);
|
|
10761
10761
|
t[n] = 0, this.signatures.push(e);
|
|
10762
10762
|
}
|
|
10763
10763
|
for (let e = 0; e < this.functions.length; e++) {
|
|
10764
|
-
const n = this.functions[e].getSignature(), a = "s_" +
|
|
10764
|
+
const n = this.functions[e].getSignature(), a = "s_" + Ta(n);
|
|
10765
10765
|
typeof t[a] > "u" && (t[a] = this.signatures.length, this.signatures.push(n)), this.functions[e].signatureIdx = t[a];
|
|
10766
10766
|
}
|
|
10767
10767
|
}
|
|
@@ -10837,7 +10837,7 @@ class Di {
|
|
|
10837
10837
|
// Table (0 in MVP)
|
|
10838
10838
|
65,
|
|
10839
10839
|
// offset 0
|
|
10840
|
-
...
|
|
10840
|
+
...Dn(0),
|
|
10841
10841
|
11,
|
|
10842
10842
|
...Rt(this.functionsTable.length),
|
|
10843
10843
|
...t
|
|
@@ -10880,7 +10880,7 @@ class Di {
|
|
|
10880
10880
|
t.push([
|
|
10881
10881
|
0,
|
|
10882
10882
|
65,
|
|
10883
|
-
...
|
|
10883
|
+
...Dn(this.datas[e].offset),
|
|
10884
10884
|
11,
|
|
10885
10885
|
...Rt(this.datas[e].bytes.length),
|
|
10886
10886
|
...this.datas[e].bytes
|
|
@@ -10892,9 +10892,9 @@ class Di {
|
|
|
10892
10892
|
}
|
|
10893
10893
|
}
|
|
10894
10894
|
globalThis.curve_bn128 = null;
|
|
10895
|
-
async function
|
|
10896
|
-
const e = new
|
|
10897
|
-
e.setMemory(25),
|
|
10895
|
+
async function Js(c, t) {
|
|
10896
|
+
const e = new Mi();
|
|
10897
|
+
e.setMemory(25), Is(e), t && t(e);
|
|
10898
10898
|
const n = {};
|
|
10899
10899
|
if (n.code = e.build(), n.pq = e.modules.f1m.pq, n.pr = e.modules.frm.pq, n.pG1gen = e.modules.bn128.pG1gen, n.pG1zero = e.modules.bn128.pG1zero, n.pG1b = e.modules.bn128.pG1b, n.pG2gen = e.modules.bn128.pG2gen, n.pG2zero = e.modules.bn128.pG2zero, n.pG2b = e.modules.bn128.pG2b, n.pOneT = e.modules.bn128.pOneT, n.prePSize = e.modules.bn128.prePSize, n.preQSize = e.modules.bn128.preQSize, n.n8q = 32, n.n8r = 32, n.q = e.modules.bn128.q, n.r = e.modules.bn128.r, !c && globalThis.curve_bn128)
|
|
10900
10900
|
return globalThis.curve_bn128;
|
|
@@ -10907,15 +10907,15 @@ async function Qs(c, t) {
|
|
|
10907
10907
|
n8r: 32,
|
|
10908
10908
|
cofactorG2: ee("30644e72e131a029b85045b68181585e06ceecda572a2489345f2299c0f9fa8d", 16),
|
|
10909
10909
|
singleThread: !!c
|
|
10910
|
-
}, s = await
|
|
10910
|
+
}, s = await ki(a);
|
|
10911
10911
|
return s.terminate = async function() {
|
|
10912
10912
|
a.singleThread || (globalThis.curve_bn128 = null, await this.tm.terminate());
|
|
10913
10913
|
}, c || (globalThis.curve_bn128 = s), s;
|
|
10914
10914
|
}
|
|
10915
10915
|
globalThis.curve_bls12381 = null;
|
|
10916
|
-
async function
|
|
10917
|
-
const e = new
|
|
10918
|
-
e.setMemory(25),
|
|
10916
|
+
async function Ks(c, t) {
|
|
10917
|
+
const e = new Mi();
|
|
10918
|
+
e.setMemory(25), Os(e), t && t(e);
|
|
10919
10919
|
const n = {};
|
|
10920
10920
|
if (n.code = e.build(), n.pq = e.modules.f1m.pq, n.pr = e.modules.frm.pq, n.pG1gen = e.modules.bls12381.pG1gen, n.pG1zero = e.modules.bls12381.pG1zero, n.pG1b = e.modules.bls12381.pG1b, n.pG2gen = e.modules.bls12381.pG2gen, n.pG2zero = e.modules.bls12381.pG2zero, n.pG2b = e.modules.bls12381.pG2b, n.pOneT = e.modules.bls12381.pOneT, n.prePSize = e.modules.bls12381.prePSize, n.preQSize = e.modules.bls12381.preQSize, n.n8q = 48, n.n8r = 32, n.q = e.modules.bls12381.q, n.r = e.modules.bls12381.r, !c && globalThis.curve_bls12381)
|
|
10921
10921
|
return globalThis.curve_bls12381;
|
|
@@ -10929,7 +10929,7 @@ async function Js(c, t) {
|
|
|
10929
10929
|
cofactorG1: ee("0x396c8c005555e1568c00aaab0000aaab", 16),
|
|
10930
10930
|
cofactorG2: ee("0x5d543a95414e7f1091d50792876a202cd91de4547085abaa68a205b2e5a7ddfa628f1cb4d9e82ef21537e293a6691ae1616ec6e786f0c70cf1c38e31c7238e5", 16),
|
|
10931
10931
|
singleThread: !!c
|
|
10932
|
-
}, s = await
|
|
10932
|
+
}, s = await ki(a);
|
|
10933
10933
|
return s.terminate = async function() {
|
|
10934
10934
|
a.singleThread || (globalThis.curve_bls12381 = null, await this.tm.terminate());
|
|
10935
10935
|
}, c || (globalThis.curve_bls12381 = s), s;
|
|
@@ -10938,16 +10938,16 @@ ee("73eda753299d7d483339d80809a1d80553bda402fffe5bfeffffffff00000001", 16);
|
|
|
10938
10938
|
ee("21888242871839275222246405745257275088548364400416034343698204186575808495617");
|
|
10939
10939
|
ee("1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab", 16);
|
|
10940
10940
|
ee("21888242871839275222246405745257275088696311157297823662689037894645226208583");
|
|
10941
|
-
const Yt =
|
|
10941
|
+
const Yt = Sc, ln = Ds;
|
|
10942
10942
|
Yt.e("73eda753299d7d483339d80809a1d80553bda402fffe5bfeffffffff00000001", 16);
|
|
10943
10943
|
Yt.e("21888242871839275222246405745257275088548364400416034343698204186575808495617");
|
|
10944
|
-
const
|
|
10945
|
-
async function
|
|
10944
|
+
const Ys = Yt.e("1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab", 16), tr = Yt.e("21888242871839275222246405745257275088696311157297823662689037894645226208583");
|
|
10945
|
+
async function Kn(c) {
|
|
10946
10946
|
let t;
|
|
10947
|
-
if (Yt.eq(c,
|
|
10948
|
-
t = await Qs();
|
|
10949
|
-
else if (Yt.eq(c, Ks))
|
|
10947
|
+
if (Yt.eq(c, tr))
|
|
10950
10948
|
t = await Js();
|
|
10949
|
+
else if (Yt.eq(c, Ys))
|
|
10950
|
+
t = await Ks();
|
|
10951
10951
|
else
|
|
10952
10952
|
throw new Error(`Curve not supported: ${Yt.toString(c)}`);
|
|
10953
10953
|
return t;
|
|
@@ -10955,7 +10955,7 @@ async function Jn(c) {
|
|
|
10955
10955
|
function un(c) {
|
|
10956
10956
|
return (c & 4294901760 ? (c &= 4294901760, 16) : 0) | (c & 4278255360 ? (c &= 4278255360, 8) : 0) | (c & 4042322160 ? (c &= 4042322160, 4) : 0) | (c & 3435973836 ? (c &= 3435973836, 2) : 0) | (c & 2863311530) !== 0;
|
|
10957
10957
|
}
|
|
10958
|
-
const
|
|
10958
|
+
const er = 1, nr = 2, Ri = 10, ar = 2;
|
|
10959
10959
|
async function ue(c, t, e) {
|
|
10960
10960
|
const n = await c.read(t.G1.F.n8 * 2), a = t.G1.fromRprLEM(n, 0);
|
|
10961
10961
|
return e ? t.G1.toObject(a) : a;
|
|
@@ -10964,56 +10964,56 @@ async function Ue(c, t, e) {
|
|
|
10964
10964
|
const n = await c.read(t.G2.F.n8 * 2), a = t.G2.fromRprLEM(n, 0);
|
|
10965
10965
|
return e ? t.G2.toObject(a) : a;
|
|
10966
10966
|
}
|
|
10967
|
-
async function
|
|
10967
|
+
async function ir(c, t, e) {
|
|
10968
10968
|
await Ge(c, t, 1);
|
|
10969
10969
|
const n = await c.readULE32();
|
|
10970
|
-
if (await Ze(c), n ===
|
|
10971
|
-
return await ir(c, t, e);
|
|
10972
|
-
if (n === er)
|
|
10970
|
+
if (await Ze(c), n === er)
|
|
10973
10971
|
return await or(c, t, e);
|
|
10974
|
-
if (n ===
|
|
10972
|
+
if (n === nr)
|
|
10975
10973
|
return await cr(c, t, e);
|
|
10974
|
+
if (n === Ri)
|
|
10975
|
+
return await sr(c, t, e);
|
|
10976
10976
|
throw new Error("Protocol not supported: ");
|
|
10977
10977
|
}
|
|
10978
|
-
async function
|
|
10978
|
+
async function or(c, t, e) {
|
|
10979
10979
|
const n = {};
|
|
10980
10980
|
n.protocol = "groth16", await Ge(c, t, 2);
|
|
10981
10981
|
const a = await c.readULE32();
|
|
10982
10982
|
n.n8q = a, n.q = await we(c, a);
|
|
10983
10983
|
const s = await c.readULE32();
|
|
10984
|
-
return n.n8r = s, n.r = await we(c, s), n.curve = await
|
|
10984
|
+
return n.n8r = s, n.r = await we(c, s), n.curve = await Kn(n.q), n.nVars = await c.readULE32(), n.nPublic = await c.readULE32(), n.domainSize = await c.readULE32(), n.power = un(n.domainSize), n.vk_alpha_1 = await ue(c, n.curve, e), n.vk_beta_1 = await ue(c, n.curve, e), n.vk_beta_2 = await Ue(c, n.curve, e), n.vk_gamma_2 = await Ue(c, n.curve, e), n.vk_delta_1 = await ue(c, n.curve, e), n.vk_delta_2 = await Ue(c, n.curve, e), await Ze(c), n;
|
|
10985
10985
|
}
|
|
10986
|
-
async function
|
|
10986
|
+
async function cr(c, t, e) {
|
|
10987
10987
|
const n = {};
|
|
10988
10988
|
n.protocol = "plonk", await Ge(c, t, 2);
|
|
10989
10989
|
const a = await c.readULE32();
|
|
10990
10990
|
n.n8q = a, n.q = await we(c, a);
|
|
10991
10991
|
const s = await c.readULE32();
|
|
10992
|
-
return n.n8r = s, n.r = await we(c, s), n.curve = await
|
|
10992
|
+
return n.n8r = s, n.r = await we(c, s), n.curve = await Kn(n.q), n.nVars = await c.readULE32(), n.nPublic = await c.readULE32(), n.domainSize = await c.readULE32(), n.power = un(n.domainSize), n.nAdditions = await c.readULE32(), n.nConstrains = await c.readULE32(), n.k1 = await c.read(s), n.k2 = await c.read(s), n.Qm = await ue(c, n.curve, e), n.Ql = await ue(c, n.curve, e), n.Qr = await ue(c, n.curve, e), n.Qo = await ue(c, n.curve, e), n.Qc = await ue(c, n.curve, e), n.S1 = await ue(c, n.curve, e), n.S2 = await ue(c, n.curve, e), n.S3 = await ue(c, n.curve, e), n.X_2 = await Ue(c, n.curve, e), await Ze(c), n;
|
|
10993
10993
|
}
|
|
10994
|
-
async function
|
|
10994
|
+
async function sr(c, t, e) {
|
|
10995
10995
|
const n = {};
|
|
10996
|
-
n.protocol = "fflonk", n.protocolId =
|
|
10996
|
+
n.protocol = "fflonk", n.protocolId = Ri, await Ge(c, t, ar);
|
|
10997
10997
|
const a = await c.readULE32();
|
|
10998
|
-
n.n8q = a, n.q = await we(c, a), n.curve = await
|
|
10998
|
+
n.n8q = a, n.q = await we(c, a), n.curve = await Kn(n.q);
|
|
10999
10999
|
const s = await c.readULE32();
|
|
11000
11000
|
return n.n8r = s, n.r = await we(c, s), n.nVars = await c.readULE32(), n.nPublic = await c.readULE32(), n.domainSize = await c.readULE32(), n.power = un(n.domainSize), n.nAdditions = await c.readULE32(), n.nConstraints = await c.readULE32(), n.k1 = await c.read(s), n.k2 = await c.read(s), n.w3 = await c.read(s), n.w4 = await c.read(s), n.w8 = await c.read(s), n.wr = await c.read(s), n.X_2 = await Ue(c, n.curve, e), n.C0 = await ue(c, n.curve, e), await Ze(c), n;
|
|
11001
11001
|
}
|
|
11002
|
-
async function
|
|
11003
|
-
await
|
|
11002
|
+
async function rr(c, t, e) {
|
|
11003
|
+
await ua(c, 1);
|
|
11004
11004
|
const n = (Math.floor((Yt.bitLength(e) - 1) / 64) + 1) * 8;
|
|
11005
|
-
if (await c.writeULE32(n), await
|
|
11005
|
+
if (await c.writeULE32(n), await dc(c, e, n), t.byteLength % n != 0)
|
|
11006
11006
|
throw new Error("Invalid witness length");
|
|
11007
|
-
await c.writeULE32(t.byteLength / n), await
|
|
11007
|
+
await c.writeULE32(t.byteLength / n), await da(c), await ua(c, 2), await c.write(t), await da(c);
|
|
11008
11008
|
}
|
|
11009
|
-
async function
|
|
11009
|
+
async function lr(c, t) {
|
|
11010
11010
|
await Ge(c, t, 1);
|
|
11011
11011
|
const e = await c.readULE32(), n = await we(c, e), a = await c.readULE32();
|
|
11012
11012
|
return await Ze(c), { n8: e, q: n, nWitness: a };
|
|
11013
11013
|
}
|
|
11014
|
-
const { stringifyBigInts:
|
|
11015
|
-
async function
|
|
11016
|
-
const { fd: n, sections: a } = await
|
|
11014
|
+
const { stringifyBigInts: Da } = ln;
|
|
11015
|
+
async function ur(c, t, e) {
|
|
11016
|
+
const { fd: n, sections: a } = await la(t, "wtns", 2, 33554432, 8388608), s = await lr(n, a), { fd: g, sections: d } = await la(c, "zkey", 2, 1 << 25, 1 << 23), C = await ir(g, d);
|
|
11017
11017
|
if (C.protocol != "groth16")
|
|
11018
11018
|
throw new Error("zkey file is not groth16");
|
|
11019
11019
|
if (!Yt.eq(C.r, s.q))
|
|
@@ -11026,9 +11026,9 @@ async function lr(c, t, e) {
|
|
|
11026
11026
|
e && e.debug("Reading Coeffs");
|
|
11027
11027
|
const O = await Ae(g, d, 4);
|
|
11028
11028
|
e && e.debug("Building ABC");
|
|
11029
|
-
const [L, I, v] = await
|
|
11029
|
+
const [L, I, v] = await dr(l, C, x, O, e), U = m == o.s ? l.Fr.shift : l.Fr.w[m + 1], w = await o.ifft(L, "", "", e, "IFFT_A"), S = await o.batchApplyKey(w, o.e(1), U), F = await o.fft(S, "", "", e, "FFT_A"), r = await o.ifft(I, "", "", e, "IFFT_B"), h = await o.batchApplyKey(r, o.e(1), U), R = await o.fft(h, "", "", e, "FFT_B"), j = await o.ifft(v, "", "", e, "IFFT_C"), T = await o.batchApplyKey(j, o.e(1), U), D = await o.fft(T, "", "", e, "FFT_C");
|
|
11030
11030
|
e && e.debug("Join ABC");
|
|
11031
|
-
const A = await
|
|
11031
|
+
const A = await fr(l, C, F, R, D, e);
|
|
11032
11032
|
let M = {};
|
|
11033
11033
|
e && e.debug("Reading A Points");
|
|
11034
11034
|
const H = await Ae(g, d, 5);
|
|
@@ -11047,9 +11047,9 @@ async function lr(c, t, e) {
|
|
|
11047
11047
|
const i = x.slice(P * o.n8, P * o.n8 + o.n8);
|
|
11048
11048
|
K.push(Yt.fromRprLE(i));
|
|
11049
11049
|
}
|
|
11050
|
-
return M.pi_a = y.toObject(y.toAffine(M.pi_a)), M.pi_b = E.toObject(E.toAffine(M.pi_b)), M.pi_c = y.toObject(y.toAffine(M.pi_c)), M.protocol = "groth16", M.curve = l.name, await g.close(), await n.close(), M =
|
|
11050
|
+
return M.pi_a = y.toObject(y.toAffine(M.pi_a)), M.pi_b = E.toObject(E.toAffine(M.pi_b)), M.pi_c = y.toObject(y.toAffine(M.pi_c)), M.protocol = "groth16", M.curve = l.name, await g.close(), await n.close(), M = Da(M), K = Da(K), { proof: M, publicSignals: K };
|
|
11051
11051
|
}
|
|
11052
|
-
async function
|
|
11052
|
+
async function dr(c, t, e, n, a) {
|
|
11053
11053
|
const s = c.Fr.n8, g = 4 * 3 + t.n8r, d = (n.byteLength - 4) / g, C = new Vt(t.domainSize * s), l = new Vt(t.domainSize * s), o = new Vt(t.domainSize * s), y = [C, l];
|
|
11054
11054
|
for (let E = 0; E < d; E++) {
|
|
11055
11055
|
a && E % 1e6 == 0 && a.debug(`QAP AB: ${E}/${d}`);
|
|
@@ -11072,7 +11072,7 @@ async function ur(c, t, e, n, a) {
|
|
|
11072
11072
|
);
|
|
11073
11073
|
return [C, l, o];
|
|
11074
11074
|
}
|
|
11075
|
-
async function
|
|
11075
|
+
async function fr(c, t, e, n, a, s) {
|
|
11076
11076
|
const d = c.Fr.n8, C = Math.floor(e.byteLength / c.Fr.n8), l = [];
|
|
11077
11077
|
for (let m = 0; m < C; m += 4194304) {
|
|
11078
11078
|
s && s.debug(`JoinABC: ${m}/${C}`);
|
|
@@ -11097,7 +11097,7 @@ async function dr(c, t, e, n, a, s) {
|
|
|
11097
11097
|
y.set(o[m][0], E), E += o[m][0].byteLength;
|
|
11098
11098
|
return y;
|
|
11099
11099
|
}
|
|
11100
|
-
function
|
|
11100
|
+
function Ni(c) {
|
|
11101
11101
|
var t = [];
|
|
11102
11102
|
return e(t, c), t;
|
|
11103
11103
|
function e(n, a) {
|
|
@@ -11108,7 +11108,7 @@ function Ri(c) {
|
|
|
11108
11108
|
n.push(a);
|
|
11109
11109
|
}
|
|
11110
11110
|
}
|
|
11111
|
-
function
|
|
11111
|
+
function zi(c) {
|
|
11112
11112
|
const t = BigInt(2) ** BigInt(64);
|
|
11113
11113
|
let e = BigInt("0xCBF29CE484222325");
|
|
11114
11114
|
for (var n = 0; n < c.length; n++)
|
|
@@ -11116,7 +11116,7 @@ function Ni(c) {
|
|
|
11116
11116
|
let a = e.toString(16), s = 16 - a.length;
|
|
11117
11117
|
return a = "0".repeat(s).concat(a), a;
|
|
11118
11118
|
}
|
|
11119
|
-
function
|
|
11119
|
+
function _r(c, t) {
|
|
11120
11120
|
const e = [];
|
|
11121
11121
|
let n = BigInt(c);
|
|
11122
11122
|
const a = BigInt(4294967296);
|
|
@@ -11127,7 +11127,7 @@ function fr(c, t) {
|
|
|
11127
11127
|
e.unshift(0), s--;
|
|
11128
11128
|
return e;
|
|
11129
11129
|
}
|
|
11130
|
-
async function
|
|
11130
|
+
async function gr(c, t) {
|
|
11131
11131
|
t = t || {};
|
|
11132
11132
|
let e = 32767, n, a = !1;
|
|
11133
11133
|
for (; !a; )
|
|
@@ -11194,7 +11194,7 @@ async function _r(c, t) {
|
|
|
11194
11194
|
});
|
|
11195
11195
|
typeof E.exports.getVersion == "function" && (l = E.exports.getVersion()), typeof E.exports.getMinorVersion == "function" && (o = E.exports.getMinorVersion()), typeof E.exports.getPatchVersion == "function" && (y = E.exports.getPatchVersion());
|
|
11196
11196
|
const m = t && (t.sanityCheck || t.logGetSignal || t.logSetSignal || t.logStartComponent || t.logFinishComponent);
|
|
11197
|
-
return l === 2 ? g = new
|
|
11197
|
+
return l === 2 ? g = new hr(E, m) : g = new pr(n, E, m), g;
|
|
11198
11198
|
function x() {
|
|
11199
11199
|
for (var L = "", I = E.exports.getMessageChar(); I != 0; )
|
|
11200
11200
|
L += String.fromCharCode(I), I = E.exports.getMessageChar();
|
|
@@ -11207,13 +11207,13 @@ async function _r(c, t) {
|
|
|
11207
11207
|
return String.fromCharCode.apply(null, v);
|
|
11208
11208
|
}
|
|
11209
11209
|
}
|
|
11210
|
-
class
|
|
11210
|
+
class pr {
|
|
11211
11211
|
constructor(t, e, n) {
|
|
11212
11212
|
this.memory = t, this.i32 = new Uint32Array(t.buffer), this.instance = e, this.n32 = (this.instance.exports.getFrLen() >> 2) - 2;
|
|
11213
11213
|
const a = this.instance.exports.getPRawPrime(), s = new Array(this.n32);
|
|
11214
11214
|
for (let g = 0; g < this.n32; g++)
|
|
11215
11215
|
s[this.n32 - 1 - g] = this.i32[(a >> 2) + g];
|
|
11216
|
-
this.prime = Yt.fromArray(s, 4294967296), this.Fr = new
|
|
11216
|
+
this.prime = Yt.fromArray(s, 4294967296), this.Fr = new jc(this.prime), this.mask32 = Yt.fromString("FFFFFFFF", 16), this.NVars = this.instance.exports.getNVars(), this.n64 = Math.floor((this.Fr.bitLength - 1) / 64) + 1, this.R = this.Fr.e(Yt.shiftLeft(1, this.n64 * 64)), this.RInv = this.Fr.inv(this.R), this.sanityCheck = n;
|
|
11217
11217
|
}
|
|
11218
11218
|
circom_version() {
|
|
11219
11219
|
return 1;
|
|
@@ -11222,13 +11222,13 @@ class gr {
|
|
|
11222
11222
|
this.instance.exports.init(this.sanityCheck || e ? 1 : 0);
|
|
11223
11223
|
const n = this.allocInt(), a = this.allocFr();
|
|
11224
11224
|
Object.keys(t).forEach((g) => {
|
|
11225
|
-
const d =
|
|
11225
|
+
const d = zi(g), C = parseInt(d.slice(0, 8), 16), l = parseInt(d.slice(8, 16), 16);
|
|
11226
11226
|
try {
|
|
11227
11227
|
this.instance.exports.getSignalOffset32(n, 0, C, l);
|
|
11228
11228
|
} catch {
|
|
11229
11229
|
throw new Error(`Signal ${g} is not an input of the circuit.`);
|
|
11230
11230
|
}
|
|
11231
|
-
const o = this.getInt(n), y =
|
|
11231
|
+
const o = this.getInt(n), y = Ni(t[g]);
|
|
11232
11232
|
for (let E = 0; E < y.length; E++)
|
|
11233
11233
|
this.setFr(a, y[E]), this.instance.exports.setSignal(0, 0, o + E, a);
|
|
11234
11234
|
});
|
|
@@ -11295,7 +11295,7 @@ class gr {
|
|
|
11295
11295
|
}
|
|
11296
11296
|
}
|
|
11297
11297
|
}
|
|
11298
|
-
class
|
|
11298
|
+
class hr {
|
|
11299
11299
|
constructor(t, e) {
|
|
11300
11300
|
this.instance = t, this.version = this.instance.exports.getVersion(), this.n32 = this.instance.exports.getFieldNumLen32(), this.instance.exports.getRawPrime();
|
|
11301
11301
|
const n = new Array(this.n32);
|
|
@@ -11311,9 +11311,9 @@ class pr {
|
|
|
11311
11311
|
const n = Object.keys(t);
|
|
11312
11312
|
var a = 0;
|
|
11313
11313
|
if (n.forEach((s) => {
|
|
11314
|
-
const g =
|
|
11314
|
+
const g = zi(s), d = parseInt(g.slice(0, 8), 16), C = parseInt(g.slice(8, 16), 16), l = Ni(t[s]);
|
|
11315
11315
|
for (let o = 0; o < l.length; o++) {
|
|
11316
|
-
const y =
|
|
11316
|
+
const y = _r(l[o], this.n32);
|
|
11317
11317
|
for (let E = 0; E < this.n32; E++)
|
|
11318
11318
|
this.instance.exports.writeSharedRWMemory(E, y[this.n32 - 1 - E]);
|
|
11319
11319
|
try {
|
|
@@ -11357,35 +11357,35 @@ class pr {
|
|
|
11357
11357
|
return a;
|
|
11358
11358
|
}
|
|
11359
11359
|
}
|
|
11360
|
-
const { unstringifyBigInts:
|
|
11361
|
-
async function
|
|
11362
|
-
const a =
|
|
11360
|
+
const { unstringifyBigInts: Lr } = ln;
|
|
11361
|
+
async function mr(c, t, e, n) {
|
|
11362
|
+
const a = Lr(c), s = await ni(t), g = await s.read(s.totalSize);
|
|
11363
11363
|
await s.close();
|
|
11364
|
-
const d = await
|
|
11364
|
+
const d = await gr(g);
|
|
11365
11365
|
if (d.circom_version() == 1) {
|
|
11366
|
-
const C = await d.calculateBinWitness(a), l = await
|
|
11367
|
-
await
|
|
11366
|
+
const C = await d.calculateBinWitness(a), l = await uc(e, "wtns", 2, 2);
|
|
11367
|
+
await rr(l, C, d.prime), await l.close();
|
|
11368
11368
|
} else {
|
|
11369
|
-
const C = await
|
|
11369
|
+
const C = await ei(e), l = await d.calculateWTNSBin(a);
|
|
11370
11370
|
await C.write(l), await C.close();
|
|
11371
11371
|
}
|
|
11372
11372
|
}
|
|
11373
|
-
const { unstringifyBigInts:
|
|
11374
|
-
async function
|
|
11375
|
-
const a =
|
|
11373
|
+
const { unstringifyBigInts: br } = ln;
|
|
11374
|
+
async function yr(c, t, e, n) {
|
|
11375
|
+
const a = br(c), s = {
|
|
11376
11376
|
type: "mem"
|
|
11377
11377
|
};
|
|
11378
|
-
return await
|
|
11378
|
+
return await mr(a, t, s), await ur(e, s, n);
|
|
11379
11379
|
}
|
|
11380
|
-
const { unstringifyBigInts:
|
|
11380
|
+
const { unstringifyBigInts: Ma } = ln;
|
|
11381
11381
|
function pe(c) {
|
|
11382
11382
|
let t = c.toString(16);
|
|
11383
11383
|
for (; t.length < 64; )
|
|
11384
11384
|
t = "0" + t;
|
|
11385
11385
|
return t = `"0x${t}"`, t;
|
|
11386
11386
|
}
|
|
11387
|
-
async function
|
|
11388
|
-
const e =
|
|
11387
|
+
async function Cr(c, t) {
|
|
11388
|
+
const e = Ma(c), n = Ma(t);
|
|
11389
11389
|
let a = "";
|
|
11390
11390
|
for (let g = 0; g < n.length; g++)
|
|
11391
11391
|
a != "" && (a = a + ","), a = a + pe(n[g]);
|
|
@@ -11394,7 +11394,7 @@ async function yr(c, t) {
|
|
|
11394
11394
|
}
|
|
11395
11395
|
Yt.e("73eda753299d7d483339d80809a1d80553bda402fffe5bfeffffffff00000001", 16);
|
|
11396
11396
|
Yt.e("21888242871839275222246405745257275088548364400416034343698204186575808495617");
|
|
11397
|
-
var
|
|
11397
|
+
var Ar = {}, Ui = {};
|
|
11398
11398
|
(function(c) {
|
|
11399
11399
|
var t = /[|\\{}()[\]^$+*?.]/g, e = Object.prototype.hasOwnProperty, n = function(l, o) {
|
|
11400
11400
|
return e.apply(l, [o]);
|
|
@@ -11479,19 +11479,19 @@ function encode_char(c) {
|
|
|
11479
11479
|
return { __proto__: null };
|
|
11480
11480
|
};
|
|
11481
11481
|
}();
|
|
11482
|
-
})(
|
|
11483
|
-
const
|
|
11482
|
+
})(Ui);
|
|
11483
|
+
const Fr = "ejs", Er = "Embedded JavaScript templates", wr = [
|
|
11484
11484
|
"template",
|
|
11485
11485
|
"engine",
|
|
11486
11486
|
"ejs"
|
|
11487
|
-
],
|
|
11487
|
+
], Br = "3.1.9", vr = "Matthew Eernisse <mde@fleegix.org> (http://fleegix.org)", xr = "Apache-2.0", Sr = {
|
|
11488
11488
|
ejs: "./bin/cli.js"
|
|
11489
|
-
},
|
|
11489
|
+
}, Ir = "./lib/ejs.js", Or = "ejs.min.js", Pr = "ejs.min.js", kr = {
|
|
11490
11490
|
type: "git",
|
|
11491
11491
|
url: "git://github.com/mde/ejs.git"
|
|
11492
|
-
},
|
|
11492
|
+
}, Tr = "https://github.com/mde/ejs/issues", qr = "https://github.com/mde/ejs", Dr = {
|
|
11493
11493
|
jake: "^10.8.5"
|
|
11494
|
-
},
|
|
11494
|
+
}, Mr = {
|
|
11495
11495
|
browserify: "^16.5.1",
|
|
11496
11496
|
eslint: "^6.8.0",
|
|
11497
11497
|
"git-directory-deploy": "^1.5.1",
|
|
@@ -11499,29 +11499,29 @@ const Ar = "ejs", Fr = "Embedded JavaScript templates", Er = [
|
|
|
11499
11499
|
"lru-cache": "^4.0.1",
|
|
11500
11500
|
mocha: "^10.2.0",
|
|
11501
11501
|
"uglify-js": "^3.3.16"
|
|
11502
|
-
}, Mr = {
|
|
11503
|
-
node: ">=0.10.0"
|
|
11504
11502
|
}, Rr = {
|
|
11503
|
+
node: ">=0.10.0"
|
|
11504
|
+
}, Nr = {
|
|
11505
11505
|
test: "mocha -u tdd"
|
|
11506
11506
|
};
|
|
11507
|
-
var
|
|
11508
|
-
name:
|
|
11509
|
-
description:
|
|
11510
|
-
keywords:
|
|
11511
|
-
version:
|
|
11512
|
-
author:
|
|
11513
|
-
license:
|
|
11514
|
-
bin:
|
|
11515
|
-
main:
|
|
11516
|
-
jsdelivr:
|
|
11517
|
-
unpkg:
|
|
11518
|
-
repository:
|
|
11519
|
-
bugs:
|
|
11520
|
-
homepage:
|
|
11521
|
-
dependencies:
|
|
11522
|
-
devDependencies:
|
|
11523
|
-
engines:
|
|
11524
|
-
scripts:
|
|
11507
|
+
var zr = {
|
|
11508
|
+
name: Fr,
|
|
11509
|
+
description: Er,
|
|
11510
|
+
keywords: wr,
|
|
11511
|
+
version: Br,
|
|
11512
|
+
author: vr,
|
|
11513
|
+
license: xr,
|
|
11514
|
+
bin: Sr,
|
|
11515
|
+
main: Ir,
|
|
11516
|
+
jsdelivr: Or,
|
|
11517
|
+
unpkg: Pr,
|
|
11518
|
+
repository: kr,
|
|
11519
|
+
bugs: Tr,
|
|
11520
|
+
homepage: qr,
|
|
11521
|
+
dependencies: Dr,
|
|
11522
|
+
devDependencies: Mr,
|
|
11523
|
+
engines: Rr,
|
|
11524
|
+
scripts: Nr
|
|
11525
11525
|
};
|
|
11526
11526
|
(function(c) {
|
|
11527
11527
|
/**
|
|
@@ -11531,7 +11531,7 @@ var Nr = {
|
|
|
11531
11531
|
* @project EJS
|
|
11532
11532
|
* @license {@link http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0}
|
|
11533
11533
|
*/
|
|
11534
|
-
var t =
|
|
11534
|
+
var t = vn, e = vn, n = Ui, a = !1, s = zr.version, g = "<", d = ">", C = "%", l = "locals", o = "ejs", y = "(<%%|%%>|<%=|<%-|<%_|<%#|<%|%>|-%>|_%>)", E = [
|
|
11535
11535
|
"delimiter",
|
|
11536
11536
|
"scope",
|
|
11537
11537
|
"context",
|
|
@@ -11827,9 +11827,9 @@ try {
|
|
|
11827
11827
|
`);
|
|
11828
11828
|
}
|
|
11829
11829
|
}, c.escapeXML = n.escapeXML, c.__express = c.renderFile, c.VERSION = s, c.name = o, typeof window < "u" && (window.ejs = c);
|
|
11830
|
-
})(
|
|
11831
|
-
var
|
|
11832
|
-
|
|
11830
|
+
})(Ar);
|
|
11831
|
+
var Yn = { exports: {} };
|
|
11832
|
+
Yn.exports;
|
|
11833
11833
|
(function(c) {
|
|
11834
11834
|
(function(t) {
|
|
11835
11835
|
var e, n, a, s, g, d, C, l, o, y, E, m, x, O, L, I, v;
|
|
@@ -12269,8 +12269,8 @@ Kn.exports;
|
|
|
12269
12269
|
c !== null && c.exports ? c.exports = k : t.check = k;
|
|
12270
12270
|
}
|
|
12271
12271
|
})(Ye);
|
|
12272
|
-
})(
|
|
12273
|
-
var
|
|
12272
|
+
})(Yn);
|
|
12273
|
+
var ta = Yn.exports, Ur = { exports: {} };
|
|
12274
12274
|
(function(c) {
|
|
12275
12275
|
c.exports = {
|
|
12276
12276
|
array: "arr",
|
|
@@ -12283,28 +12283,28 @@ var Yn = Kn.exports, zr = { exports: {} };
|
|
|
12283
12283
|
end: "end",
|
|
12284
12284
|
error: "err"
|
|
12285
12285
|
}, c.exports.endArray = c.exports.endPrefix + c.exports.array, c.exports.endObject = c.exports.endPrefix + c.exports.object, c.exports.endLine = `${c.exports.endPrefix}line`, c.exports.dataError = `${c.exports.error}-data`;
|
|
12286
|
-
})(
|
|
12287
|
-
|
|
12288
|
-
const
|
|
12289
|
-
|
|
12290
|
-
var
|
|
12286
|
+
})(Ur);
|
|
12287
|
+
Ua.EventEmitter;
|
|
12288
|
+
const jr = zn, ji = vn.Readable, Ra = ta;
|
|
12289
|
+
jr.inherits(an, ji);
|
|
12290
|
+
var $i = an;
|
|
12291
12291
|
function an(c, t) {
|
|
12292
|
-
return
|
|
12292
|
+
return Ra.not.instanceStrict(this, an) ? new an(c) : (Ra.assert.function(c, "Invalid read implementation"), this._read = function() {
|
|
12293
12293
|
c();
|
|
12294
|
-
},
|
|
12294
|
+
}, ji.call(this, t));
|
|
12295
12295
|
}
|
|
12296
|
-
const
|
|
12297
|
-
|
|
12298
|
-
function
|
|
12299
|
-
return
|
|
12296
|
+
const $r = ta, Gi = $i, Gr = zn;
|
|
12297
|
+
Gr.inherits(Mn, Gi);
|
|
12298
|
+
function Mn(c, t) {
|
|
12299
|
+
return $r.not.instanceStrict(this, Mn) ? new Mn(c, t) : Gi.call(this, c, { ...t, objectMode: !0 });
|
|
12300
12300
|
}
|
|
12301
12301
|
class dn extends Array {
|
|
12302
12302
|
constructor(t) {
|
|
12303
12303
|
let e, n;
|
|
12304
|
-
if (!
|
|
12304
|
+
if (!Na(t))
|
|
12305
12305
|
throw new TypeError("Argument `size` must be a positive integer.");
|
|
12306
12306
|
return super(t), this.grow = (a) => {
|
|
12307
|
-
if (!
|
|
12307
|
+
if (!Na(a))
|
|
12308
12308
|
throw new TypeError("Argument `by` must be a positive integer.");
|
|
12309
12309
|
let s;
|
|
12310
12310
|
const g = t + a;
|
|
@@ -12318,25 +12318,25 @@ class dn extends Array {
|
|
|
12318
12318
|
t = g;
|
|
12319
12319
|
}, new Proxy(this, {
|
|
12320
12320
|
get(a, s) {
|
|
12321
|
-
return
|
|
12321
|
+
return Rn(s) ? a[za(s, t)] : a[s];
|
|
12322
12322
|
},
|
|
12323
12323
|
set(a, s, g) {
|
|
12324
|
-
return
|
|
12324
|
+
return Rn(s) ? (e = za(s, t), a[e] = g, Math.abs(s) >= t ? n = !0 : n = !1) : a[s] = g, !0;
|
|
12325
12325
|
}
|
|
12326
12326
|
});
|
|
12327
12327
|
}
|
|
12328
12328
|
}
|
|
12329
|
-
function
|
|
12330
|
-
return
|
|
12329
|
+
function Na(c) {
|
|
12330
|
+
return Rn(c) && c > 0;
|
|
12331
12331
|
}
|
|
12332
|
-
function
|
|
12332
|
+
function Rn(c) {
|
|
12333
12333
|
try {
|
|
12334
12334
|
return +c % 1 === 0;
|
|
12335
12335
|
} catch {
|
|
12336
12336
|
}
|
|
12337
12337
|
return !1;
|
|
12338
12338
|
}
|
|
12339
|
-
function
|
|
12339
|
+
function za(c, t) {
|
|
12340
12340
|
return c === 0 ? 0 : c < 0 ? (t - Math.abs(c)) % t : c % t;
|
|
12341
12341
|
}
|
|
12342
12342
|
function fn() {
|
|
@@ -12349,7 +12349,7 @@ dn.prototype.unshift = fn;
|
|
|
12349
12349
|
function Ke(c) {
|
|
12350
12350
|
throw new Error('Could not dynamically require "' + c + '". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.');
|
|
12351
12351
|
}
|
|
12352
|
-
var
|
|
12352
|
+
var Zr = { exports: {} };
|
|
12353
12353
|
/*! jsonpath 1.1.1 */
|
|
12354
12354
|
(function(c, t) {
|
|
12355
12355
|
(function(e) {
|
|
@@ -13519,7 +13519,7 @@ var Gr = { exports: {} };
|
|
|
13519
13519
|
O && S.octal && Dt(S, y.StrictOctalLiteral), N = w.createLiteral(pt());
|
|
13520
13520
|
else if (p === g.Keyword) {
|
|
13521
13521
|
if (Y("function"))
|
|
13522
|
-
return
|
|
13522
|
+
return so();
|
|
13523
13523
|
Y("this") ? (pt(), N = w.createThisExpression()) : Zt(pt());
|
|
13524
13524
|
} else
|
|
13525
13525
|
p === g.BooleanLiteral ? (B = pt(), B.value = B.value === "true", N = w.createLiteral(B)) : p === g.NullLiteral ? (B = pt(), B.value = null, N = w.createLiteral(B)) : wt("/") || wt("/=") ? (typeof r.tokens < "u" ? N = w.createLiteral(mt()) : N = w.createLiteral(It()), $t()) : Zt(pt());
|
|
@@ -13704,65 +13704,65 @@ var Gr = { exports: {} };
|
|
|
13704
13704
|
var p, B, N;
|
|
13705
13705
|
return Wt("if"), vt("("), p = qt(), vt(")"), B = fe(), Y("else") ? (pt(), N = fe()) : N = null, w.createIfStatement(p, B, N);
|
|
13706
13706
|
}
|
|
13707
|
-
function
|
|
13707
|
+
function Xi() {
|
|
13708
13708
|
var p, B, N;
|
|
13709
13709
|
return Wt("do"), N = F.inIteration, F.inIteration = !0, p = fe(), F.inIteration = N, Wt("while"), vt("("), B = qt(), vt(")"), wt(";") && pt(), w.createDoWhileStatement(p, B);
|
|
13710
13710
|
}
|
|
13711
|
-
function
|
|
13711
|
+
function Vi() {
|
|
13712
13712
|
var p, B, N;
|
|
13713
13713
|
return Wt("while"), vt("("), p = qt(), vt(")"), N = F.inIteration, F.inIteration = !0, B = fe(), F.inIteration = N, w.createWhileStatement(p, B);
|
|
13714
13714
|
}
|
|
13715
|
-
function
|
|
13715
|
+
function Hi() {
|
|
13716
13716
|
var p, B, N;
|
|
13717
13717
|
return N = S, p = pt(), B = ye(), w.markEnd(w.createVariableDeclaration(B, p.value), N);
|
|
13718
13718
|
}
|
|
13719
|
-
function
|
|
13719
|
+
function Qi() {
|
|
13720
13720
|
var p, B, N, X, lt, Ct, Gt;
|
|
13721
|
-
return p = B = N = null, Wt("for"), vt("("), wt(";") ? pt() : (Y("var") || Y("let") ? (F.allowIn = !1, p =
|
|
13721
|
+
return p = B = N = null, Wt("for"), vt("("), wt(";") ? pt() : (Y("var") || Y("let") ? (F.allowIn = !1, p = Hi(), F.allowIn = !0, p.declarations.length === 1 && Y("in") && (pt(), X = p, lt = qt(), p = null)) : (F.allowIn = !1, p = qt(), F.allowIn = !0, Y("in") && (Z(p) || Dt({}, y.InvalidLHSInForIn), pt(), X = p, lt = qt(), p = null)), typeof X > "u" && vt(";")), typeof X > "u" && (wt(";") || (B = qt()), vt(";"), wt(")") || (N = qt())), vt(")"), Gt = F.inIteration, F.inIteration = !0, Ct = fe(), F.inIteration = Gt, typeof X > "u" ? w.createForStatement(p, B, N, Ct) : w.createForInStatement(X, lt, Ct);
|
|
13722
13722
|
}
|
|
13723
|
-
function
|
|
13723
|
+
function Ji() {
|
|
13724
13724
|
var p = null, B;
|
|
13725
13725
|
return Wt("continue"), x.charCodeAt(L) === 59 ? (pt(), F.inIteration || Pt({}, y.IllegalContinue), w.createContinueStatement(null)) : te() ? (F.inIteration || Pt({}, y.IllegalContinue), w.createContinueStatement(null)) : (S.type === g.Identifier && (p = Kt(), B = "$" + p.name, Object.prototype.hasOwnProperty.call(F.labelSet, B) || Pt({}, y.UnknownLabel, p.name)), _(), p === null && !F.inIteration && Pt({}, y.IllegalContinue), w.createContinueStatement(p));
|
|
13726
13726
|
}
|
|
13727
|
-
function
|
|
13727
|
+
function Ki() {
|
|
13728
13728
|
var p = null, B;
|
|
13729
13729
|
return Wt("break"), x.charCodeAt(L) === 59 ? (pt(), F.inIteration || F.inSwitch || Pt({}, y.IllegalBreak), w.createBreakStatement(null)) : te() ? (F.inIteration || F.inSwitch || Pt({}, y.IllegalBreak), w.createBreakStatement(null)) : (S.type === g.Identifier && (p = Kt(), B = "$" + p.name, Object.prototype.hasOwnProperty.call(F.labelSet, B) || Pt({}, y.UnknownLabel, p.name)), _(), p === null && !(F.inIteration || F.inSwitch) && Pt({}, y.IllegalBreak), w.createBreakStatement(p));
|
|
13730
13730
|
}
|
|
13731
|
-
function
|
|
13731
|
+
function Yi() {
|
|
13732
13732
|
var p = null;
|
|
13733
13733
|
return Wt("return"), F.inFunctionBody || Dt({}, y.IllegalReturn), x.charCodeAt(L) === 32 && M(x.charCodeAt(L + 1)) ? (p = qt(), _(), w.createReturnStatement(p)) : te() ? w.createReturnStatement(null) : (wt(";") || !wt("}") && S.type !== g.EOF && (p = qt()), _(), w.createReturnStatement(p));
|
|
13734
13734
|
}
|
|
13735
|
-
function
|
|
13735
|
+
function to() {
|
|
13736
13736
|
var p, B;
|
|
13737
13737
|
return O && (G(), Dt({}, y.StrictModeWith)), Wt("with"), vt("("), p = qt(), vt(")"), B = fe(), w.createWithStatement(p, B);
|
|
13738
13738
|
}
|
|
13739
|
-
function
|
|
13739
|
+
function eo() {
|
|
13740
13740
|
var p, B = [], N, X;
|
|
13741
13741
|
for (X = S, Y("default") ? (pt(), p = null) : (Wt("case"), p = qt()), vt(":"); L < U && !(wt("}") || Y("default") || Y("case")); )
|
|
13742
13742
|
N = fe(), B.push(N);
|
|
13743
13743
|
return w.markEnd(w.createSwitchCase(p, B), X);
|
|
13744
13744
|
}
|
|
13745
|
-
function
|
|
13745
|
+
function no() {
|
|
13746
13746
|
var p, B, N, X, lt;
|
|
13747
13747
|
if (Wt("switch"), vt("("), p = qt(), vt(")"), vt("{"), B = [], wt("}"))
|
|
13748
13748
|
return pt(), w.createSwitchStatement(p, B);
|
|
13749
13749
|
for (X = F.inSwitch, F.inSwitch = !0, lt = !1; L < U && !wt("}"); )
|
|
13750
|
-
N =
|
|
13750
|
+
N = eo(), N.test === null && (lt && Pt({}, y.MultipleDefaultsInSwitch), lt = !0), B.push(N);
|
|
13751
13751
|
return F.inSwitch = X, vt("}"), w.createSwitchStatement(p, B);
|
|
13752
13752
|
}
|
|
13753
|
-
function
|
|
13753
|
+
function ao() {
|
|
13754
13754
|
var p;
|
|
13755
13755
|
return Wt("throw"), te() && Pt({}, y.NewlineAfterThrow), p = qt(), _(), w.createThrowStatement(p);
|
|
13756
13756
|
}
|
|
13757
|
-
function
|
|
13757
|
+
function io() {
|
|
13758
13758
|
var p, B, N;
|
|
13759
13759
|
return N = S, Wt("catch"), vt("("), wt(")") && Zt(S), p = Kt(), O && J(p.name) && Dt({}, y.StrictCatchVariable), vt(")"), B = Qt(), w.markEnd(w.createCatchClause(p, B), N);
|
|
13760
13760
|
}
|
|
13761
|
-
function
|
|
13761
|
+
function oo() {
|
|
13762
13762
|
var p, B = [], N = null;
|
|
13763
|
-
return Wt("try"), p = Qt(), Y("catch") && B.push(
|
|
13763
|
+
return Wt("try"), p = Qt(), Y("catch") && B.push(io()), Y("finally") && (pt(), N = Qt()), B.length === 0 && !N && Pt({}, y.NoCatchOrFinally), w.createTryStatement(p, [], B, N);
|
|
13764
13764
|
}
|
|
13765
|
-
function
|
|
13765
|
+
function co() {
|
|
13766
13766
|
return Wt("debugger"), _(), w.createDebuggerStatement();
|
|
13767
13767
|
}
|
|
13768
13768
|
function fe() {
|
|
@@ -13779,33 +13779,33 @@ var Gr = { exports: {} };
|
|
|
13779
13779
|
if (p === g.Keyword)
|
|
13780
13780
|
switch (S.value) {
|
|
13781
13781
|
case "break":
|
|
13782
|
-
return w.markEnd(
|
|
13782
|
+
return w.markEnd(Ki(), lt);
|
|
13783
13783
|
case "continue":
|
|
13784
|
-
return w.markEnd(
|
|
13784
|
+
return w.markEnd(Ji(), lt);
|
|
13785
13785
|
case "debugger":
|
|
13786
|
-
return w.markEnd(
|
|
13786
|
+
return w.markEnd(co(), lt);
|
|
13787
13787
|
case "do":
|
|
13788
|
-
return w.markEnd(
|
|
13788
|
+
return w.markEnd(Xi(), lt);
|
|
13789
13789
|
case "for":
|
|
13790
|
-
return w.markEnd(
|
|
13790
|
+
return w.markEnd(Qi(), lt);
|
|
13791
13791
|
case "function":
|
|
13792
|
-
return w.markEnd(
|
|
13792
|
+
return w.markEnd(aa(), lt);
|
|
13793
13793
|
case "if":
|
|
13794
13794
|
return w.markEnd(He(), lt);
|
|
13795
13795
|
case "return":
|
|
13796
|
-
return w.markEnd(
|
|
13796
|
+
return w.markEnd(Yi(), lt);
|
|
13797
13797
|
case "switch":
|
|
13798
|
-
return w.markEnd(eo(), lt);
|
|
13799
|
-
case "throw":
|
|
13800
13798
|
return w.markEnd(no(), lt);
|
|
13799
|
+
case "throw":
|
|
13800
|
+
return w.markEnd(ao(), lt);
|
|
13801
13801
|
case "try":
|
|
13802
|
-
return w.markEnd(
|
|
13802
|
+
return w.markEnd(oo(), lt);
|
|
13803
13803
|
case "var":
|
|
13804
13804
|
return w.markEnd(ke(), lt);
|
|
13805
13805
|
case "while":
|
|
13806
|
-
return w.markEnd(
|
|
13806
|
+
return w.markEnd(Vi(), lt);
|
|
13807
13807
|
case "with":
|
|
13808
|
-
return w.markEnd(
|
|
13808
|
+
return w.markEnd(to(), lt);
|
|
13809
13809
|
}
|
|
13810
13810
|
return B = qt(), B.type === l.Identifier && wt(":") ? (pt(), X = "$" + B.name, Object.prototype.hasOwnProperty.call(F.labelSet, X) && Pt({}, y.Redeclaration, "Label", B.name), F.labelSet[X] = !0, N = fe(), delete F.labelSet[X], w.markEnd(w.createLabeledStatement(B, N), lt)) : (_(), w.markEnd(w.createExpressionStatement(B), lt));
|
|
13811
13811
|
}
|
|
@@ -13817,7 +13817,7 @@ var Gr = { exports: {} };
|
|
|
13817
13817
|
B.push(p);
|
|
13818
13818
|
return vt("}"), F.labelSet = Ct, F.inIteration = Gt, F.inSwitch = Xt, F.inFunctionBody = ie, w.markEnd(w.createBlockStatement(B), ae);
|
|
13819
13819
|
}
|
|
13820
|
-
function
|
|
13820
|
+
function na(p) {
|
|
13821
13821
|
var B, N = [], X, lt, Ct, Gt, Xt;
|
|
13822
13822
|
if (vt("("), !wt(")"))
|
|
13823
13823
|
for (Ct = {}; L < U && (X = S, B = Kt(), Gt = "$" + X.value, O ? (J(X.value) && (lt = X, Xt = y.StrictParamName), Object.prototype.hasOwnProperty.call(Ct, Gt) && (lt = X, Xt = y.StrictParamDupe)) : p || (J(X.value) ? (p = X, Xt = y.StrictParamName) : nt(X.value) ? (p = X, Xt = y.StrictReservedWord) : Object.prototype.hasOwnProperty.call(Ct, Gt) && (p = X, Xt = y.StrictParamDupe)), N.push(B), Ct[Gt] = !0, !wt(")")); )
|
|
@@ -13829,13 +13829,13 @@ var Gr = { exports: {} };
|
|
|
13829
13829
|
message: Xt
|
|
13830
13830
|
};
|
|
13831
13831
|
}
|
|
13832
|
-
function
|
|
13832
|
+
function aa() {
|
|
13833
13833
|
var p, B = [], N, X, lt, Ct, Gt, Xt, ie, ae;
|
|
13834
|
-
return ae = S, Wt("function"), X = S, p = Kt(), O ? J(X.value) && Dt(X, y.StrictFunctionName) : J(X.value) ? (Gt = X, Xt = y.StrictFunctionName) : nt(X.value) && (Gt = X, Xt = y.StrictReservedWord), Ct =
|
|
13834
|
+
return ae = S, Wt("function"), X = S, p = Kt(), O ? J(X.value) && Dt(X, y.StrictFunctionName) : J(X.value) ? (Gt = X, Xt = y.StrictFunctionName) : nt(X.value) && (Gt = X, Xt = y.StrictReservedWord), Ct = na(Gt), B = Ct.params, lt = Ct.stricted, Gt = Ct.firstRestricted, Ct.message && (Xt = Ct.message), ie = O, N = gn(), O && Gt && Pt(Gt, Xt), O && lt && Dt(lt, Xt), O = ie, w.markEnd(w.createFunctionDeclaration(p, B, [], N), ae);
|
|
13835
13835
|
}
|
|
13836
|
-
function
|
|
13836
|
+
function so() {
|
|
13837
13837
|
var p, B = null, N, X, lt, Ct, Gt = [], Xt, ie, ae;
|
|
13838
|
-
return ae = S, Wt("function"), wt("(") || (p = S, B = Kt(), O ? J(p.value) && Dt(p, y.StrictFunctionName) : J(p.value) ? (X = p, lt = y.StrictFunctionName) : nt(p.value) && (X = p, lt = y.StrictReservedWord)), Ct =
|
|
13838
|
+
return ae = S, Wt("function"), wt("(") || (p = S, B = Kt(), O ? J(p.value) && Dt(p, y.StrictFunctionName) : J(p.value) ? (X = p, lt = y.StrictFunctionName) : nt(p.value) && (X = p, lt = y.StrictReservedWord)), Ct = na(X), Gt = Ct.params, N = Ct.stricted, X = Ct.firstRestricted, Ct.message && (lt = Ct.message), ie = O, Xt = gn(), O && X && Pt(X, lt), O && N && Dt(N, lt), O = ie, w.markEnd(w.createFunctionExpression(B, Gt, [], Xt), ae);
|
|
13839
13839
|
}
|
|
13840
13840
|
function Te() {
|
|
13841
13841
|
if (S.type === g.Keyword)
|
|
@@ -13844,25 +13844,25 @@ var Gr = { exports: {} };
|
|
|
13844
13844
|
case "let":
|
|
13845
13845
|
return _n(S.value);
|
|
13846
13846
|
case "function":
|
|
13847
|
-
return
|
|
13847
|
+
return aa();
|
|
13848
13848
|
default:
|
|
13849
13849
|
return fe();
|
|
13850
13850
|
}
|
|
13851
13851
|
if (S.type !== g.EOF)
|
|
13852
13852
|
return fe();
|
|
13853
13853
|
}
|
|
13854
|
-
function
|
|
13854
|
+
function ro() {
|
|
13855
13855
|
for (var p, B = [], N, X, lt; L < U && (N = S, !(N.type !== g.StringLiteral || (p = Te(), B.push(p), p.expression.type !== l.Literal))); )
|
|
13856
13856
|
X = x.slice(N.start + 1, N.end - 1), X === "use strict" ? (O = !0, lt && Dt(lt, y.StrictOctalLiteral)) : !lt && N.octal && (lt = N);
|
|
13857
13857
|
for (; L < U && (p = Te(), !(typeof p > "u")); )
|
|
13858
13858
|
B.push(p);
|
|
13859
13859
|
return B;
|
|
13860
13860
|
}
|
|
13861
|
-
function
|
|
13861
|
+
function lo() {
|
|
13862
13862
|
var p, B;
|
|
13863
|
-
return G(), $t(), B = S, O = !1, p =
|
|
13863
|
+
return G(), $t(), B = S, O = !1, p = ro(), w.markEnd(w.createProgram(p), B);
|
|
13864
13864
|
}
|
|
13865
|
-
function
|
|
13865
|
+
function ia() {
|
|
13866
13866
|
var p, B, N, X = [];
|
|
13867
13867
|
for (p = 0; p < r.tokens.length; ++p)
|
|
13868
13868
|
B = r.tokens[p], N = {
|
|
@@ -13871,7 +13871,7 @@ var Gr = { exports: {} };
|
|
|
13871
13871
|
}, r.range && (N.range = B.range), r.loc && (N.loc = B.loc), X.push(N);
|
|
13872
13872
|
r.tokens = X;
|
|
13873
13873
|
}
|
|
13874
|
-
function
|
|
13874
|
+
function uo(p, B) {
|
|
13875
13875
|
var N, X, lt;
|
|
13876
13876
|
N = String, typeof p != "string" && !(p instanceof String) && (p = N(p)), w = m, x = p, L = 0, I = x.length > 0 ? 1 : 0, v = 0, U = x.length, S = null, F = {
|
|
13877
13877
|
allowIn: !0,
|
|
@@ -13894,7 +13894,7 @@ var Gr = { exports: {} };
|
|
|
13894
13894
|
} else
|
|
13895
13895
|
throw Ct;
|
|
13896
13896
|
}
|
|
13897
|
-
|
|
13897
|
+
ia(), lt = r.tokens, typeof r.comments < "u" && (lt.comments = r.comments), typeof r.errors < "u" && (lt.errors = r.errors);
|
|
13898
13898
|
} catch (Ct) {
|
|
13899
13899
|
throw Ct;
|
|
13900
13900
|
} finally {
|
|
@@ -13902,7 +13902,7 @@ var Gr = { exports: {} };
|
|
|
13902
13902
|
}
|
|
13903
13903
|
return lt;
|
|
13904
13904
|
}
|
|
13905
|
-
function
|
|
13905
|
+
function fo(p, B) {
|
|
13906
13906
|
var N, X;
|
|
13907
13907
|
X = String, typeof p != "string" && !(p instanceof String) && (p = X(p)), w = m, x = p, L = 0, I = x.length > 0 ? 1 : 0, v = 0, U = x.length, S = null, F = {
|
|
13908
13908
|
allowIn: !0,
|
|
@@ -13913,7 +13913,7 @@ var Gr = { exports: {} };
|
|
|
13913
13913
|
lastCommentStart: -1
|
|
13914
13914
|
}, r = {}, typeof B < "u" && (r.range = typeof B.range == "boolean" && B.range, r.loc = typeof B.loc == "boolean" && B.loc, r.attachComment = typeof B.attachComment == "boolean" && B.attachComment, r.loc && B.source !== null && B.source !== void 0 && (r.source = X(B.source)), typeof B.tokens == "boolean" && B.tokens && (r.tokens = []), typeof B.comment == "boolean" && B.comment && (r.comments = []), typeof B.tolerant == "boolean" && B.tolerant && (r.errors = []), r.attachComment && (r.range = !0, r.comments = [], r.bottomRightStack = [], r.trailingComments = [], r.leadingComments = []));
|
|
13915
13915
|
try {
|
|
13916
|
-
N =
|
|
13916
|
+
N = lo(), typeof r.comments < "u" && (N.comments = r.comments), typeof r.tokens < "u" && (ia(), N.tokens = r.tokens), typeof r.errors < "u" && (N.errors = r.errors);
|
|
13917
13917
|
} catch (lt) {
|
|
13918
13918
|
throw lt;
|
|
13919
13919
|
} finally {
|
|
@@ -13921,7 +13921,7 @@ var Gr = { exports: {} };
|
|
|
13921
13921
|
}
|
|
13922
13922
|
return N;
|
|
13923
13923
|
}
|
|
13924
|
-
s.version = "1.2.2", s.tokenize =
|
|
13924
|
+
s.version = "1.2.2", s.tokenize = uo, s.parse = fo, s.Syntax = function() {
|
|
13925
13925
|
var p, B = {};
|
|
13926
13926
|
typeof Object.create == "function" && (B = /* @__PURE__ */ Object.create(null));
|
|
13927
13927
|
for (p in l)
|
|
@@ -15517,15 +15517,15 @@ Expecting ` + ft.join(", ") + ", got '" + (this.terminals_[T] || T) + "'" : at =
|
|
|
15517
15517
|
n.exports = e("./lib/index");
|
|
15518
15518
|
}, { "./lib/index": 5 }] }, {}, ["jsonpath"])("jsonpath");
|
|
15519
15519
|
});
|
|
15520
|
-
})(
|
|
15521
|
-
|
|
15522
|
-
const
|
|
15523
|
-
|
|
15524
|
-
function
|
|
15525
|
-
return
|
|
15526
|
-
}
|
|
15527
|
-
var
|
|
15528
|
-
|
|
15520
|
+
})(Zr);
|
|
15521
|
+
Ua.EventEmitter;
|
|
15522
|
+
const Wr = ta, Zi = $i, Xr = zn;
|
|
15523
|
+
Xr.inherits(Nn, Zi);
|
|
15524
|
+
function Nn(c, t) {
|
|
15525
|
+
return Wr.not.instanceStrict(this, Nn) ? new Nn(c, t) : Zi.call(this, c, { ...t, encoding: "utf8" });
|
|
15526
|
+
}
|
|
15527
|
+
var ea = { exports: {} };
|
|
15528
|
+
ea.exports;
|
|
15529
15529
|
(function(c) {
|
|
15530
15530
|
(function(t) {
|
|
15531
15531
|
c !== null ? c.exports = e : t.tryer = e;
|
|
@@ -15602,30 +15602,35 @@ ta.exports;
|
|
|
15602
15602
|
setTimeout(I, Math.abs(v));
|
|
15603
15603
|
}
|
|
15604
15604
|
})(Ye);
|
|
15605
|
-
})(
|
|
15606
|
-
|
|
15607
|
-
typeof process < "u" && process.versions != null && process.versions.node != null
|
|
15608
|
-
const Xr = (
|
|
15605
|
+
})(ea);
|
|
15606
|
+
ea.exports;
|
|
15607
|
+
const Vr = typeof process < "u" && process.versions != null && process.versions.node != null, Bn = (
|
|
15609
15608
|
// @ts-expect-error webpack check is done like this
|
|
15610
15609
|
typeof __webpack_require__ < "u"
|
|
15611
|
-
),
|
|
15612
|
-
|
|
15613
|
-
|
|
15614
|
-
|
|
15615
|
-
|
|
15616
|
-
|
|
15617
|
-
|
|
15618
|
-
|
|
15610
|
+
), Wi = new _o(), Hr = async (c) => {
|
|
15611
|
+
const { input: t, wasmFilePath: e, zKeyFilePath: n, chainId: a } = c.payload.data, {
|
|
15612
|
+
hostLocation: { origin: s },
|
|
15613
|
+
constants: {
|
|
15614
|
+
isDevelopment: g,
|
|
15615
|
+
chains: { chainIds: d }
|
|
15616
|
+
}
|
|
15617
|
+
} = c.metadata;
|
|
15618
|
+
let C = e, l = n;
|
|
15619
|
+
if (console.log({ isWebpack: Bn }), Vr) {
|
|
15620
|
+
g && !Bn ? (C = `test/circuits/${e}`, l = `test/circuits/${n}`) : Bn && (C = `libs/hardhat/test/circuits/${e}`, l = `libs/hardhat/test/circuits/${n}`);
|
|
15621
|
+
const o = require("path");
|
|
15622
|
+
C = o.resolve(C), l = o.resolve(l);
|
|
15623
|
+
} else
|
|
15624
|
+
a === d.localhost && (C = `${s}/${e}`, l = `${s}/${n}`);
|
|
15619
15625
|
try {
|
|
15620
|
-
|
|
15621
|
-
|
|
15622
|
-
|
|
15623
|
-
|
|
15624
|
-
console.log(d);
|
|
15626
|
+
const { proof: o, publicSignals: y } = await yr(t, C, l), E = await Cr(o, y), m = JSON.parse(`[${E}]`);
|
|
15627
|
+
Wi.postMessageToMainThread({ zkCallData: m, proof: o, publicSignals: y });
|
|
15628
|
+
} catch (o) {
|
|
15629
|
+
console.log(o);
|
|
15625
15630
|
}
|
|
15626
15631
|
};
|
|
15627
|
-
|
|
15632
|
+
Wi.attachWorkerSideOnMessage(Hr);
|
|
15628
15633
|
export {
|
|
15629
|
-
|
|
15630
|
-
|
|
15634
|
+
Wi as default,
|
|
15635
|
+
Hr as onWorkerMessage
|
|
15631
15636
|
};
|