@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 { W as
|
|
2
|
-
import { f as on, r as
|
|
3
|
-
const
|
|
1
|
+
import { W as _o } from "./workerProxy-BDj498Ht.mjs";
|
|
2
|
+
import { f as on, r as vn, c as Ye, e as Ua, u as zn } from "./index-DhAeLLFR.mjs";
|
|
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,72 +1065,72 @@ 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
|
|
1082
|
+
const _i = ee(0), Ee = ee(1), Sc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1083
1083
|
__proto__: null,
|
|
1084
|
-
abs:
|
|
1085
|
-
add:
|
|
1086
|
-
band:
|
|
1084
|
+
abs: yc,
|
|
1085
|
+
add: $n,
|
|
1086
|
+
band: Gn,
|
|
1087
1087
|
bitLength: We,
|
|
1088
|
-
bits:
|
|
1089
|
-
bor:
|
|
1090
|
-
bxor:
|
|
1088
|
+
bits: oi,
|
|
1089
|
+
bor: Ec,
|
|
1090
|
+
bxor: wc,
|
|
1091
1091
|
div: Se,
|
|
1092
1092
|
e: ee,
|
|
1093
1093
|
eq: Fe,
|
|
1094
|
-
exp:
|
|
1095
|
-
fromArray:
|
|
1096
|
-
fromRprBE:
|
|
1094
|
+
exp: bc,
|
|
1095
|
+
fromArray: _c,
|
|
1096
|
+
fromRprBE: di,
|
|
1097
1097
|
fromRprLE: $e,
|
|
1098
1098
|
fromString: sn,
|
|
1099
|
-
geq:
|
|
1100
|
-
gt:
|
|
1101
|
-
isNegative:
|
|
1102
|
-
isOdd:
|
|
1103
|
-
isZero:
|
|
1104
|
-
land:
|
|
1105
|
-
leq:
|
|
1106
|
-
lnot:
|
|
1107
|
-
lor:
|
|
1108
|
-
lt:
|
|
1099
|
+
geq: li,
|
|
1100
|
+
gt: On,
|
|
1101
|
+
isNegative: ai,
|
|
1102
|
+
isOdd: jn,
|
|
1103
|
+
isZero: ii,
|
|
1104
|
+
land: Bc,
|
|
1105
|
+
leq: Fc,
|
|
1106
|
+
lnot: xc,
|
|
1107
|
+
lor: vc,
|
|
1108
|
+
lt: Ac,
|
|
1109
1109
|
mod: _e,
|
|
1110
|
-
mul:
|
|
1111
|
-
naf:
|
|
1112
|
-
neg:
|
|
1113
|
-
neq:
|
|
1110
|
+
mul: ri,
|
|
1111
|
+
naf: hc,
|
|
1112
|
+
neg: si,
|
|
1113
|
+
neq: Cc,
|
|
1114
1114
|
one: Ee,
|
|
1115
1115
|
pow: Xe,
|
|
1116
1116
|
shiftLeft: tn,
|
|
1117
1117
|
shiftRight: xe,
|
|
1118
|
-
shl:
|
|
1119
|
-
shr:
|
|
1120
|
-
square:
|
|
1118
|
+
shl: gc,
|
|
1119
|
+
shr: pc,
|
|
1120
|
+
square: mc,
|
|
1121
1121
|
sub: he,
|
|
1122
|
-
toArray:
|
|
1122
|
+
toArray: Lc,
|
|
1123
1123
|
toLEBuff: Ie,
|
|
1124
|
-
toNumber:
|
|
1125
|
-
toRprBE:
|
|
1124
|
+
toNumber: ci,
|
|
1125
|
+
toRprBE: ui,
|
|
1126
1126
|
toRprLE: je,
|
|
1127
|
-
toString:
|
|
1128
|
-
zero:
|
|
1127
|
+
toString: fi,
|
|
1128
|
+
zero: _i
|
|
1129
1129
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
1130
|
-
function
|
|
1131
|
-
if (
|
|
1130
|
+
function fa(c, t, e) {
|
|
1131
|
+
if (ii(e))
|
|
1132
1132
|
return c.one;
|
|
1133
|
-
const n =
|
|
1133
|
+
const n = oi(e);
|
|
1134
1134
|
if (n.length == 0)
|
|
1135
1135
|
return c.one;
|
|
1136
1136
|
let a = t;
|
|
@@ -1138,29 +1138,29 @@ function da(c, t, e) {
|
|
|
1138
1138
|
a = c.square(a), n[s] && (a = c.mul(a, t));
|
|
1139
1139
|
return a;
|
|
1140
1140
|
}
|
|
1141
|
-
function
|
|
1141
|
+
function Ic(c) {
|
|
1142
1142
|
if (c.m % 2 == 1)
|
|
1143
1143
|
if (Fe(_e(c.p, 4), 1))
|
|
1144
1144
|
if (Fe(_e(c.p, 8), 1))
|
|
1145
1145
|
if (Fe(_e(c.p, 16), 1))
|
|
1146
|
-
Ic(c);
|
|
1147
|
-
else if (Fe(_e(c.p, 16), 9))
|
|
1148
1146
|
Oc(c);
|
|
1147
|
+
else if (Fe(_e(c.p, 16), 9))
|
|
1148
|
+
Pc(c);
|
|
1149
1149
|
else
|
|
1150
1150
|
throw new Error("Field withot sqrt");
|
|
1151
1151
|
else if (Fe(_e(c.p, 8), 5))
|
|
1152
|
-
|
|
1152
|
+
kc(c);
|
|
1153
1153
|
else
|
|
1154
1154
|
throw new Error("Field withot sqrt");
|
|
1155
1155
|
else
|
|
1156
|
-
Fe(_e(c.p, 4), 3) &&
|
|
1156
|
+
Fe(_e(c.p, 4), 3) && Tc(c);
|
|
1157
1157
|
else {
|
|
1158
1158
|
const t = _e(Xe(c.p, c.m / 2), 4);
|
|
1159
|
-
t == 1 ?
|
|
1159
|
+
t == 1 ? qc(c) : t == 3 ? Dc(c) : Mc(c);
|
|
1160
1160
|
}
|
|
1161
1161
|
}
|
|
1162
|
-
function
|
|
1163
|
-
for (c.sqrt_q = Xe(c.p, c.m), c.sqrt_s = 0, c.sqrt_t = he(c.sqrt_q, 1); !
|
|
1162
|
+
function Oc(c) {
|
|
1163
|
+
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); )
|
|
1164
1164
|
c.sqrt_s = c.sqrt_s + 1, c.sqrt_t = Se(c.sqrt_t, 2);
|
|
1165
1165
|
let t = c.one;
|
|
1166
1166
|
for (; c.eq(t, c.one); ) {
|
|
@@ -1188,17 +1188,17 @@ function Ic(c) {
|
|
|
1188
1188
|
return n.geq(d, n.zero) ? d : n.neg(d);
|
|
1189
1189
|
};
|
|
1190
1190
|
}
|
|
1191
|
-
function
|
|
1191
|
+
function Pc(c) {
|
|
1192
1192
|
c.sqrt = function() {
|
|
1193
1193
|
throw new Error("Sqrt alg 4 not implemented");
|
|
1194
1194
|
};
|
|
1195
1195
|
}
|
|
1196
|
-
function
|
|
1196
|
+
function kc(c) {
|
|
1197
1197
|
c.sqrt = function() {
|
|
1198
1198
|
throw new Error("Sqrt alg 3 not implemented");
|
|
1199
1199
|
};
|
|
1200
1200
|
}
|
|
1201
|
-
function
|
|
1201
|
+
function Tc(c) {
|
|
1202
1202
|
c.sqrt_q = Xe(c.p, c.m), c.sqrt_e1 = Se(he(c.sqrt_q, 3), 4), c.sqrt = function(t) {
|
|
1203
1203
|
if (this.isZero(t))
|
|
1204
1204
|
return this.zero;
|
|
@@ -1209,12 +1209,12 @@ function kc(c) {
|
|
|
1209
1209
|
return c.geq(a, c.zero) ? a : c.neg(a);
|
|
1210
1210
|
};
|
|
1211
1211
|
}
|
|
1212
|
-
function
|
|
1212
|
+
function qc(c) {
|
|
1213
1213
|
c.sqrt = function() {
|
|
1214
1214
|
throw new Error("Sqrt alg 10 not implemented");
|
|
1215
1215
|
};
|
|
1216
1216
|
}
|
|
1217
|
-
function
|
|
1217
|
+
function Dc(c) {
|
|
1218
1218
|
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) {
|
|
1219
1219
|
return t % 2 == 1 ? c.conjugate(e) : e;
|
|
1220
1220
|
}, c.sqrt = function(t) {
|
|
@@ -1232,7 +1232,7 @@ function qc(c) {
|
|
|
1232
1232
|
return e.geq(d, e.zero) ? d : e.neg(d);
|
|
1233
1233
|
};
|
|
1234
1234
|
}
|
|
1235
|
-
function
|
|
1235
|
+
function Mc(c) {
|
|
1236
1236
|
c.sqrt = function() {
|
|
1237
1237
|
throw new Error("Sqrt alg 8 not implemented");
|
|
1238
1238
|
};
|
|
@@ -1240,10 +1240,10 @@ function Dc(c) {
|
|
|
1240
1240
|
function Le(c, t, e, n, a) {
|
|
1241
1241
|
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;
|
|
1242
1242
|
}
|
|
1243
|
-
function
|
|
1243
|
+
function Rc(c) {
|
|
1244
1244
|
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);
|
|
1245
1245
|
}
|
|
1246
|
-
class
|
|
1246
|
+
class Nc {
|
|
1247
1247
|
constructor(t) {
|
|
1248
1248
|
t = t || [0, 0, 0, 0, 0, 0, 0, 0], this.state = [
|
|
1249
1249
|
1634760805,
|
|
@@ -1268,7 +1268,7 @@ class Rc {
|
|
|
1268
1268
|
return this.idx == 16 && this.update(), this.buff[this.idx++];
|
|
1269
1269
|
}
|
|
1270
1270
|
nextU64() {
|
|
1271
|
-
return
|
|
1271
|
+
return $n(ri(this.nextU32(), 4294967296), this.nextU32());
|
|
1272
1272
|
}
|
|
1273
1273
|
nextBool() {
|
|
1274
1274
|
return (this.nextU32() & 1) == 1;
|
|
@@ -1277,13 +1277,13 @@ class Rc {
|
|
|
1277
1277
|
for (let t = 0; t < 16; t++)
|
|
1278
1278
|
this.buff[t] = this.state[t];
|
|
1279
1279
|
for (let t = 0; t < 10; t++)
|
|
1280
|
-
|
|
1280
|
+
Rc(this.buff);
|
|
1281
1281
|
for (let t = 0; t < 16; t++)
|
|
1282
1282
|
this.buff[t] = this.buff[t] + this.state[t] >>> 0;
|
|
1283
1283
|
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)));
|
|
1284
1284
|
}
|
|
1285
1285
|
}
|
|
1286
|
-
function
|
|
1286
|
+
function gi(c) {
|
|
1287
1287
|
let t = new Uint8Array(c);
|
|
1288
1288
|
if (process.browser)
|
|
1289
1289
|
if (typeof globalThis.crypto < "u")
|
|
@@ -1295,17 +1295,17 @@ function _i(c) {
|
|
|
1295
1295
|
on.randomFillSync(t);
|
|
1296
1296
|
return t;
|
|
1297
1297
|
}
|
|
1298
|
-
function
|
|
1299
|
-
const c =
|
|
1298
|
+
function zc() {
|
|
1299
|
+
const c = gi(32), t = new Uint32Array(c.buffer), e = [];
|
|
1300
1300
|
for (let n = 0; n < 8; n++)
|
|
1301
1301
|
e.push(t[n]);
|
|
1302
1302
|
return e;
|
|
1303
1303
|
}
|
|
1304
1304
|
let Qe = null;
|
|
1305
|
-
function
|
|
1306
|
-
return Qe || (Qe = new
|
|
1305
|
+
function Zn() {
|
|
1306
|
+
return Qe || (Qe = new Nc(zc()), Qe);
|
|
1307
1307
|
}
|
|
1308
|
-
class
|
|
1308
|
+
class Uc {
|
|
1309
1309
|
constructor(t, e, n) {
|
|
1310
1310
|
this.F = e, this.G = t, this.opMulGF = n;
|
|
1311
1311
|
let a = e.sqrt_t || e.t, s = e.sqrt_s || e.s, g = e.one;
|
|
@@ -1329,7 +1329,7 @@ class zc {
|
|
|
1329
1329
|
fft(t) {
|
|
1330
1330
|
if (t.length <= 1)
|
|
1331
1331
|
return t;
|
|
1332
|
-
const e =
|
|
1332
|
+
const e = _a(t.length - 1) + 1;
|
|
1333
1333
|
this._setRoots(e);
|
|
1334
1334
|
const n = 1 << e;
|
|
1335
1335
|
if (t.length != n)
|
|
@@ -1339,7 +1339,7 @@ class zc {
|
|
|
1339
1339
|
ifft(t) {
|
|
1340
1340
|
if (t.length <= 1)
|
|
1341
1341
|
return t;
|
|
1342
|
-
const e =
|
|
1342
|
+
const e = _a(t.length - 1) + 1;
|
|
1343
1343
|
this._setRoots(e);
|
|
1344
1344
|
const n = 1 << e;
|
|
1345
1345
|
if (t.length != n)
|
|
@@ -1350,7 +1350,7 @@ class zc {
|
|
|
1350
1350
|
return g;
|
|
1351
1351
|
}
|
|
1352
1352
|
}
|
|
1353
|
-
function
|
|
1353
|
+
function _a(c) {
|
|
1354
1354
|
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;
|
|
1355
1355
|
}
|
|
1356
1356
|
function en(c, t, e, n, a) {
|
|
@@ -1367,7 +1367,7 @@ function en(c, t, e, n, a) {
|
|
|
1367
1367
|
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]));
|
|
1368
1368
|
return l;
|
|
1369
1369
|
}
|
|
1370
|
-
class
|
|
1370
|
+
class jc {
|
|
1371
1371
|
constructor(t) {
|
|
1372
1372
|
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);
|
|
1373
1373
|
const e = this.negone >> this.one;
|
|
@@ -1377,7 +1377,7 @@ class Uc {
|
|
|
1377
1377
|
this.nqr = this.nqr + this.one, n = this.pow(this.nqr, e);
|
|
1378
1378
|
for (this.s = 0, this.t = this.negone; (this.t & this.one) == this.zero; )
|
|
1379
1379
|
this.s = this.s + 1, this.t = this.t >> this.one;
|
|
1380
|
-
this.nqr_to_t = this.pow(this.nqr, this.t),
|
|
1380
|
+
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);
|
|
1381
1381
|
}
|
|
1382
1382
|
e(t, e) {
|
|
1383
1383
|
let n;
|
|
@@ -1450,10 +1450,10 @@ class Uc {
|
|
|
1450
1450
|
return t % e;
|
|
1451
1451
|
}
|
|
1452
1452
|
pow(t, e) {
|
|
1453
|
-
return
|
|
1453
|
+
return fa(this, t, e);
|
|
1454
1454
|
}
|
|
1455
1455
|
exp(t, e) {
|
|
1456
|
-
return
|
|
1456
|
+
return fa(this, t, e);
|
|
1457
1457
|
}
|
|
1458
1458
|
band(t, e) {
|
|
1459
1459
|
const n = t & e & this.mask;
|
|
@@ -1529,7 +1529,7 @@ class Uc {
|
|
|
1529
1529
|
const t = this.bitLength * 2 / 8;
|
|
1530
1530
|
let e = this.zero;
|
|
1531
1531
|
for (let n = 0; n < t; n++)
|
|
1532
|
-
e = (e << BigInt(8)) + BigInt(
|
|
1532
|
+
e = (e << BigInt(8)) + BigInt(gi(1)[0]);
|
|
1533
1533
|
return e % this.p;
|
|
1534
1534
|
}
|
|
1535
1535
|
toString(t, e) {
|
|
@@ -1562,7 +1562,7 @@ class Uc {
|
|
|
1562
1562
|
}
|
|
1563
1563
|
// Returns a buffer with Big Endian Representation
|
|
1564
1564
|
toRprBE(t, e, n) {
|
|
1565
|
-
|
|
1565
|
+
ui(t, e, n, this.n64 * 8);
|
|
1566
1566
|
}
|
|
1567
1567
|
// Returns a buffer with Big Endian Montgomery Representation
|
|
1568
1568
|
toRprBEM(t, e, n) {
|
|
@@ -1577,7 +1577,7 @@ class Uc {
|
|
|
1577
1577
|
}
|
|
1578
1578
|
// Pases a buffer with Big Endian Representation
|
|
1579
1579
|
fromRprBE(t, e) {
|
|
1580
|
-
return
|
|
1580
|
+
return di(t, e, this.n8);
|
|
1581
1581
|
}
|
|
1582
1582
|
fromRprLEM(t, e) {
|
|
1583
1583
|
return this.mul(this.fromRprLE(t, e), this.Ri);
|
|
@@ -1607,7 +1607,7 @@ be.bigInt2U32LE = function(t, e) {
|
|
|
1607
1607
|
be.isOcamNum = function(c) {
|
|
1608
1608
|
return !(!Array.isArray(c) || c.length != 3 || typeof c[0] != "number" || typeof c[1] != "number" || !Array.isArray(c[2]));
|
|
1609
1609
|
};
|
|
1610
|
-
var
|
|
1610
|
+
var $c = function(t, e, n) {
|
|
1611
1611
|
const a = n || "int";
|
|
1612
1612
|
if (t.modules[a])
|
|
1613
1613
|
return a;
|
|
@@ -2333,7 +2333,7 @@ var jc = function(t, e, n) {
|
|
|
2333
2333
|
));
|
|
2334
2334
|
}
|
|
2335
2335
|
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;
|
|
2336
|
-
},
|
|
2336
|
+
}, Wn = function(t, e, n, a, s, g, d) {
|
|
2337
2337
|
const C = t.addFunction(e);
|
|
2338
2338
|
C.addParam("base", "i32"), C.addParam("scalar", "i32"), C.addParam("scalarLength", "i32"), C.addParam("r", "i32"), C.addLocal("i", "i32"), C.addLocal("b", "i32");
|
|
2339
2339
|
const l = C.getCodeBuilder(), o = l.i32_const(t.alloc(n));
|
|
@@ -2381,8 +2381,8 @@ var jc = function(t, e, n) {
|
|
|
2381
2381
|
);
|
|
2382
2382
|
return E;
|
|
2383
2383
|
}
|
|
2384
|
-
},
|
|
2385
|
-
function
|
|
2384
|
+
}, Xn = Gc;
|
|
2385
|
+
function Gc(c, t) {
|
|
2386
2386
|
const e = c.modules[t].n64 * 8, n = c.addFunction(t + "_batchInverse");
|
|
2387
2387
|
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");
|
|
2388
2388
|
const a = n.getCodeBuilder(), s = a.i32_const(c.alloc(e));
|
|
@@ -2489,8 +2489,8 @@ function $c(c, t) {
|
|
|
2489
2489
|
)
|
|
2490
2490
|
);
|
|
2491
2491
|
}
|
|
2492
|
-
var
|
|
2493
|
-
function
|
|
2492
|
+
var pi = Zc;
|
|
2493
|
+
function Zc(c, t, e, n, a, s) {
|
|
2494
2494
|
typeof s > "u" && (n < a ? s = !0 : s = !1);
|
|
2495
2495
|
const g = c.addFunction(t);
|
|
2496
2496
|
g.addParam("pIn", "i32"), g.addParam("n", "i32"), g.addParam("pOut", "i32"), g.addLocal("i", "i32"), g.addLocal("itIn", "i32"), g.addLocal("itOut", "i32");
|
|
@@ -2545,8 +2545,8 @@ function Gc(c, t, e, n, a, s) {
|
|
|
2545
2545
|
))
|
|
2546
2546
|
);
|
|
2547
2547
|
}
|
|
2548
|
-
var
|
|
2549
|
-
function
|
|
2548
|
+
var Wc = Xc;
|
|
2549
|
+
function Xc(c, t, e, n, a, s) {
|
|
2550
2550
|
typeof s > "u" && (n < a ? s = !0 : s = !1);
|
|
2551
2551
|
const g = c.addFunction(t);
|
|
2552
2552
|
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");
|
|
@@ -2618,25 +2618,25 @@ function Wc(c, t, e, n, a, s) {
|
|
|
2618
2618
|
);
|
|
2619
2619
|
}
|
|
2620
2620
|
var re = {};
|
|
2621
|
-
function
|
|
2621
|
+
function hi(c, t) {
|
|
2622
2622
|
return c === t ? 0 : c > t ? 1 : -1;
|
|
2623
2623
|
}
|
|
2624
|
-
function
|
|
2624
|
+
function Vn(c) {
|
|
2625
2625
|
return c * c;
|
|
2626
2626
|
}
|
|
2627
|
-
function
|
|
2627
|
+
function Li(c) {
|
|
2628
2628
|
return c % 2n !== 0n;
|
|
2629
2629
|
}
|
|
2630
|
-
function
|
|
2630
|
+
function Hn(c) {
|
|
2631
2631
|
return c % 2n === 0n;
|
|
2632
2632
|
}
|
|
2633
2633
|
function rn(c) {
|
|
2634
2634
|
return c < 0n;
|
|
2635
2635
|
}
|
|
2636
|
-
function
|
|
2636
|
+
function Vc(c) {
|
|
2637
2637
|
return c > 0n;
|
|
2638
2638
|
}
|
|
2639
|
-
function
|
|
2639
|
+
function mi(c) {
|
|
2640
2640
|
return rn(c) ? c.toString(2).length - 1 : c.toString(2).length;
|
|
2641
2641
|
}
|
|
2642
2642
|
function Ve(c) {
|
|
@@ -2645,52 +2645,52 @@ function Ve(c) {
|
|
|
2645
2645
|
function Oe(c) {
|
|
2646
2646
|
return Ve(c) === 1n;
|
|
2647
2647
|
}
|
|
2648
|
-
function
|
|
2648
|
+
function bi(c, t) {
|
|
2649
2649
|
for (var e = 0n, n = 1n, a = t, s = Ve(c), g, d, C; s !== 0n; )
|
|
2650
2650
|
g = a / s, d = e, C = a, e = n, a = s, n = d - g * n, s = C - g * s;
|
|
2651
2651
|
if (!Oe(a))
|
|
2652
2652
|
throw new Error(c.toString() + " and " + t.toString() + " are not co-prime");
|
|
2653
|
-
return
|
|
2653
|
+
return hi(e, 0n) === -1 && (e = e + t), rn(c) ? -e : e;
|
|
2654
2654
|
}
|
|
2655
|
-
function
|
|
2655
|
+
function yi(c, t, e) {
|
|
2656
2656
|
if (e === 0n)
|
|
2657
2657
|
throw new Error("Cannot take modPow with modulus 0");
|
|
2658
2658
|
var n = 1n, a = c % e;
|
|
2659
|
-
for (rn(t) && (t = t * -1n, a =
|
|
2659
|
+
for (rn(t) && (t = t * -1n, a = bi(a, e)); Vc(t); ) {
|
|
2660
2660
|
if (a === 0n)
|
|
2661
2661
|
return 0n;
|
|
2662
|
-
|
|
2662
|
+
Li(t) && (n = n * a % e), t = t / 2n, a = Vn(a) % e;
|
|
2663
2663
|
}
|
|
2664
2664
|
return n;
|
|
2665
2665
|
}
|
|
2666
|
-
function
|
|
2666
|
+
function Hc(c, t) {
|
|
2667
2667
|
return c = c >= 0n ? c : -c, t = t >= 0n ? t : -t, c === t ? 0 : c > t ? 1 : -1;
|
|
2668
2668
|
}
|
|
2669
|
-
function
|
|
2670
|
-
return t === 0n ? !1 : Oe(t) ? !0 :
|
|
2669
|
+
function ga(c, t) {
|
|
2670
|
+
return t === 0n ? !1 : Oe(t) ? !0 : Hc(t, 2n) === 0 ? Hn(c) : c % t === 0n;
|
|
2671
2671
|
}
|
|
2672
|
-
function
|
|
2672
|
+
function Qc(c) {
|
|
2673
2673
|
var t = Ve(c);
|
|
2674
2674
|
if (Oe(t))
|
|
2675
2675
|
return !1;
|
|
2676
2676
|
if (t === 2n || t === 3n || t === 5n)
|
|
2677
2677
|
return !0;
|
|
2678
|
-
if (
|
|
2678
|
+
if (Hn(t) || ga(t, 3n) || ga(t, 5n))
|
|
2679
2679
|
return !1;
|
|
2680
2680
|
if (t < 49n)
|
|
2681
2681
|
return !0;
|
|
2682
2682
|
}
|
|
2683
|
-
function
|
|
2683
|
+
function Jc(c) {
|
|
2684
2684
|
return c - 1n;
|
|
2685
2685
|
}
|
|
2686
|
-
function
|
|
2687
|
-
for (var e =
|
|
2686
|
+
function pa(c, t) {
|
|
2687
|
+
for (var e = Jc(c), n = e, a = 0, s, g, d; Hn(n); )
|
|
2688
2688
|
n = n / 2n, a++;
|
|
2689
2689
|
t:
|
|
2690
2690
|
for (g = 0; g < t.length; g++)
|
|
2691
|
-
if (!(c < t[g]) && (d =
|
|
2691
|
+
if (!(c < t[g]) && (d = yi(BigInt(t[g]), n, c), !(Oe(d) || d === e))) {
|
|
2692
2692
|
for (s = a - 1; s != 0; s--) {
|
|
2693
|
-
if (d =
|
|
2693
|
+
if (d = Vn(d) % c, Oe(d))
|
|
2694
2694
|
return !1;
|
|
2695
2695
|
if (d === e)
|
|
2696
2696
|
continue t;
|
|
@@ -2699,33 +2699,33 @@ function ga(c, t) {
|
|
|
2699
2699
|
}
|
|
2700
2700
|
return !0;
|
|
2701
2701
|
}
|
|
2702
|
-
function
|
|
2703
|
-
var t =
|
|
2702
|
+
function Kc(c) {
|
|
2703
|
+
var t = Qc(c);
|
|
2704
2704
|
if (t !== void 0)
|
|
2705
2705
|
return t;
|
|
2706
|
-
var e = Ve(c), n =
|
|
2706
|
+
var e = Ve(c), n = mi(e);
|
|
2707
2707
|
if (n <= 64)
|
|
2708
|
-
return
|
|
2708
|
+
return pa(e, [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37]);
|
|
2709
2709
|
for (var a = Math.log(2) * Number(n), s = Math.ceil(a), g = [], d = 0; d < s; d++)
|
|
2710
2710
|
g.push(BigInt(d + 2));
|
|
2711
|
-
return
|
|
2711
|
+
return pa(e, g);
|
|
2712
2712
|
}
|
|
2713
|
-
re.bitLength =
|
|
2714
|
-
re.isOdd =
|
|
2713
|
+
re.bitLength = mi;
|
|
2714
|
+
re.isOdd = Li;
|
|
2715
2715
|
re.isNegative = rn;
|
|
2716
2716
|
re.abs = Ve;
|
|
2717
2717
|
re.isUnit = Oe;
|
|
2718
|
-
re.compare =
|
|
2719
|
-
re.modInv =
|
|
2720
|
-
re.modPow =
|
|
2721
|
-
re.isPrime =
|
|
2722
|
-
re.square =
|
|
2723
|
-
const
|
|
2724
|
-
var
|
|
2725
|
-
const s = BigInt(e), g = Math.floor((
|
|
2718
|
+
re.compare = hi;
|
|
2719
|
+
re.modInv = bi;
|
|
2720
|
+
re.modPow = yi;
|
|
2721
|
+
re.isPrime = Kc;
|
|
2722
|
+
re.square = Vn;
|
|
2723
|
+
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;
|
|
2724
|
+
var Qn = function(t, e, n, a) {
|
|
2725
|
+
const s = BigInt(e), g = Math.floor((ns(s - 1n) - 1) / 64) + 1, d = g * 2, C = g * 8, l = n || "f1m";
|
|
2726
2726
|
if (t.modules[l])
|
|
2727
2727
|
return l;
|
|
2728
|
-
const o =
|
|
2728
|
+
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));
|
|
2729
2729
|
t.modules[l] = {
|
|
2730
2730
|
pq: y,
|
|
2731
2731
|
pR2: E,
|
|
@@ -3248,13 +3248,13 @@ var Hn = function(t, e, n, a) {
|
|
|
3248
3248
|
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")));
|
|
3249
3249
|
}
|
|
3250
3250
|
let nt = 2n;
|
|
3251
|
-
if (
|
|
3252
|
-
for (;
|
|
3251
|
+
if (La(s))
|
|
3252
|
+
for (; ha(nt, L, s) !== O; )
|
|
3253
3253
|
nt = nt + 1n;
|
|
3254
3254
|
let J = 0, ft = O;
|
|
3255
|
-
for (; !
|
|
3255
|
+
for (; !as(ft) && ft !== 0n; )
|
|
3256
3256
|
J++, ft = ft >> 1n;
|
|
3257
|
-
const at = t.alloc(C, ge.bigInt2BytesLE(ft, C)), _t =
|
|
3257
|
+
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));
|
|
3258
3258
|
function P() {
|
|
3259
3259
|
const z = t.addFunction(l + "_sqrt");
|
|
3260
3260
|
z.addParam("n", "i32"), z.addParam("r", "i32"), z.addLocal("m", "i32"), z.addLocal("i", "i32"), z.addLocal("j", "i32");
|
|
@@ -3378,7 +3378,7 @@ var Hn = function(t, e, n, a) {
|
|
|
3378
3378
|
b.ret(b.call(o + "_eq", b.getLocal("x"), b.i32_const(m)))
|
|
3379
3379
|
);
|
|
3380
3380
|
}
|
|
3381
|
-
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(),
|
|
3381
|
+
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(
|
|
3382
3382
|
t,
|
|
3383
3383
|
l + "_exp",
|
|
3384
3384
|
C,
|
|
@@ -3386,17 +3386,17 @@ var Hn = function(t, e, n, a) {
|
|
|
3386
3386
|
l + "_square",
|
|
3387
3387
|
o + "_copy",
|
|
3388
3388
|
l + "_one"
|
|
3389
|
-
), t.exportFunction(l + "_exp"), t.exportFunction(l + "_batchInverse"),
|
|
3389
|
+
), 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;
|
|
3390
3390
|
};
|
|
3391
|
-
const
|
|
3392
|
-
var
|
|
3393
|
-
const g = BigInt(e), d = Math.floor((
|
|
3391
|
+
const os = Qn, { bitLength: cs } = re;
|
|
3392
|
+
var Ci = function(t, e, n, a, s) {
|
|
3393
|
+
const g = BigInt(e), d = Math.floor((cs(g - 1n) - 1) / 64) + 1, C = d * 8, l = n || "f1";
|
|
3394
3394
|
if (t.modules[l])
|
|
3395
3395
|
return l;
|
|
3396
3396
|
t.modules[l] = {
|
|
3397
3397
|
n64: d
|
|
3398
3398
|
};
|
|
3399
|
-
const o = s || "int", y =
|
|
3399
|
+
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;
|
|
3400
3400
|
function O() {
|
|
3401
3401
|
const U = t.alloc(C), w = t.addFunction(l + "_mul");
|
|
3402
3402
|
w.addParam("x", "i32"), w.addParam("y", "i32"), w.addParam("r", "i32");
|
|
@@ -3425,8 +3425,8 @@ var yi = function(t, e, n, a, s) {
|
|
|
3425
3425
|
}
|
|
3426
3426
|
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;
|
|
3427
3427
|
};
|
|
3428
|
-
const
|
|
3429
|
-
var
|
|
3428
|
+
const ss = Wn, rs = Xn, mn = be;
|
|
3429
|
+
var Ai = function(t, e, n, a) {
|
|
3430
3430
|
if (t.modules[n])
|
|
3431
3431
|
return n;
|
|
3432
3432
|
const s = t.modules[a].n64 * 8, g = t.modules[a].q;
|
|
@@ -3722,7 +3722,7 @@ var Ci = function(t, e, n, a) {
|
|
|
3722
3722
|
A.ret(A.i32_const(1))
|
|
3723
3723
|
);
|
|
3724
3724
|
}
|
|
3725
|
-
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"),
|
|
3725
|
+
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(
|
|
3726
3726
|
t,
|
|
3727
3727
|
n + "_exp",
|
|
3728
3728
|
s * 2,
|
|
@@ -3732,8 +3732,8 @@ var Ci = function(t, e, n, a) {
|
|
|
3732
3732
|
n + "_one"
|
|
3733
3733
|
), 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;
|
|
3734
3734
|
};
|
|
3735
|
-
const
|
|
3736
|
-
var
|
|
3735
|
+
const ls = Wn, us = Xn;
|
|
3736
|
+
var Fi = function(t, e, n, a) {
|
|
3737
3737
|
if (t.modules[n])
|
|
3738
3738
|
return n;
|
|
3739
3739
|
const s = t.modules[a].n64 * 8;
|
|
@@ -3990,7 +3990,7 @@ var Ai = function(t, e, n, a) {
|
|
|
3990
3990
|
)
|
|
3991
3991
|
);
|
|
3992
3992
|
}
|
|
3993
|
-
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"),
|
|
3993
|
+
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(
|
|
3994
3994
|
t,
|
|
3995
3995
|
n + "_exp",
|
|
3996
3996
|
s * 3,
|
|
@@ -3999,7 +3999,7 @@ var Ai = function(t, e, n, a) {
|
|
|
3999
3999
|
n + "_copy",
|
|
4000
4000
|
n + "_one"
|
|
4001
4001
|
), t.exportFunction(n + "_exp"), t.exportFunction(n + "_timesScalar"), t.exportFunction(n + "_batchInverse"), t.exportFunction(n + "_isNegative"), n;
|
|
4002
|
-
},
|
|
4002
|
+
}, ds = function(t, e, n, a, s, g, d, C) {
|
|
4003
4003
|
const l = t.addFunction(e);
|
|
4004
4004
|
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");
|
|
4005
4005
|
const o = l.getCodeBuilder(), y = o.i32_const(t.alloc(n));
|
|
@@ -4182,7 +4182,7 @@ var Ai = function(t, e, n, a) {
|
|
|
4182
4182
|
)),
|
|
4183
4183
|
o.i32_store(o.i32_const(0), o.getLocal("old0"))
|
|
4184
4184
|
);
|
|
4185
|
-
},
|
|
4185
|
+
}, fs = function(t, e, n, a, s) {
|
|
4186
4186
|
const d = t.modules[e].n64 * 8;
|
|
4187
4187
|
function C() {
|
|
4188
4188
|
const E = t.addFunction(n + "_getChunk");
|
|
@@ -4574,8 +4574,8 @@ var Ai = function(t, e, n, a) {
|
|
|
4574
4574
|
}
|
|
4575
4575
|
C(), y(), l(), o(), t.exportFunction(n), t.exportFunction(n + "_chunk");
|
|
4576
4576
|
};
|
|
4577
|
-
const
|
|
4578
|
-
var
|
|
4577
|
+
const ma = ds, qe = pi, ba = fs;
|
|
4578
|
+
var Ei = function(t, e, n, a) {
|
|
4579
4579
|
const s = t.modules[n].n64, g = s * 8;
|
|
4580
4580
|
if (t.modules[e])
|
|
4581
4581
|
return e;
|
|
@@ -5473,7 +5473,7 @@ var Fi = function(t, e, n, a) {
|
|
|
5473
5473
|
)
|
|
5474
5474
|
);
|
|
5475
5475
|
}
|
|
5476
|
-
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),
|
|
5476
|
+
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(
|
|
5477
5477
|
t,
|
|
5478
5478
|
e + "_timesScalar",
|
|
5479
5479
|
g * 3,
|
|
@@ -5482,7 +5482,7 @@ var Fi = function(t, e, n, a) {
|
|
|
5482
5482
|
e + "_sub",
|
|
5483
5483
|
e + "_copy",
|
|
5484
5484
|
e + "_zero"
|
|
5485
|
-
),
|
|
5485
|
+
), ma(
|
|
5486
5486
|
t,
|
|
5487
5487
|
e + "_timesScalarAffine",
|
|
5488
5488
|
g * 2,
|
|
@@ -5493,11 +5493,11 @@ var Fi = function(t, e, n, a) {
|
|
|
5493
5493
|
e + "_zero"
|
|
5494
5494
|
), 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;
|
|
5495
5495
|
};
|
|
5496
|
-
const { isOdd:
|
|
5497
|
-
var
|
|
5496
|
+
const { isOdd: _s, modInv: ya, modPow: De } = re, Je = be;
|
|
5497
|
+
var wi = function(t, e, n, a, s) {
|
|
5498
5498
|
const d = t.modules[a].n64 * 8, l = t.modules[n].n64 * 8, o = t.modules[a].q;
|
|
5499
5499
|
let y = o - 1n, E = 0;
|
|
5500
|
-
for (; !
|
|
5500
|
+
for (; !_s(y); )
|
|
5501
5501
|
E++, y = y >> 1n;
|
|
5502
5502
|
let m = 2n;
|
|
5503
5503
|
for (; De(m, o >> 1n, o) === 1n; )
|
|
@@ -5518,12 +5518,12 @@ var Ei = function(t, e, n, a, s) {
|
|
|
5518
5518
|
U[q] = U[q - 1] * 2n;
|
|
5519
5519
|
const w = [];
|
|
5520
5520
|
for (let q = 0; q <= E; q++) {
|
|
5521
|
-
const u =
|
|
5521
|
+
const u = ya(U[q], o) * I % o;
|
|
5522
5522
|
w.push(...Je.bigInt2BytesLE(u, d));
|
|
5523
5523
|
}
|
|
5524
5524
|
const S = t.alloc(w), F = De(m, 2n, o), r = [], h = [];
|
|
5525
5525
|
for (let q = 0; q <= E; q++) {
|
|
5526
|
-
const u = De(F, 2n ** BigInt(q), o), W =
|
|
5526
|
+
const u = De(F, 2n ** BigInt(q), o), W = ya(o + 1n - u, o);
|
|
5527
5527
|
r.push(...Je.bigInt2BytesLE(u * I % o, d)), h.push(...Je.bigInt2BytesLE(W * I % o, d));
|
|
5528
5528
|
}
|
|
5529
5529
|
const R = t.alloc(r), j = t.alloc(h);
|
|
@@ -6516,7 +6516,7 @@ var Ei = function(t, e, n, a, s) {
|
|
|
6516
6516
|
);
|
|
6517
6517
|
}
|
|
6518
6518
|
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");
|
|
6519
|
-
},
|
|
6519
|
+
}, Bi = function(t, e, n) {
|
|
6520
6520
|
const s = t.modules[n].n64 * 8;
|
|
6521
6521
|
function g() {
|
|
6522
6522
|
const C = t.addFunction(e + "_zero");
|
|
@@ -6609,7 +6609,7 @@ var Ei = function(t, e, n, a, s) {
|
|
|
6609
6609
|
);
|
|
6610
6610
|
}
|
|
6611
6611
|
return g(), d(), t.exportFunction(e + "_zero"), t.exportFunction(e + "_constructLC"), e;
|
|
6612
|
-
},
|
|
6612
|
+
}, vi = function(t, e, n) {
|
|
6613
6613
|
const s = t.modules[n].n64 * 8;
|
|
6614
6614
|
function g() {
|
|
6615
6615
|
const l = t.addFunction(e + "_buildABC");
|
|
@@ -6879,7 +6879,7 @@ var Ei = function(t, e, n, a, s) {
|
|
|
6879
6879
|
);
|
|
6880
6880
|
}
|
|
6881
6881
|
return g(), d(), C(), t.exportFunction(e + "_buildABC"), t.exportFunction(e + "_joinABC"), t.exportFunction(e + "_batchAdd"), e;
|
|
6882
|
-
},
|
|
6882
|
+
}, xi = function(t, e, n, a, s, g, d, C) {
|
|
6883
6883
|
const l = t.addFunction(e);
|
|
6884
6884
|
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");
|
|
6885
6885
|
const o = l.getCodeBuilder(), y = o.i32_const(t.alloc(d));
|
|
@@ -6916,19 +6916,19 @@ var Ei = function(t, e, n, a, s) {
|
|
|
6916
6916
|
))
|
|
6917
6917
|
), t.exportFunction(e);
|
|
6918
6918
|
};
|
|
6919
|
-
const Nt = be,
|
|
6920
|
-
var
|
|
6919
|
+
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;
|
|
6920
|
+
var As = function(t, e) {
|
|
6921
6921
|
const n = e || "bn128";
|
|
6922
6922
|
if (t.modules[n])
|
|
6923
6923
|
return n;
|
|
6924
|
-
const a = 21888242871839275222246405745257275088696311157297823662689037894645226208583n, s = 21888242871839275222246405745257275088548364400416034343698204186575808495617n, g = Math.floor((
|
|
6925
|
-
|
|
6926
|
-
const x = t.alloc(Nt.bigInt2BytesLE(w(3n), l)), O =
|
|
6927
|
-
bn(t, "frm", "frm", "frm", "frm_mul"),
|
|
6928
|
-
const L =
|
|
6924
|
+
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");
|
|
6925
|
+
ps(t, s, "fr", "frm");
|
|
6926
|
+
const x = t.alloc(Nt.bigInt2BytesLE(w(3n), l)), O = Aa(t, "g1m", "f1m", x);
|
|
6927
|
+
bn(t, "frm", "frm", "frm", "frm_mul"), Ls(t, "pol", "frm"), ms(t, "qap", "frm");
|
|
6928
|
+
const L = Ca(t, "f1m_neg", "f2m", "f1m"), I = t.alloc([
|
|
6929
6929
|
...Nt.bigInt2BytesLE(w(19485874751759354771024239261021720505790618469301721065564631296452457478373n), l),
|
|
6930
6930
|
...Nt.bigInt2BytesLE(w(266929791119991161246907387137283842545076965332900288569378510910307636690n), l)
|
|
6931
|
-
]), v =
|
|
6931
|
+
]), v = Aa(t, "g2m", "f2m", I);
|
|
6932
6932
|
function U(Y, f) {
|
|
6933
6933
|
const _ = t.addFunction(Y);
|
|
6934
6934
|
_.addParam("pG", "i32"), _.addParam("pFr", "i32"), _.addParam("pr", "i32");
|
|
@@ -7029,7 +7029,7 @@ var Cs = function(t, e) {
|
|
|
7029
7029
|
...Nt.bigInt2BytesLE(w(9), l),
|
|
7030
7030
|
...Nt.bigInt2BytesLE(w(1), l)
|
|
7031
7031
|
]), H = t.alloc([
|
|
7032
|
-
...Nt.bigInt2BytesLE(w(
|
|
7032
|
+
...Nt.bigInt2BytesLE(w(ys(2n, a)), l),
|
|
7033
7033
|
...Nt.bigInt2BytesLE(0n, l)
|
|
7034
7034
|
]), ut = M, nt = t.alloc([
|
|
7035
7035
|
...Nt.bigInt2BytesLE(w(19485874751759354771024239261021720505790618469301721065564631296452457478373n), l),
|
|
@@ -7049,7 +7049,7 @@ var Cs = function(t, e) {
|
|
|
7049
7049
|
);
|
|
7050
7050
|
}
|
|
7051
7051
|
J();
|
|
7052
|
-
const ft =
|
|
7052
|
+
const ft = hs(t, n + "_mulNR6", "f6m", "f2m");
|
|
7053
7053
|
function at() {
|
|
7054
7054
|
const Y = t.addFunction(n + "_mulNR12");
|
|
7055
7055
|
Y.addParam("x", "i32"), Y.addParam("pr", "i32");
|
|
@@ -7074,7 +7074,7 @@ var Cs = function(t, e) {
|
|
|
7074
7074
|
);
|
|
7075
7075
|
}
|
|
7076
7076
|
at();
|
|
7077
|
-
const _t =
|
|
7077
|
+
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;
|
|
7078
7078
|
t.modules[n] = {
|
|
7079
7079
|
n64: g,
|
|
7080
7080
|
pG1gen: F,
|
|
@@ -7096,7 +7096,7 @@ var Cs = function(t, e) {
|
|
|
7096
7096
|
let f = Y;
|
|
7097
7097
|
const _ = [];
|
|
7098
7098
|
for (; f > 0n; ) {
|
|
7099
|
-
if (
|
|
7099
|
+
if (Fa(f)) {
|
|
7100
7100
|
const Z = 2 - Number(f % 4n);
|
|
7101
7101
|
_.push(Z), f = f - BigInt(Z);
|
|
7102
7102
|
} else
|
|
@@ -7109,7 +7109,7 @@ var Cs = function(t, e) {
|
|
|
7109
7109
|
let f = Y;
|
|
7110
7110
|
const _ = [];
|
|
7111
7111
|
for (; f > 0n; )
|
|
7112
|
-
|
|
7112
|
+
Fa(f) ? _.push(1) : _.push(0), f = f >> 1n;
|
|
7113
7113
|
return _;
|
|
7114
7114
|
}
|
|
7115
7115
|
function Lt() {
|
|
@@ -7503,7 +7503,7 @@ var Cs = function(t, e) {
|
|
|
7503
7503
|
(ct * rt - st * ot) % a,
|
|
7504
7504
|
(ct * ot + st * rt) % a
|
|
7505
7505
|
];
|
|
7506
|
-
return
|
|
7506
|
+
return Cs(gt[0]) && (gt[0] = gt[0] + a), gt;
|
|
7507
7507
|
}
|
|
7508
7508
|
}
|
|
7509
7509
|
function $t() {
|
|
@@ -7736,19 +7736,19 @@ var Cs = function(t, e) {
|
|
|
7736
7736
|
Wt(Y), t.exportFunction(n + "_pairingEq" + Y);
|
|
7737
7737
|
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");
|
|
7738
7738
|
};
|
|
7739
|
-
const Mt = be,
|
|
7740
|
-
var
|
|
7739
|
+
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;
|
|
7740
|
+
var Ss = function(t, e) {
|
|
7741
7741
|
const n = e || "bls12381";
|
|
7742
7742
|
if (t.modules[n])
|
|
7743
7743
|
return n;
|
|
7744
|
-
const a = 0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaabn, s = 0x73eda753299d7d483339d80809a1d80553bda402fffe5bfeffffffff00000001n, g = Math.floor((
|
|
7745
|
-
|
|
7746
|
-
const L = t.alloc(Mt.bigInt2BytesLE(F(4n), C)), I =
|
|
7747
|
-
yn(t, "frm", "frm", "frm", "frm_mul"),
|
|
7748
|
-
const v =
|
|
7744
|
+
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");
|
|
7745
|
+
Es(t, s, "fr", "frm", "intr");
|
|
7746
|
+
const L = t.alloc(Mt.bigInt2BytesLE(F(4n), C)), I = wa(t, "g1m", "f1m", L);
|
|
7747
|
+
yn(t, "frm", "frm", "frm", "frm_mul"), Bs(t, "pol", "frm"), vs(t, "qap", "frm");
|
|
7748
|
+
const v = Ea(t, "f1m_neg", "f2m", "f1m"), U = t.alloc([
|
|
7749
7749
|
...Mt.bigInt2BytesLE(F(4n), C),
|
|
7750
7750
|
...Mt.bigInt2BytesLE(F(4n), C)
|
|
7751
|
-
]), w =
|
|
7751
|
+
]), w = wa(t, "g2m", "f2m", U);
|
|
7752
7752
|
function S(f, _) {
|
|
7753
7753
|
const Z = t.addFunction(f);
|
|
7754
7754
|
Z.addParam("pG", "i32"), Z.addParam("pFr", "i32"), Z.addParam("pr", "i32");
|
|
@@ -7860,7 +7860,7 @@ var xs = function(t, e) {
|
|
|
7860
7860
|
);
|
|
7861
7861
|
}
|
|
7862
7862
|
nt();
|
|
7863
|
-
const J =
|
|
7863
|
+
const J = ws(t, v + "_mulNR", "f6m", "f2m");
|
|
7864
7864
|
function ft() {
|
|
7865
7865
|
const f = t.addFunction(J + "_mulNR");
|
|
7866
7866
|
f.addParam("x", "i32"), f.addParam("pr", "i32");
|
|
@@ -7889,7 +7889,7 @@ var xs = function(t, e) {
|
|
|
7889
7889
|
);
|
|
7890
7890
|
}
|
|
7891
7891
|
ft();
|
|
7892
|
-
const at =
|
|
7892
|
+
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;
|
|
7893
7893
|
t.modules[n] = {
|
|
7894
7894
|
n64q: g,
|
|
7895
7895
|
n64r: y,
|
|
@@ -7913,7 +7913,7 @@ var xs = function(t, e) {
|
|
|
7913
7913
|
let _ = f;
|
|
7914
7914
|
const Z = [];
|
|
7915
7915
|
for (; _ > 0n; ) {
|
|
7916
|
-
if (
|
|
7916
|
+
if (va(_)) {
|
|
7917
7917
|
const Q = 2 - Number(_ % 4n);
|
|
7918
7918
|
Z.push(Q), _ = _ - BigInt(Q);
|
|
7919
7919
|
} else
|
|
@@ -7926,7 +7926,7 @@ var xs = function(t, e) {
|
|
|
7926
7926
|
let _ = f;
|
|
7927
7927
|
const Z = [];
|
|
7928
7928
|
for (; _ > 0n; )
|
|
7929
|
-
|
|
7929
|
+
va(_) ? Z.push(1) : Z.push(0), _ = _ >> 1n;
|
|
7930
7930
|
return Z;
|
|
7931
7931
|
}
|
|
7932
7932
|
function Lt() {
|
|
@@ -8319,7 +8319,7 @@ var xs = function(t, e) {
|
|
|
8319
8319
|
(st * ot - rt * gt) % a,
|
|
8320
8320
|
(st * gt + rt * ot) % a
|
|
8321
8321
|
];
|
|
8322
|
-
return
|
|
8322
|
+
return xs(Bt[0]) && (Bt[0] = Bt[0] + a), Bt;
|
|
8323
8323
|
}
|
|
8324
8324
|
}
|
|
8325
8325
|
function Jt() {
|
|
@@ -8636,47 +8636,47 @@ var xs = function(t, e) {
|
|
|
8636
8636
|
for (let f = 1; f <= 5; f++)
|
|
8637
8637
|
vt(f), t.exportFunction(n + "_pairingEq" + f);
|
|
8638
8638
|
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");
|
|
8639
|
-
},
|
|
8640
|
-
function
|
|
8639
|
+
}, Is = As, Os = Ss;
|
|
8640
|
+
function Pn(c) {
|
|
8641
8641
|
if (typeof c == "bigint" || c.eq !== void 0)
|
|
8642
8642
|
return c.toString(10);
|
|
8643
8643
|
if (c instanceof Uint8Array)
|
|
8644
8644
|
return $e(c, 0);
|
|
8645
8645
|
if (Array.isArray(c))
|
|
8646
|
-
return c.map(
|
|
8646
|
+
return c.map(Pn);
|
|
8647
8647
|
if (typeof c == "object") {
|
|
8648
8648
|
const t = {};
|
|
8649
8649
|
return Object.keys(c).forEach((n) => {
|
|
8650
|
-
t[n] =
|
|
8650
|
+
t[n] = Pn(c[n]);
|
|
8651
8651
|
}), t;
|
|
8652
8652
|
} else
|
|
8653
8653
|
return c;
|
|
8654
8654
|
}
|
|
8655
|
-
function
|
|
8655
|
+
function kn(c) {
|
|
8656
8656
|
if (typeof c == "string" && /^[0-9]+$/.test(c))
|
|
8657
8657
|
return BigInt(c);
|
|
8658
8658
|
if (typeof c == "string" && /^0x[0-9a-fA-F]+$/.test(c))
|
|
8659
8659
|
return BigInt(c);
|
|
8660
8660
|
if (Array.isArray(c))
|
|
8661
|
-
return c.map(
|
|
8661
|
+
return c.map(kn);
|
|
8662
8662
|
if (typeof c == "object") {
|
|
8663
8663
|
if (c === null)
|
|
8664
8664
|
return null;
|
|
8665
8665
|
const t = {};
|
|
8666
8666
|
return Object.keys(c).forEach((n) => {
|
|
8667
|
-
t[n] =
|
|
8667
|
+
t[n] = kn(c[n]);
|
|
8668
8668
|
}), t;
|
|
8669
8669
|
} else
|
|
8670
8670
|
return c;
|
|
8671
8671
|
}
|
|
8672
|
-
function
|
|
8672
|
+
function Ps(c) {
|
|
8673
8673
|
let t = BigInt(0), e = c.length, n = 0;
|
|
8674
8674
|
const a = new DataView(c.buffer, c.byteOffset, c.byteLength);
|
|
8675
8675
|
for (; e > 0; )
|
|
8676
8676
|
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);
|
|
8677
8677
|
return t;
|
|
8678
8678
|
}
|
|
8679
|
-
function
|
|
8679
|
+
function ks(c, t) {
|
|
8680
8680
|
let e = c;
|
|
8681
8681
|
const n = new Uint8Array(t), a = new DataView(n.buffer);
|
|
8682
8682
|
let s = t;
|
|
@@ -8686,14 +8686,14 @@ function Ps(c, t) {
|
|
|
8686
8686
|
throw new Error("Number does not fit in this length");
|
|
8687
8687
|
return n;
|
|
8688
8688
|
}
|
|
8689
|
-
function
|
|
8689
|
+
function Ts(c) {
|
|
8690
8690
|
let t = BigInt(0), e = 0;
|
|
8691
8691
|
const n = new DataView(c.buffer, c.byteOffset, c.byteLength);
|
|
8692
8692
|
for (; e < c.length; )
|
|
8693
8693
|
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);
|
|
8694
8694
|
return t;
|
|
8695
8695
|
}
|
|
8696
|
-
function
|
|
8696
|
+
function Si(c, t) {
|
|
8697
8697
|
let e = c;
|
|
8698
8698
|
typeof t > "u" && (t = Math.floor((We(c) - 1) / 8) + 1, t == 0 && (t = 1));
|
|
8699
8699
|
const n = new Uint8Array(t), a = new DataView(n.buffer);
|
|
@@ -8704,66 +8704,66 @@ function xi(c, t) {
|
|
|
8704
8704
|
throw new Error("Number does not fit in this length");
|
|
8705
8705
|
return n;
|
|
8706
8706
|
}
|
|
8707
|
-
function
|
|
8707
|
+
function Tn(c, t) {
|
|
8708
8708
|
if (typeof t == "bigint" || t.eq !== void 0)
|
|
8709
8709
|
return t.toString(10);
|
|
8710
8710
|
if (t instanceof Uint8Array)
|
|
8711
8711
|
return c.toString(c.e(t));
|
|
8712
8712
|
if (Array.isArray(t))
|
|
8713
|
-
return t.map(
|
|
8713
|
+
return t.map(Tn.bind(this, c));
|
|
8714
8714
|
if (typeof t == "object") {
|
|
8715
8715
|
const e = {};
|
|
8716
8716
|
return Object.keys(t).forEach((a) => {
|
|
8717
|
-
e[a] =
|
|
8717
|
+
e[a] = Tn(c, t[a]);
|
|
8718
8718
|
}), e;
|
|
8719
8719
|
} else
|
|
8720
8720
|
return t;
|
|
8721
8721
|
}
|
|
8722
|
-
function
|
|
8722
|
+
function qn(c, t) {
|
|
8723
8723
|
if (typeof t == "string" && /^[0-9]+$/.test(t))
|
|
8724
8724
|
return c.e(t);
|
|
8725
8725
|
if (typeof t == "string" && /^0x[0-9a-fA-F]+$/.test(t))
|
|
8726
8726
|
return c.e(t);
|
|
8727
8727
|
if (Array.isArray(t))
|
|
8728
|
-
return t.map(
|
|
8728
|
+
return t.map(qn.bind(this, c));
|
|
8729
8729
|
if (typeof t == "object") {
|
|
8730
8730
|
if (t === null)
|
|
8731
8731
|
return null;
|
|
8732
8732
|
const e = {};
|
|
8733
8733
|
return Object.keys(t).forEach((a) => {
|
|
8734
|
-
e[a] =
|
|
8734
|
+
e[a] = qn(c, t[a]);
|
|
8735
8735
|
}), e;
|
|
8736
8736
|
} else
|
|
8737
8737
|
return t;
|
|
8738
8738
|
}
|
|
8739
8739
|
const ze = [];
|
|
8740
8740
|
for (let c = 0; c < 256; c++)
|
|
8741
|
-
ze[c] =
|
|
8742
|
-
function
|
|
8741
|
+
ze[c] = qs(c, 8);
|
|
8742
|
+
function qs(c, t) {
|
|
8743
8743
|
let e = 0, n = c;
|
|
8744
8744
|
for (let a = 0; a < t; a++)
|
|
8745
8745
|
e <<= 1, e = e | n & 1, n >>= 1;
|
|
8746
8746
|
return e;
|
|
8747
8747
|
}
|
|
8748
|
-
function
|
|
8748
|
+
function Ii(c, t) {
|
|
8749
8749
|
return (ze[c >>> 24] | ze[c >>> 16 & 255] << 8 | ze[c >>> 8 & 255] << 16 | ze[c & 255] << 24) >>> 32 - t;
|
|
8750
8750
|
}
|
|
8751
8751
|
function le(c) {
|
|
8752
8752
|
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;
|
|
8753
8753
|
}
|
|
8754
|
-
function
|
|
8754
|
+
function Oi(c, t) {
|
|
8755
8755
|
const e = c.byteLength / t, n = le(e);
|
|
8756
8756
|
if (e != 1 << n)
|
|
8757
8757
|
throw new Error("Invalid number of pointers");
|
|
8758
8758
|
for (let a = 0; a < e; a++) {
|
|
8759
|
-
const s =
|
|
8759
|
+
const s = Ii(a, n);
|
|
8760
8760
|
if (a > s) {
|
|
8761
8761
|
const g = c.slice(a * t, (a + 1) * t);
|
|
8762
8762
|
c.set(c.slice(s * t, (s + 1) * t), a * t), c.set(g, s * t);
|
|
8763
8763
|
}
|
|
8764
8764
|
}
|
|
8765
8765
|
}
|
|
8766
|
-
function
|
|
8766
|
+
function Jn(c, t) {
|
|
8767
8767
|
const e = new Uint8Array(t * c.length);
|
|
8768
8768
|
for (let n = 0; n < c.length; n++)
|
|
8769
8769
|
e.set(c[n], n * t);
|
|
@@ -8775,21 +8775,21 @@ function nn(c, t) {
|
|
|
8775
8775
|
n[a] = c.slice(a * t, a * t + t);
|
|
8776
8776
|
return n;
|
|
8777
8777
|
}
|
|
8778
|
-
const
|
|
8778
|
+
const Ds = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
8779
8779
|
__proto__: null,
|
|
8780
|
-
array2buffer:
|
|
8781
|
-
beBuff2int:
|
|
8782
|
-
beInt2Buff:
|
|
8783
|
-
bitReverse:
|
|
8784
|
-
buffReverseBits:
|
|
8780
|
+
array2buffer: Jn,
|
|
8781
|
+
beBuff2int: Ps,
|
|
8782
|
+
beInt2Buff: ks,
|
|
8783
|
+
bitReverse: Ii,
|
|
8784
|
+
buffReverseBits: Oi,
|
|
8785
8785
|
buffer2array: nn,
|
|
8786
|
-
leBuff2int:
|
|
8787
|
-
leInt2Buff:
|
|
8786
|
+
leBuff2int: Ts,
|
|
8787
|
+
leInt2Buff: Si,
|
|
8788
8788
|
log2: le,
|
|
8789
|
-
stringifyBigInts:
|
|
8790
|
-
stringifyFElements:
|
|
8791
|
-
unstringifyBigInts:
|
|
8792
|
-
unstringifyFElements:
|
|
8789
|
+
stringifyBigInts: Pn,
|
|
8790
|
+
stringifyFElements: Tn,
|
|
8791
|
+
unstringifyBigInts: kn,
|
|
8792
|
+
unstringifyFElements: qn
|
|
8793
8793
|
}, Symbol.toStringTag, { value: "Module" })), ce = 1 << 30;
|
|
8794
8794
|
class Vt {
|
|
8795
8795
|
constructor(t) {
|
|
@@ -8861,7 +8861,7 @@ function me(c, t, e, n) {
|
|
|
8861
8861
|
return o;
|
|
8862
8862
|
};
|
|
8863
8863
|
}
|
|
8864
|
-
class
|
|
8864
|
+
class xa {
|
|
8865
8865
|
constructor(t, e, n, a) {
|
|
8866
8866
|
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)
|
|
8867
8867
|
throw new Error("n8 must be a multiple of 8");
|
|
@@ -8871,7 +8871,7 @@ class va {
|
|
|
8871
8871
|
this.nqr = this.add(this.nqr, this.one), s = this.exp(this.nqr, this.half);
|
|
8872
8872
|
this.shift = this.mul(this.nqr, this.nqr), this.shiftInv = this.inv(this.shift), this.s = 0;
|
|
8873
8873
|
let g = he(this.p, Ee);
|
|
8874
|
-
for (; !
|
|
8874
|
+
for (; !jn(g); )
|
|
8875
8875
|
this.s = this.s + 1, g = xe(g, Ee);
|
|
8876
8876
|
this.w = [], this.w[this.s] = this.exp(this.nqr, g);
|
|
8877
8877
|
for (let d = this.s - 1; d >= 0; d--)
|
|
@@ -8941,27 +8941,27 @@ class va {
|
|
|
8941
8941
|
if (t instanceof Uint8Array)
|
|
8942
8942
|
return t;
|
|
8943
8943
|
let n = ee(t, e);
|
|
8944
|
-
|
|
8945
|
-
const a =
|
|
8944
|
+
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));
|
|
8945
|
+
const a = Si(n, this.n8);
|
|
8946
8946
|
return this.toMontgomery(a);
|
|
8947
8947
|
}
|
|
8948
8948
|
toString(t, e) {
|
|
8949
8949
|
const n = this.fromMontgomery(t), a = $e(n, 0);
|
|
8950
|
-
return
|
|
8950
|
+
return fi(a, e);
|
|
8951
8951
|
}
|
|
8952
8952
|
fromRng(t) {
|
|
8953
8953
|
let e;
|
|
8954
8954
|
const n = new Uint8Array(this.n8);
|
|
8955
8955
|
do {
|
|
8956
|
-
e =
|
|
8956
|
+
e = _i;
|
|
8957
8957
|
for (let a = 0; a < this.n64; a++)
|
|
8958
|
-
e =
|
|
8959
|
-
e =
|
|
8960
|
-
} while (
|
|
8958
|
+
e = $n(e, tn(t.nextU64(), 64 * a));
|
|
8959
|
+
e = Gn(e, this.mask);
|
|
8960
|
+
} while (li(e, this.p));
|
|
8961
8961
|
return je(n, 0, e, this.n8), n;
|
|
8962
8962
|
}
|
|
8963
8963
|
random() {
|
|
8964
|
-
return this.fromRng(
|
|
8964
|
+
return this.fromRng(Zn());
|
|
8965
8965
|
}
|
|
8966
8966
|
toObject(t) {
|
|
8967
8967
|
const e = this.fromMontgomery(t);
|
|
@@ -8990,7 +8990,7 @@ class va {
|
|
|
8990
8990
|
async batchInverse(t) {
|
|
8991
8991
|
let e = !1;
|
|
8992
8992
|
const n = this.n8, a = this.n8;
|
|
8993
|
-
Array.isArray(t) ? (t =
|
|
8993
|
+
Array.isArray(t) ? (t = Jn(t, n), e = !0) : t = t.slice(0, t.byteLength);
|
|
8994
8994
|
const s = Math.floor(t.byteLength / n);
|
|
8995
8995
|
if (s * n !== t.byteLength)
|
|
8996
8996
|
throw new Error("Invalid buffer size");
|
|
@@ -9024,7 +9024,7 @@ class va {
|
|
|
9024
9024
|
return e ? nn(l, a) : l;
|
|
9025
9025
|
}
|
|
9026
9026
|
}
|
|
9027
|
-
class
|
|
9027
|
+
class Sa {
|
|
9028
9028
|
constructor(t, e, n) {
|
|
9029
9029
|
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);
|
|
9030
9030
|
}
|
|
@@ -9106,7 +9106,7 @@ class xa {
|
|
|
9106
9106
|
return a.set(e), a.set(n, this.F.n8), a;
|
|
9107
9107
|
}
|
|
9108
9108
|
random() {
|
|
9109
|
-
return this.fromRng(
|
|
9109
|
+
return this.fromRng(Zn());
|
|
9110
9110
|
}
|
|
9111
9111
|
toObject(t) {
|
|
9112
9112
|
const e = this.F.toObject(t.slice(0, this.F.n8)), n = this.F.toObject(t.slice(this.F.n8, this.F.n8 * 2));
|
|
@@ -9123,7 +9123,7 @@ class xa {
|
|
|
9123
9123
|
return t.slice(this.F.n8);
|
|
9124
9124
|
}
|
|
9125
9125
|
}
|
|
9126
|
-
class
|
|
9126
|
+
class Ms {
|
|
9127
9127
|
constructor(t, e, n) {
|
|
9128
9128
|
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);
|
|
9129
9129
|
}
|
|
@@ -9202,7 +9202,7 @@ class Ds {
|
|
|
9202
9202
|
return s.set(e), s.set(n, this.F.n8), s.set(a, this.F.n8 * 2), s;
|
|
9203
9203
|
}
|
|
9204
9204
|
random() {
|
|
9205
|
-
return this.fromRng(
|
|
9205
|
+
return this.fromRng(Zn());
|
|
9206
9206
|
}
|
|
9207
9207
|
toObject(t) {
|
|
9208
9208
|
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));
|
|
@@ -9222,7 +9222,7 @@ class Ds {
|
|
|
9222
9222
|
return t.slice(this.F.n8 * 2);
|
|
9223
9223
|
}
|
|
9224
9224
|
}
|
|
9225
|
-
class
|
|
9225
|
+
class Ia {
|
|
9226
9226
|
constructor(t, e, n, a, s, g) {
|
|
9227
9227
|
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);
|
|
9228
9228
|
}
|
|
@@ -9451,7 +9451,7 @@ class Sa {
|
|
|
9451
9451
|
return this.toAffine(t).slice(this.F.n8);
|
|
9452
9452
|
}
|
|
9453
9453
|
}
|
|
9454
|
-
function
|
|
9454
|
+
function Pi(c) {
|
|
9455
9455
|
let e, n;
|
|
9456
9456
|
c && (c.onmessage = function(o) {
|
|
9457
9457
|
let y;
|
|
@@ -9535,23 +9535,23 @@ function Oi(c) {
|
|
|
9535
9535
|
}
|
|
9536
9536
|
return l;
|
|
9537
9537
|
}
|
|
9538
|
-
const
|
|
9539
|
-
class
|
|
9538
|
+
const Rs = Worker, Cn = 25;
|
|
9539
|
+
class Oa {
|
|
9540
9540
|
constructor() {
|
|
9541
9541
|
this.promise = new Promise((t, e) => {
|
|
9542
9542
|
this.reject = e, this.resolve = t;
|
|
9543
9543
|
});
|
|
9544
9544
|
}
|
|
9545
9545
|
}
|
|
9546
|
-
function
|
|
9546
|
+
function Ns(c) {
|
|
9547
9547
|
return new Promise((t) => setTimeout(t, c));
|
|
9548
9548
|
}
|
|
9549
|
-
function
|
|
9549
|
+
function zs(c) {
|
|
9550
9550
|
return process.browser ? globalThis.btoa(c) : Buffer.from(c).toString("base64");
|
|
9551
9551
|
}
|
|
9552
|
-
const
|
|
9553
|
-
async function
|
|
9554
|
-
const e = new
|
|
9552
|
+
const Us = zs("(" + Pi.toString() + ")(self)"), js = "data:application/javascript;base64," + Us;
|
|
9553
|
+
async function $s(c, t) {
|
|
9554
|
+
const e = new Gs();
|
|
9555
9555
|
e.memory = new WebAssembly.Memory({ initial: Cn }), e.u8 = new Uint8Array(e.memory.buffer), e.u32 = new Uint32Array(e.memory.buffer);
|
|
9556
9556
|
const n = await WebAssembly.compile(c.code);
|
|
9557
9557
|
if (e.instance = await WebAssembly.instantiate(n, {
|
|
@@ -9559,7 +9559,7 @@ async function js(c, t) {
|
|
|
9559
9559
|
memory: e.memory
|
|
9560
9560
|
}
|
|
9561
9561
|
}), 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)
|
|
9562
|
-
e.code = c.code, e.taskManager =
|
|
9562
|
+
e.code = c.code, e.taskManager = Pi(), await e.taskManager([{
|
|
9563
9563
|
cmd: "INIT",
|
|
9564
9564
|
init: Cn,
|
|
9565
9565
|
code: e.code.slice()
|
|
@@ -9569,7 +9569,7 @@ async function js(c, t) {
|
|
|
9569
9569
|
let s;
|
|
9570
9570
|
typeof navigator == "object" && navigator.hardwareConcurrency ? s = navigator.hardwareConcurrency : s = on.cpus().length, s == 0 && (s = 2), s > 64 && (s = 64), e.concurrency = s;
|
|
9571
9571
|
for (let d = 0; d < s; d++)
|
|
9572
|
-
e.workers[d] = new
|
|
9572
|
+
e.workers[d] = new Rs(js), e.workers[d].addEventListener("message", a(d)), e.working[d] = !1;
|
|
9573
9573
|
const g = [];
|
|
9574
9574
|
for (let d = 0; d < e.workers.length; d++) {
|
|
9575
9575
|
const C = c.code.slice();
|
|
@@ -9589,7 +9589,7 @@ async function js(c, t) {
|
|
|
9589
9589
|
};
|
|
9590
9590
|
}
|
|
9591
9591
|
}
|
|
9592
|
-
class
|
|
9592
|
+
class Gs {
|
|
9593
9593
|
constructor() {
|
|
9594
9594
|
this.actionQueue = [], this.oldPFree = 0;
|
|
9595
9595
|
}
|
|
@@ -9606,7 +9606,7 @@ class $s {
|
|
|
9606
9606
|
postAction(t, e, n, a) {
|
|
9607
9607
|
if (this.working[t])
|
|
9608
9608
|
throw new Error("Posting a job t a working worker");
|
|
9609
|
-
return this.working[t] = !0, this.pendingDeferreds[t] = a || new
|
|
9609
|
+
return this.working[t] = !0, this.pendingDeferreds[t] = a || new Oa(), this.workers[t].postMessage(e, n), this.pendingDeferreds[t].promise;
|
|
9610
9610
|
}
|
|
9611
9611
|
processWorks() {
|
|
9612
9612
|
for (let t = 0; t < this.workers.length && this.actionQueue.length > 0; t++)
|
|
@@ -9616,7 +9616,7 @@ class $s {
|
|
|
9616
9616
|
}
|
|
9617
9617
|
}
|
|
9618
9618
|
queueAction(t, e) {
|
|
9619
|
-
const n = new
|
|
9619
|
+
const n = new Oa();
|
|
9620
9620
|
if (this.singleThread) {
|
|
9621
9621
|
const a = this.taskManager(t);
|
|
9622
9622
|
n.resolve(a);
|
|
@@ -9650,7 +9650,7 @@ class $s {
|
|
|
9650
9650
|
async terminate() {
|
|
9651
9651
|
for (let t = 0; t < this.workers.length; t++)
|
|
9652
9652
|
this.workers[t].postMessage([{ cmd: "TERMINATE" }]);
|
|
9653
|
-
await
|
|
9653
|
+
await Ns(200);
|
|
9654
9654
|
}
|
|
9655
9655
|
}
|
|
9656
9656
|
function An(c, t) {
|
|
@@ -9707,7 +9707,7 @@ function An(c, t) {
|
|
|
9707
9707
|
return w;
|
|
9708
9708
|
};
|
|
9709
9709
|
}
|
|
9710
|
-
function
|
|
9710
|
+
function Zs(c) {
|
|
9711
9711
|
const t = c.tm;
|
|
9712
9712
|
c.pairing = function(n, a) {
|
|
9713
9713
|
t.startSyncOp();
|
|
@@ -9774,7 +9774,7 @@ function Gs(c) {
|
|
|
9774
9774
|
return this.tm.endSyncOp(), s;
|
|
9775
9775
|
};
|
|
9776
9776
|
}
|
|
9777
|
-
const
|
|
9777
|
+
const Pa = [
|
|
9778
9778
|
1,
|
|
9779
9779
|
1,
|
|
9780
9780
|
1,
|
|
@@ -9808,7 +9808,7 @@ const Oa = [
|
|
|
9808
9808
|
17,
|
|
9809
9809
|
17
|
|
9810
9810
|
];
|
|
9811
|
-
function
|
|
9811
|
+
function ka(c, t) {
|
|
9812
9812
|
const e = c[t], n = e.tm;
|
|
9813
9813
|
async function a(g, d, C, l, o) {
|
|
9814
9814
|
if (!(g instanceof Uint8Array))
|
|
@@ -9829,7 +9829,7 @@ function Pa(c, t) {
|
|
|
9829
9829
|
const x = Math.floor(d.byteLength / m);
|
|
9830
9830
|
if (x * m != d.byteLength)
|
|
9831
9831
|
throw new Error("Scalar size does not match");
|
|
9832
|
-
const O =
|
|
9832
|
+
const O = Pa[le(m)], L = Math.floor((x * 8 - 1) / O) + 1, I = [];
|
|
9833
9833
|
for (let w = 0; w < L; w++) {
|
|
9834
9834
|
const S = [
|
|
9835
9835
|
{ cmd: "ALLOCSET", var: 0, buff: g },
|
|
@@ -9871,7 +9871,7 @@ function Pa(c, t) {
|
|
|
9871
9871
|
const x = Math.floor(g.byteLength / m), O = Math.floor(d.byteLength / x);
|
|
9872
9872
|
if (O * x != d.byteLength)
|
|
9873
9873
|
throw new Error("Scalar size does not match");
|
|
9874
|
-
const L =
|
|
9874
|
+
const L = Pa[le(x)], I = Math.floor((O * 8 - 1) / L) + 1;
|
|
9875
9875
|
let v;
|
|
9876
9876
|
v = Math.floor(x / (n.concurrency / I)), v > 4194304 && (v = 4194304), v < 1024 && (v = 1024);
|
|
9877
9877
|
const U = [];
|
|
@@ -9900,7 +9900,7 @@ function Fn(c, t) {
|
|
|
9900
9900
|
let L, I, v, U, w, S, F, r;
|
|
9901
9901
|
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");
|
|
9902
9902
|
let h = !1;
|
|
9903
|
-
Array.isArray(l) ? (l =
|
|
9903
|
+
Array.isArray(l) ? (l = Jn(l, L), h = !0) : l = l.slice(0, l.byteLength);
|
|
9904
9904
|
const R = l.byteLength / L, j = le(R);
|
|
9905
9905
|
if (1 << j != R)
|
|
9906
9906
|
throw new Error("fft must be multiple of 2");
|
|
@@ -9911,7 +9911,7 @@ function Fn(c, t) {
|
|
|
9911
9911
|
let T;
|
|
9912
9912
|
o && (T = n.inv(n.e(R)));
|
|
9913
9913
|
let D;
|
|
9914
|
-
|
|
9914
|
+
Oi(l, L);
|
|
9915
9915
|
let A, M = Math.min(1 << O, R), H = R / M;
|
|
9916
9916
|
for (; H < a.concurrency && M >= 16; )
|
|
9917
9917
|
H *= 2, M /= 2;
|
|
@@ -10194,9 +10194,9 @@ function Fn(c, t) {
|
|
|
10194
10194
|
return w;
|
|
10195
10195
|
};
|
|
10196
10196
|
}
|
|
10197
|
-
async function
|
|
10198
|
-
const t = await
|
|
10199
|
-
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
|
|
10197
|
+
async function ki(c) {
|
|
10198
|
+
const t = await $s(c.wasm, c.singleThread), e = {};
|
|
10199
|
+
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) {
|
|
10200
10200
|
const s = new Uint8Array(a * n.length);
|
|
10201
10201
|
for (let g = 0; g < n.length; g++)
|
|
10202
10202
|
s.set(n[g], g * a);
|
|
@@ -10211,20 +10211,20 @@ async function Pi(c) {
|
|
|
10211
10211
|
function Pe(c) {
|
|
10212
10212
|
return BigInt(c);
|
|
10213
10213
|
}
|
|
10214
|
-
function
|
|
10214
|
+
function Ti(c) {
|
|
10215
10215
|
return c < 0n;
|
|
10216
10216
|
}
|
|
10217
|
-
function
|
|
10217
|
+
function Ws(c) {
|
|
10218
10218
|
return c === 0n;
|
|
10219
10219
|
}
|
|
10220
|
-
function
|
|
10221
|
-
return
|
|
10220
|
+
function Xs(c) {
|
|
10221
|
+
return Ti(c) ? c.toString(2).length - 1 : c.toString(2).length;
|
|
10222
10222
|
}
|
|
10223
10223
|
function En(c) {
|
|
10224
10224
|
const t = [], e = Pe(c);
|
|
10225
10225
|
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;
|
|
10226
10226
|
}
|
|
10227
|
-
function
|
|
10227
|
+
function Vs(c) {
|
|
10228
10228
|
for (var t = [], e = 0; e < c.length; e++) {
|
|
10229
10229
|
var n = c.charCodeAt(e);
|
|
10230
10230
|
n < 128 ? t.push(n) : n < 2048 ? t.push(
|
|
@@ -10244,56 +10244,56 @@ function Xs(c) {
|
|
|
10244
10244
|
return t;
|
|
10245
10245
|
}
|
|
10246
10246
|
function Ne(c) {
|
|
10247
|
-
const t =
|
|
10247
|
+
const t = Vs(c);
|
|
10248
10248
|
return [...Rt(t.length), ...t];
|
|
10249
10249
|
}
|
|
10250
|
-
function
|
|
10250
|
+
function qi(c) {
|
|
10251
10251
|
const t = [];
|
|
10252
10252
|
let e = Pe(c);
|
|
10253
|
-
if (
|
|
10253
|
+
if (Ti(e))
|
|
10254
10254
|
throw new Error("Number cannot be negative");
|
|
10255
|
-
for (; !
|
|
10255
|
+
for (; !Ws(e); )
|
|
10256
10256
|
t.push(Number(e & 0x7Fn)), e = e >> 7n;
|
|
10257
10257
|
t.length == 0 && t.push(0);
|
|
10258
10258
|
for (let n = 0; n < t.length - 1; n++)
|
|
10259
10259
|
t[n] = t[n] | 128;
|
|
10260
10260
|
return t;
|
|
10261
10261
|
}
|
|
10262
|
-
function
|
|
10262
|
+
function Di(c) {
|
|
10263
10263
|
let t, e;
|
|
10264
|
-
const n =
|
|
10264
|
+
const n = Xs(c);
|
|
10265
10265
|
c < 0 ? (e = !0, t = (1n << BigInt(n)) + c) : (e = !1, t = Pe(c));
|
|
10266
|
-
const a = 7 - n % 7, s = (1n << BigInt(a)) - 1n << BigInt(n), g = (1 << 7 - a) - 1 | 128, d =
|
|
10266
|
+
const a = 7 - n % 7, s = (1n << BigInt(a)) - 1n << BigInt(n), g = (1 << 7 - a) - 1 | 128, d = qi(t + s);
|
|
10267
10267
|
return e || (d[d.length - 1] = d[d.length - 1] & g), d;
|
|
10268
10268
|
}
|
|
10269
|
-
function
|
|
10269
|
+
function Dn(c) {
|
|
10270
10270
|
let t = Pe(c);
|
|
10271
10271
|
if (t > 0xFFFFFFFFn)
|
|
10272
10272
|
throw new Error("Number too big");
|
|
10273
10273
|
if (t > 0x7FFFFFFFn && (t = t - 0x100000000n), t < -2147483648n)
|
|
10274
10274
|
throw new Error("Number too small");
|
|
10275
|
-
return
|
|
10275
|
+
return Di(t);
|
|
10276
10276
|
}
|
|
10277
|
-
function
|
|
10277
|
+
function Hs(c) {
|
|
10278
10278
|
let t = Pe(c);
|
|
10279
10279
|
if (t > 0xFFFFFFFFFFFFFFFFn)
|
|
10280
10280
|
throw new Error("Number too big");
|
|
10281
10281
|
if (t > 0x7FFFFFFFFFFFFFFFn && (t = t - 0x10000000000000000n), t < -9223372036854775808n)
|
|
10282
10282
|
throw new Error("Number too small");
|
|
10283
|
-
return
|
|
10283
|
+
return Di(t);
|
|
10284
10284
|
}
|
|
10285
10285
|
function Rt(c) {
|
|
10286
10286
|
let t = Pe(c);
|
|
10287
10287
|
if (t > 0xFFFFFFFFn)
|
|
10288
10288
|
throw new Error("Number too big");
|
|
10289
|
-
return
|
|
10289
|
+
return qi(t);
|
|
10290
10290
|
}
|
|
10291
|
-
function
|
|
10291
|
+
function Ta(c) {
|
|
10292
10292
|
return Array.from(c, function(t) {
|
|
10293
10293
|
return ("0" + (t & 255).toString(16)).slice(-2);
|
|
10294
10294
|
}).join("");
|
|
10295
10295
|
}
|
|
10296
|
-
class
|
|
10296
|
+
class Qs {
|
|
10297
10297
|
constructor(t) {
|
|
10298
10298
|
this.func = t, this.functionName = t.functionName, this.module = t.module;
|
|
10299
10299
|
}
|
|
@@ -10422,10 +10422,10 @@ class Hs {
|
|
|
10422
10422
|
return [...t, 26];
|
|
10423
10423
|
}
|
|
10424
10424
|
i64_const(t) {
|
|
10425
|
-
return [66, ...
|
|
10425
|
+
return [66, ...Hs(t)];
|
|
10426
10426
|
}
|
|
10427
10427
|
i32_const(t) {
|
|
10428
|
-
return [65, ...
|
|
10428
|
+
return [65, ...Dn(t)];
|
|
10429
10429
|
}
|
|
10430
10430
|
i64_eqz(t) {
|
|
10431
10431
|
return [...t, 80];
|
|
@@ -10617,7 +10617,7 @@ const wn = {
|
|
|
10617
10617
|
func: 96,
|
|
10618
10618
|
emptyblock: 64
|
|
10619
10619
|
};
|
|
10620
|
-
class
|
|
10620
|
+
class qa {
|
|
10621
10621
|
constructor(t, e, n, a, s) {
|
|
10622
10622
|
if (n == "import")
|
|
10623
10623
|
this.fnType = "import", this.moduleName = a, this.fieldName = s;
|
|
@@ -10673,10 +10673,10 @@ class Ta {
|
|
|
10673
10673
|
this.code.push(...[].concat(...t));
|
|
10674
10674
|
}
|
|
10675
10675
|
getCodeBuilder() {
|
|
10676
|
-
return new
|
|
10676
|
+
return new Qs(this);
|
|
10677
10677
|
}
|
|
10678
10678
|
}
|
|
10679
|
-
class
|
|
10679
|
+
class Mi {
|
|
10680
10680
|
constructor() {
|
|
10681
10681
|
this.functions = [], this.functionIdxByName = {}, this.nImportFunctions = 0, this.nInternalFunctions = 0, this.memory = {
|
|
10682
10682
|
pagesSize: 1,
|
|
@@ -10702,7 +10702,7 @@ class Di {
|
|
|
10702
10702
|
if (typeof this.functionIdxByName[t] < "u")
|
|
10703
10703
|
throw new Error(`Function already defined: ${t}`);
|
|
10704
10704
|
const e = this.functions.length;
|
|
10705
|
-
return this.functionIdxByName[t] = e, this.functions.push(new
|
|
10705
|
+
return this.functionIdxByName[t] = e, this.functions.push(new qa(this, t, "internal")), this.nInternalFunctions++, this.functions[e];
|
|
10706
10706
|
}
|
|
10707
10707
|
addIimportFunction(t, e, n) {
|
|
10708
10708
|
if (typeof this.functionIdxByName[t] < "u")
|
|
@@ -10711,7 +10711,7 @@ class Di {
|
|
|
10711
10711
|
throw new Error(`Import functions must be declared before internal: ${t}`);
|
|
10712
10712
|
let a = n || t;
|
|
10713
10713
|
const s = this.functions.length;
|
|
10714
|
-
return this.functionIdxByName[t] = s, this.functions.push(new
|
|
10714
|
+
return this.functionIdxByName[t] = s, this.functions.push(new qa(this, t, "import", e, a)), this.nImportFunctions++, this.functions[s];
|
|
10715
10715
|
}
|
|
10716
10716
|
setMemory(t, e, n) {
|
|
10717
10717
|
this.memory = {
|
|
@@ -10754,11 +10754,11 @@ class Di {
|
|
|
10754
10754
|
this.signatures = [];
|
|
10755
10755
|
const t = {};
|
|
10756
10756
|
if (this.functionsTable.length > 0) {
|
|
10757
|
-
const e = this.functions[this.functionsTable[0]].getSignature(), n = "s_" +
|
|
10757
|
+
const e = this.functions[this.functionsTable[0]].getSignature(), n = "s_" + Ta(e);
|
|
10758
10758
|
t[n] = 0, this.signatures.push(e);
|
|
10759
10759
|
}
|
|
10760
10760
|
for (let e = 0; e < this.functions.length; e++) {
|
|
10761
|
-
const n = this.functions[e].getSignature(), a = "s_" +
|
|
10761
|
+
const n = this.functions[e].getSignature(), a = "s_" + Ta(n);
|
|
10762
10762
|
typeof t[a] > "u" && (t[a] = this.signatures.length, this.signatures.push(n)), this.functions[e].signatureIdx = t[a];
|
|
10763
10763
|
}
|
|
10764
10764
|
}
|
|
@@ -10834,7 +10834,7 @@ class Di {
|
|
|
10834
10834
|
// Table (0 in MVP)
|
|
10835
10835
|
65,
|
|
10836
10836
|
// offset 0
|
|
10837
|
-
...
|
|
10837
|
+
...Dn(0),
|
|
10838
10838
|
11,
|
|
10839
10839
|
...Rt(this.functionsTable.length),
|
|
10840
10840
|
...t
|
|
@@ -10877,7 +10877,7 @@ class Di {
|
|
|
10877
10877
|
t.push([
|
|
10878
10878
|
0,
|
|
10879
10879
|
65,
|
|
10880
|
-
...
|
|
10880
|
+
...Dn(this.datas[e].offset),
|
|
10881
10881
|
11,
|
|
10882
10882
|
...Rt(this.datas[e].bytes.length),
|
|
10883
10883
|
...this.datas[e].bytes
|
|
@@ -10889,9 +10889,9 @@ class Di {
|
|
|
10889
10889
|
}
|
|
10890
10890
|
}
|
|
10891
10891
|
globalThis.curve_bn128 = null;
|
|
10892
|
-
async function
|
|
10893
|
-
const e = new
|
|
10894
|
-
e.setMemory(25),
|
|
10892
|
+
async function Js(c, t) {
|
|
10893
|
+
const e = new Mi();
|
|
10894
|
+
e.setMemory(25), Is(e), t && t(e);
|
|
10895
10895
|
const n = {};
|
|
10896
10896
|
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)
|
|
10897
10897
|
return globalThis.curve_bn128;
|
|
@@ -10904,15 +10904,15 @@ async function Qs(c, t) {
|
|
|
10904
10904
|
n8r: 32,
|
|
10905
10905
|
cofactorG2: ee("30644e72e131a029b85045b68181585e06ceecda572a2489345f2299c0f9fa8d", 16),
|
|
10906
10906
|
singleThread: !!c
|
|
10907
|
-
}, s = await
|
|
10907
|
+
}, s = await ki(a);
|
|
10908
10908
|
return s.terminate = async function() {
|
|
10909
10909
|
a.singleThread || (globalThis.curve_bn128 = null, await this.tm.terminate());
|
|
10910
10910
|
}, c || (globalThis.curve_bn128 = s), s;
|
|
10911
10911
|
}
|
|
10912
10912
|
globalThis.curve_bls12381 = null;
|
|
10913
|
-
async function
|
|
10914
|
-
const e = new
|
|
10915
|
-
e.setMemory(25),
|
|
10913
|
+
async function Ks(c, t) {
|
|
10914
|
+
const e = new Mi();
|
|
10915
|
+
e.setMemory(25), Os(e), t && t(e);
|
|
10916
10916
|
const n = {};
|
|
10917
10917
|
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)
|
|
10918
10918
|
return globalThis.curve_bls12381;
|
|
@@ -10926,7 +10926,7 @@ async function Js(c, t) {
|
|
|
10926
10926
|
cofactorG1: ee("0x396c8c005555e1568c00aaab0000aaab", 16),
|
|
10927
10927
|
cofactorG2: ee("0x5d543a95414e7f1091d50792876a202cd91de4547085abaa68a205b2e5a7ddfa628f1cb4d9e82ef21537e293a6691ae1616ec6e786f0c70cf1c38e31c7238e5", 16),
|
|
10928
10928
|
singleThread: !!c
|
|
10929
|
-
}, s = await
|
|
10929
|
+
}, s = await ki(a);
|
|
10930
10930
|
return s.terminate = async function() {
|
|
10931
10931
|
a.singleThread || (globalThis.curve_bls12381 = null, await this.tm.terminate());
|
|
10932
10932
|
}, c || (globalThis.curve_bls12381 = s), s;
|
|
@@ -10935,16 +10935,16 @@ ee("73eda753299d7d483339d80809a1d80553bda402fffe5bfeffffffff00000001", 16);
|
|
|
10935
10935
|
ee("21888242871839275222246405745257275088548364400416034343698204186575808495617");
|
|
10936
10936
|
ee("1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab", 16);
|
|
10937
10937
|
ee("21888242871839275222246405745257275088696311157297823662689037894645226208583");
|
|
10938
|
-
const Yt =
|
|
10938
|
+
const Yt = Sc, ln = Ds;
|
|
10939
10939
|
Yt.e("73eda753299d7d483339d80809a1d80553bda402fffe5bfeffffffff00000001", 16);
|
|
10940
10940
|
Yt.e("21888242871839275222246405745257275088548364400416034343698204186575808495617");
|
|
10941
|
-
const
|
|
10942
|
-
async function
|
|
10941
|
+
const Ys = Yt.e("1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab", 16), tr = Yt.e("21888242871839275222246405745257275088696311157297823662689037894645226208583");
|
|
10942
|
+
async function Kn(c) {
|
|
10943
10943
|
let t;
|
|
10944
|
-
if (Yt.eq(c,
|
|
10945
|
-
t = await Qs();
|
|
10946
|
-
else if (Yt.eq(c, Ks))
|
|
10944
|
+
if (Yt.eq(c, tr))
|
|
10947
10945
|
t = await Js();
|
|
10946
|
+
else if (Yt.eq(c, Ys))
|
|
10947
|
+
t = await Ks();
|
|
10948
10948
|
else
|
|
10949
10949
|
throw new Error(`Curve not supported: ${Yt.toString(c)}`);
|
|
10950
10950
|
return t;
|
|
@@ -10952,7 +10952,7 @@ async function Jn(c) {
|
|
|
10952
10952
|
function un(c) {
|
|
10953
10953
|
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;
|
|
10954
10954
|
}
|
|
10955
|
-
const
|
|
10955
|
+
const er = 1, nr = 2, Ri = 10, ar = 2;
|
|
10956
10956
|
async function ue(c, t, e) {
|
|
10957
10957
|
const n = await c.read(t.G1.F.n8 * 2), a = t.G1.fromRprLEM(n, 0);
|
|
10958
10958
|
return e ? t.G1.toObject(a) : a;
|
|
@@ -10961,56 +10961,56 @@ async function Ue(c, t, e) {
|
|
|
10961
10961
|
const n = await c.read(t.G2.F.n8 * 2), a = t.G2.fromRprLEM(n, 0);
|
|
10962
10962
|
return e ? t.G2.toObject(a) : a;
|
|
10963
10963
|
}
|
|
10964
|
-
async function
|
|
10964
|
+
async function ir(c, t, e) {
|
|
10965
10965
|
await Ge(c, t, 1);
|
|
10966
10966
|
const n = await c.readULE32();
|
|
10967
|
-
if (await Ze(c), n ===
|
|
10968
|
-
return await ir(c, t, e);
|
|
10969
|
-
if (n === er)
|
|
10967
|
+
if (await Ze(c), n === er)
|
|
10970
10968
|
return await or(c, t, e);
|
|
10971
|
-
if (n ===
|
|
10969
|
+
if (n === nr)
|
|
10972
10970
|
return await cr(c, t, e);
|
|
10971
|
+
if (n === Ri)
|
|
10972
|
+
return await sr(c, t, e);
|
|
10973
10973
|
throw new Error("Protocol not supported: ");
|
|
10974
10974
|
}
|
|
10975
|
-
async function
|
|
10975
|
+
async function or(c, t, e) {
|
|
10976
10976
|
const n = {};
|
|
10977
10977
|
n.protocol = "groth16", await Ge(c, t, 2);
|
|
10978
10978
|
const a = await c.readULE32();
|
|
10979
10979
|
n.n8q = a, n.q = await we(c, a);
|
|
10980
10980
|
const s = await c.readULE32();
|
|
10981
|
-
return n.n8r = s, n.r = await we(c, s), n.curve = await
|
|
10981
|
+
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;
|
|
10982
10982
|
}
|
|
10983
|
-
async function
|
|
10983
|
+
async function cr(c, t, e) {
|
|
10984
10984
|
const n = {};
|
|
10985
10985
|
n.protocol = "plonk", await Ge(c, t, 2);
|
|
10986
10986
|
const a = await c.readULE32();
|
|
10987
10987
|
n.n8q = a, n.q = await we(c, a);
|
|
10988
10988
|
const s = await c.readULE32();
|
|
10989
|
-
return n.n8r = s, n.r = await we(c, s), n.curve = await
|
|
10989
|
+
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;
|
|
10990
10990
|
}
|
|
10991
|
-
async function
|
|
10991
|
+
async function sr(c, t, e) {
|
|
10992
10992
|
const n = {};
|
|
10993
|
-
n.protocol = "fflonk", n.protocolId =
|
|
10993
|
+
n.protocol = "fflonk", n.protocolId = Ri, await Ge(c, t, ar);
|
|
10994
10994
|
const a = await c.readULE32();
|
|
10995
|
-
n.n8q = a, n.q = await we(c, a), n.curve = await
|
|
10995
|
+
n.n8q = a, n.q = await we(c, a), n.curve = await Kn(n.q);
|
|
10996
10996
|
const s = await c.readULE32();
|
|
10997
10997
|
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;
|
|
10998
10998
|
}
|
|
10999
|
-
async function
|
|
11000
|
-
await
|
|
10999
|
+
async function rr(c, t, e) {
|
|
11000
|
+
await ua(c, 1);
|
|
11001
11001
|
const n = (Math.floor((Yt.bitLength(e) - 1) / 64) + 1) * 8;
|
|
11002
|
-
if (await c.writeULE32(n), await
|
|
11002
|
+
if (await c.writeULE32(n), await dc(c, e, n), t.byteLength % n != 0)
|
|
11003
11003
|
throw new Error("Invalid witness length");
|
|
11004
|
-
await c.writeULE32(t.byteLength / n), await
|
|
11004
|
+
await c.writeULE32(t.byteLength / n), await da(c), await ua(c, 2), await c.write(t), await da(c);
|
|
11005
11005
|
}
|
|
11006
|
-
async function
|
|
11006
|
+
async function lr(c, t) {
|
|
11007
11007
|
await Ge(c, t, 1);
|
|
11008
11008
|
const e = await c.readULE32(), n = await we(c, e), a = await c.readULE32();
|
|
11009
11009
|
return await Ze(c), { n8: e, q: n, nWitness: a };
|
|
11010
11010
|
}
|
|
11011
|
-
const { stringifyBigInts:
|
|
11012
|
-
async function
|
|
11013
|
-
const { fd: n, sections: a } = await
|
|
11011
|
+
const { stringifyBigInts: Da } = ln;
|
|
11012
|
+
async function ur(c, t, e) {
|
|
11013
|
+
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);
|
|
11014
11014
|
if (C.protocol != "groth16")
|
|
11015
11015
|
throw new Error("zkey file is not groth16");
|
|
11016
11016
|
if (!Yt.eq(C.r, s.q))
|
|
@@ -11023,9 +11023,9 @@ async function lr(c, t, e) {
|
|
|
11023
11023
|
e && e.debug("Reading Coeffs");
|
|
11024
11024
|
const O = await Ae(g, d, 4);
|
|
11025
11025
|
e && e.debug("Building ABC");
|
|
11026
|
-
const [L, I, v] = await
|
|
11026
|
+
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");
|
|
11027
11027
|
e && e.debug("Join ABC");
|
|
11028
|
-
const A = await
|
|
11028
|
+
const A = await fr(l, C, F, R, D, e);
|
|
11029
11029
|
let M = {};
|
|
11030
11030
|
e && e.debug("Reading A Points");
|
|
11031
11031
|
const H = await Ae(g, d, 5);
|
|
@@ -11044,9 +11044,9 @@ async function lr(c, t, e) {
|
|
|
11044
11044
|
const i = x.slice(P * o.n8, P * o.n8 + o.n8);
|
|
11045
11045
|
K.push(Yt.fromRprLE(i));
|
|
11046
11046
|
}
|
|
11047
|
-
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 =
|
|
11047
|
+
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 };
|
|
11048
11048
|
}
|
|
11049
|
-
async function
|
|
11049
|
+
async function dr(c, t, e, n, a) {
|
|
11050
11050
|
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];
|
|
11051
11051
|
for (let E = 0; E < d; E++) {
|
|
11052
11052
|
a && E % 1e6 == 0 && a.debug(`QAP AB: ${E}/${d}`);
|
|
@@ -11069,7 +11069,7 @@ async function ur(c, t, e, n, a) {
|
|
|
11069
11069
|
);
|
|
11070
11070
|
return [C, l, o];
|
|
11071
11071
|
}
|
|
11072
|
-
async function
|
|
11072
|
+
async function fr(c, t, e, n, a, s) {
|
|
11073
11073
|
const d = c.Fr.n8, C = Math.floor(e.byteLength / c.Fr.n8), l = [];
|
|
11074
11074
|
for (let m = 0; m < C; m += 4194304) {
|
|
11075
11075
|
s && s.debug(`JoinABC: ${m}/${C}`);
|
|
@@ -11094,7 +11094,7 @@ async function dr(c, t, e, n, a, s) {
|
|
|
11094
11094
|
y.set(o[m][0], E), E += o[m][0].byteLength;
|
|
11095
11095
|
return y;
|
|
11096
11096
|
}
|
|
11097
|
-
function
|
|
11097
|
+
function Ni(c) {
|
|
11098
11098
|
var t = [];
|
|
11099
11099
|
return e(t, c), t;
|
|
11100
11100
|
function e(n, a) {
|
|
@@ -11105,7 +11105,7 @@ function Ri(c) {
|
|
|
11105
11105
|
n.push(a);
|
|
11106
11106
|
}
|
|
11107
11107
|
}
|
|
11108
|
-
function
|
|
11108
|
+
function zi(c) {
|
|
11109
11109
|
const t = BigInt(2) ** BigInt(64);
|
|
11110
11110
|
let e = BigInt("0xCBF29CE484222325");
|
|
11111
11111
|
for (var n = 0; n < c.length; n++)
|
|
@@ -11113,7 +11113,7 @@ function Ni(c) {
|
|
|
11113
11113
|
let a = e.toString(16), s = 16 - a.length;
|
|
11114
11114
|
return a = "0".repeat(s).concat(a), a;
|
|
11115
11115
|
}
|
|
11116
|
-
function
|
|
11116
|
+
function _r(c, t) {
|
|
11117
11117
|
const e = [];
|
|
11118
11118
|
let n = BigInt(c);
|
|
11119
11119
|
const a = BigInt(4294967296);
|
|
@@ -11124,7 +11124,7 @@ function fr(c, t) {
|
|
|
11124
11124
|
e.unshift(0), s--;
|
|
11125
11125
|
return e;
|
|
11126
11126
|
}
|
|
11127
|
-
async function
|
|
11127
|
+
async function gr(c, t) {
|
|
11128
11128
|
t = t || {};
|
|
11129
11129
|
let e = 32767, n, a = !1;
|
|
11130
11130
|
for (; !a; )
|
|
@@ -11191,7 +11191,7 @@ async function _r(c, t) {
|
|
|
11191
11191
|
});
|
|
11192
11192
|
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());
|
|
11193
11193
|
const m = t && (t.sanityCheck || t.logGetSignal || t.logSetSignal || t.logStartComponent || t.logFinishComponent);
|
|
11194
|
-
return l === 2 ? g = new
|
|
11194
|
+
return l === 2 ? g = new hr(E, m) : g = new pr(n, E, m), g;
|
|
11195
11195
|
function x() {
|
|
11196
11196
|
for (var L = "", I = E.exports.getMessageChar(); I != 0; )
|
|
11197
11197
|
L += String.fromCharCode(I), I = E.exports.getMessageChar();
|
|
@@ -11204,13 +11204,13 @@ async function _r(c, t) {
|
|
|
11204
11204
|
return String.fromCharCode.apply(null, v);
|
|
11205
11205
|
}
|
|
11206
11206
|
}
|
|
11207
|
-
class
|
|
11207
|
+
class pr {
|
|
11208
11208
|
constructor(t, e, n) {
|
|
11209
11209
|
this.memory = t, this.i32 = new Uint32Array(t.buffer), this.instance = e, this.n32 = (this.instance.exports.getFrLen() >> 2) - 2;
|
|
11210
11210
|
const a = this.instance.exports.getPRawPrime(), s = new Array(this.n32);
|
|
11211
11211
|
for (let g = 0; g < this.n32; g++)
|
|
11212
11212
|
s[this.n32 - 1 - g] = this.i32[(a >> 2) + g];
|
|
11213
|
-
this.prime = Yt.fromArray(s, 4294967296), this.Fr = new
|
|
11213
|
+
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;
|
|
11214
11214
|
}
|
|
11215
11215
|
circom_version() {
|
|
11216
11216
|
return 1;
|
|
@@ -11219,13 +11219,13 @@ class gr {
|
|
|
11219
11219
|
this.instance.exports.init(this.sanityCheck || e ? 1 : 0);
|
|
11220
11220
|
const n = this.allocInt(), a = this.allocFr();
|
|
11221
11221
|
Object.keys(t).forEach((g) => {
|
|
11222
|
-
const d =
|
|
11222
|
+
const d = zi(g), C = parseInt(d.slice(0, 8), 16), l = parseInt(d.slice(8, 16), 16);
|
|
11223
11223
|
try {
|
|
11224
11224
|
this.instance.exports.getSignalOffset32(n, 0, C, l);
|
|
11225
11225
|
} catch {
|
|
11226
11226
|
throw new Error(`Signal ${g} is not an input of the circuit.`);
|
|
11227
11227
|
}
|
|
11228
|
-
const o = this.getInt(n), y =
|
|
11228
|
+
const o = this.getInt(n), y = Ni(t[g]);
|
|
11229
11229
|
for (let E = 0; E < y.length; E++)
|
|
11230
11230
|
this.setFr(a, y[E]), this.instance.exports.setSignal(0, 0, o + E, a);
|
|
11231
11231
|
});
|
|
@@ -11292,7 +11292,7 @@ class gr {
|
|
|
11292
11292
|
}
|
|
11293
11293
|
}
|
|
11294
11294
|
}
|
|
11295
|
-
class
|
|
11295
|
+
class hr {
|
|
11296
11296
|
constructor(t, e) {
|
|
11297
11297
|
this.instance = t, this.version = this.instance.exports.getVersion(), this.n32 = this.instance.exports.getFieldNumLen32(), this.instance.exports.getRawPrime();
|
|
11298
11298
|
const n = new Array(this.n32);
|
|
@@ -11308,9 +11308,9 @@ class pr {
|
|
|
11308
11308
|
const n = Object.keys(t);
|
|
11309
11309
|
var a = 0;
|
|
11310
11310
|
if (n.forEach((s) => {
|
|
11311
|
-
const g =
|
|
11311
|
+
const g = zi(s), d = parseInt(g.slice(0, 8), 16), C = parseInt(g.slice(8, 16), 16), l = Ni(t[s]);
|
|
11312
11312
|
for (let o = 0; o < l.length; o++) {
|
|
11313
|
-
const y =
|
|
11313
|
+
const y = _r(l[o], this.n32);
|
|
11314
11314
|
for (let E = 0; E < this.n32; E++)
|
|
11315
11315
|
this.instance.exports.writeSharedRWMemory(E, y[this.n32 - 1 - E]);
|
|
11316
11316
|
try {
|
|
@@ -11354,35 +11354,35 @@ class pr {
|
|
|
11354
11354
|
return a;
|
|
11355
11355
|
}
|
|
11356
11356
|
}
|
|
11357
|
-
const { unstringifyBigInts:
|
|
11358
|
-
async function
|
|
11359
|
-
const a =
|
|
11357
|
+
const { unstringifyBigInts: Lr } = ln;
|
|
11358
|
+
async function mr(c, t, e, n) {
|
|
11359
|
+
const a = Lr(c), s = await ni(t), g = await s.read(s.totalSize);
|
|
11360
11360
|
await s.close();
|
|
11361
|
-
const d = await
|
|
11361
|
+
const d = await gr(g);
|
|
11362
11362
|
if (d.circom_version() == 1) {
|
|
11363
|
-
const C = await d.calculateBinWitness(a), l = await
|
|
11364
|
-
await
|
|
11363
|
+
const C = await d.calculateBinWitness(a), l = await uc(e, "wtns", 2, 2);
|
|
11364
|
+
await rr(l, C, d.prime), await l.close();
|
|
11365
11365
|
} else {
|
|
11366
|
-
const C = await
|
|
11366
|
+
const C = await ei(e), l = await d.calculateWTNSBin(a);
|
|
11367
11367
|
await C.write(l), await C.close();
|
|
11368
11368
|
}
|
|
11369
11369
|
}
|
|
11370
|
-
const { unstringifyBigInts:
|
|
11371
|
-
async function
|
|
11372
|
-
const a =
|
|
11370
|
+
const { unstringifyBigInts: br } = ln;
|
|
11371
|
+
async function yr(c, t, e, n) {
|
|
11372
|
+
const a = br(c), s = {
|
|
11373
11373
|
type: "mem"
|
|
11374
11374
|
};
|
|
11375
|
-
return await
|
|
11375
|
+
return await mr(a, t, s), await ur(e, s, n);
|
|
11376
11376
|
}
|
|
11377
|
-
const { unstringifyBigInts:
|
|
11377
|
+
const { unstringifyBigInts: Ma } = ln;
|
|
11378
11378
|
function pe(c) {
|
|
11379
11379
|
let t = c.toString(16);
|
|
11380
11380
|
for (; t.length < 64; )
|
|
11381
11381
|
t = "0" + t;
|
|
11382
11382
|
return t = `"0x${t}"`, t;
|
|
11383
11383
|
}
|
|
11384
|
-
async function
|
|
11385
|
-
const e =
|
|
11384
|
+
async function Cr(c, t) {
|
|
11385
|
+
const e = Ma(c), n = Ma(t);
|
|
11386
11386
|
let a = "";
|
|
11387
11387
|
for (let g = 0; g < n.length; g++)
|
|
11388
11388
|
a != "" && (a = a + ","), a = a + pe(n[g]);
|
|
@@ -11391,7 +11391,7 @@ async function yr(c, t) {
|
|
|
11391
11391
|
}
|
|
11392
11392
|
Yt.e("73eda753299d7d483339d80809a1d80553bda402fffe5bfeffffffff00000001", 16);
|
|
11393
11393
|
Yt.e("21888242871839275222246405745257275088548364400416034343698204186575808495617");
|
|
11394
|
-
var
|
|
11394
|
+
var Ar = {}, Ui = {};
|
|
11395
11395
|
(function(c) {
|
|
11396
11396
|
var t = /[|\\{}()[\]^$+*?.]/g, e = Object.prototype.hasOwnProperty, n = function(l, o) {
|
|
11397
11397
|
return e.apply(l, [o]);
|
|
@@ -11476,19 +11476,19 @@ function encode_char(c) {
|
|
|
11476
11476
|
return { __proto__: null };
|
|
11477
11477
|
};
|
|
11478
11478
|
}();
|
|
11479
|
-
})(
|
|
11480
|
-
const
|
|
11479
|
+
})(Ui);
|
|
11480
|
+
const Fr = "ejs", Er = "Embedded JavaScript templates", wr = [
|
|
11481
11481
|
"template",
|
|
11482
11482
|
"engine",
|
|
11483
11483
|
"ejs"
|
|
11484
|
-
],
|
|
11484
|
+
], Br = "3.1.9", vr = "Matthew Eernisse <mde@fleegix.org> (http://fleegix.org)", xr = "Apache-2.0", Sr = {
|
|
11485
11485
|
ejs: "./bin/cli.js"
|
|
11486
|
-
},
|
|
11486
|
+
}, Ir = "./lib/ejs.js", Or = "ejs.min.js", Pr = "ejs.min.js", kr = {
|
|
11487
11487
|
type: "git",
|
|
11488
11488
|
url: "git://github.com/mde/ejs.git"
|
|
11489
|
-
},
|
|
11489
|
+
}, Tr = "https://github.com/mde/ejs/issues", qr = "https://github.com/mde/ejs", Dr = {
|
|
11490
11490
|
jake: "^10.8.5"
|
|
11491
|
-
},
|
|
11491
|
+
}, Mr = {
|
|
11492
11492
|
browserify: "^16.5.1",
|
|
11493
11493
|
eslint: "^6.8.0",
|
|
11494
11494
|
"git-directory-deploy": "^1.5.1",
|
|
@@ -11496,28 +11496,28 @@ const Ar = "ejs", Fr = "Embedded JavaScript templates", Er = [
|
|
|
11496
11496
|
"lru-cache": "^4.0.1",
|
|
11497
11497
|
mocha: "^10.2.0",
|
|
11498
11498
|
"uglify-js": "^3.3.16"
|
|
11499
|
-
}, Mr = {
|
|
11500
|
-
node: ">=0.10.0"
|
|
11501
11499
|
}, Rr = {
|
|
11502
|
-
|
|
11500
|
+
node: ">=0.10.0"
|
|
11503
11501
|
}, Nr = {
|
|
11504
|
-
|
|
11505
|
-
|
|
11506
|
-
|
|
11507
|
-
|
|
11508
|
-
|
|
11509
|
-
|
|
11510
|
-
|
|
11511
|
-
|
|
11512
|
-
|
|
11513
|
-
|
|
11514
|
-
|
|
11515
|
-
|
|
11516
|
-
|
|
11517
|
-
|
|
11518
|
-
|
|
11519
|
-
|
|
11520
|
-
|
|
11502
|
+
test: "mocha -u tdd"
|
|
11503
|
+
}, zr = {
|
|
11504
|
+
name: Fr,
|
|
11505
|
+
description: Er,
|
|
11506
|
+
keywords: wr,
|
|
11507
|
+
version: Br,
|
|
11508
|
+
author: vr,
|
|
11509
|
+
license: xr,
|
|
11510
|
+
bin: Sr,
|
|
11511
|
+
main: Ir,
|
|
11512
|
+
jsdelivr: Or,
|
|
11513
|
+
unpkg: Pr,
|
|
11514
|
+
repository: kr,
|
|
11515
|
+
bugs: Tr,
|
|
11516
|
+
homepage: qr,
|
|
11517
|
+
dependencies: Dr,
|
|
11518
|
+
devDependencies: Mr,
|
|
11519
|
+
engines: Rr,
|
|
11520
|
+
scripts: Nr
|
|
11521
11521
|
};
|
|
11522
11522
|
(function(c) {
|
|
11523
11523
|
/**
|
|
@@ -11527,7 +11527,7 @@ const Ar = "ejs", Fr = "Embedded JavaScript templates", Er = [
|
|
|
11527
11527
|
* @project EJS
|
|
11528
11528
|
* @license {@link http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0}
|
|
11529
11529
|
*/
|
|
11530
|
-
var t =
|
|
11530
|
+
var t = vn, e = vn, n = Ui, a = !1, s = zr.version, g = "<", d = ">", C = "%", l = "locals", o = "ejs", y = "(<%%|%%>|<%=|<%-|<%_|<%#|<%|%>|-%>|_%>)", E = [
|
|
11531
11531
|
"delimiter",
|
|
11532
11532
|
"scope",
|
|
11533
11533
|
"context",
|
|
@@ -11823,9 +11823,9 @@ try {
|
|
|
11823
11823
|
`);
|
|
11824
11824
|
}
|
|
11825
11825
|
}, c.escapeXML = n.escapeXML, c.__express = c.renderFile, c.VERSION = s, c.name = o, typeof window < "u" && (window.ejs = c);
|
|
11826
|
-
})(
|
|
11827
|
-
var
|
|
11828
|
-
|
|
11826
|
+
})(Ar);
|
|
11827
|
+
var Yn = { exports: {} };
|
|
11828
|
+
Yn.exports;
|
|
11829
11829
|
(function(c) {
|
|
11830
11830
|
(function(t) {
|
|
11831
11831
|
var e, n, a, s, g, d, C, l, o, y, E, m, x, O, L, I, v;
|
|
@@ -12265,8 +12265,8 @@ Kn.exports;
|
|
|
12265
12265
|
c !== null && c.exports ? c.exports = k : t.check = k;
|
|
12266
12266
|
}
|
|
12267
12267
|
})(Ye);
|
|
12268
|
-
})(
|
|
12269
|
-
var
|
|
12268
|
+
})(Yn);
|
|
12269
|
+
var ta = Yn.exports, Ur = { exports: {} };
|
|
12270
12270
|
(function(c) {
|
|
12271
12271
|
c.exports = {
|
|
12272
12272
|
array: "arr",
|
|
@@ -12279,28 +12279,28 @@ var Yn = Kn.exports, zr = { exports: {} };
|
|
|
12279
12279
|
end: "end",
|
|
12280
12280
|
error: "err"
|
|
12281
12281
|
}, 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`;
|
|
12282
|
-
})(
|
|
12283
|
-
|
|
12284
|
-
const
|
|
12285
|
-
|
|
12286
|
-
var
|
|
12282
|
+
})(Ur);
|
|
12283
|
+
Ua.EventEmitter;
|
|
12284
|
+
const jr = zn, ji = vn.Readable, Ra = ta;
|
|
12285
|
+
jr.inherits(an, ji);
|
|
12286
|
+
var $i = an;
|
|
12287
12287
|
function an(c, t) {
|
|
12288
|
-
return
|
|
12288
|
+
return Ra.not.instanceStrict(this, an) ? new an(c) : (Ra.assert.function(c, "Invalid read implementation"), this._read = function() {
|
|
12289
12289
|
c();
|
|
12290
|
-
},
|
|
12290
|
+
}, ji.call(this, t));
|
|
12291
12291
|
}
|
|
12292
|
-
const
|
|
12293
|
-
|
|
12294
|
-
function
|
|
12295
|
-
return
|
|
12292
|
+
const $r = ta, Gi = $i, Gr = zn;
|
|
12293
|
+
Gr.inherits(Mn, Gi);
|
|
12294
|
+
function Mn(c, t) {
|
|
12295
|
+
return $r.not.instanceStrict(this, Mn) ? new Mn(c, t) : Gi.call(this, c, { ...t, objectMode: !0 });
|
|
12296
12296
|
}
|
|
12297
12297
|
class dn extends Array {
|
|
12298
12298
|
constructor(t) {
|
|
12299
12299
|
let e, n;
|
|
12300
|
-
if (!
|
|
12300
|
+
if (!Na(t))
|
|
12301
12301
|
throw new TypeError("Argument `size` must be a positive integer.");
|
|
12302
12302
|
return super(t), this.grow = (a) => {
|
|
12303
|
-
if (!
|
|
12303
|
+
if (!Na(a))
|
|
12304
12304
|
throw new TypeError("Argument `by` must be a positive integer.");
|
|
12305
12305
|
let s;
|
|
12306
12306
|
const g = t + a;
|
|
@@ -12314,25 +12314,25 @@ class dn extends Array {
|
|
|
12314
12314
|
t = g;
|
|
12315
12315
|
}, new Proxy(this, {
|
|
12316
12316
|
get(a, s) {
|
|
12317
|
-
return
|
|
12317
|
+
return Rn(s) ? a[za(s, t)] : a[s];
|
|
12318
12318
|
},
|
|
12319
12319
|
set(a, s, g) {
|
|
12320
|
-
return
|
|
12320
|
+
return Rn(s) ? (e = za(s, t), a[e] = g, Math.abs(s) >= t ? n = !0 : n = !1) : a[s] = g, !0;
|
|
12321
12321
|
}
|
|
12322
12322
|
});
|
|
12323
12323
|
}
|
|
12324
12324
|
}
|
|
12325
|
-
function
|
|
12326
|
-
return
|
|
12325
|
+
function Na(c) {
|
|
12326
|
+
return Rn(c) && c > 0;
|
|
12327
12327
|
}
|
|
12328
|
-
function
|
|
12328
|
+
function Rn(c) {
|
|
12329
12329
|
try {
|
|
12330
12330
|
return +c % 1 === 0;
|
|
12331
12331
|
} catch {
|
|
12332
12332
|
}
|
|
12333
12333
|
return !1;
|
|
12334
12334
|
}
|
|
12335
|
-
function
|
|
12335
|
+
function za(c, t) {
|
|
12336
12336
|
return c === 0 ? 0 : c < 0 ? (t - Math.abs(c)) % t : c % t;
|
|
12337
12337
|
}
|
|
12338
12338
|
function fn() {
|
|
@@ -12345,7 +12345,7 @@ dn.prototype.unshift = fn;
|
|
|
12345
12345
|
function Ke(c) {
|
|
12346
12346
|
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.');
|
|
12347
12347
|
}
|
|
12348
|
-
var
|
|
12348
|
+
var Zr = { exports: {} };
|
|
12349
12349
|
/*! jsonpath 1.1.1 */
|
|
12350
12350
|
(function(c, t) {
|
|
12351
12351
|
(function(e) {
|
|
@@ -13515,7 +13515,7 @@ var Gr = { exports: {} };
|
|
|
13515
13515
|
O && S.octal && Dt(S, y.StrictOctalLiteral), N = w.createLiteral(pt());
|
|
13516
13516
|
else if (p === g.Keyword) {
|
|
13517
13517
|
if (Y("function"))
|
|
13518
|
-
return
|
|
13518
|
+
return so();
|
|
13519
13519
|
Y("this") ? (pt(), N = w.createThisExpression()) : Zt(pt());
|
|
13520
13520
|
} else
|
|
13521
13521
|
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());
|
|
@@ -13700,65 +13700,65 @@ var Gr = { exports: {} };
|
|
|
13700
13700
|
var p, B, N;
|
|
13701
13701
|
return Wt("if"), vt("("), p = qt(), vt(")"), B = fe(), Y("else") ? (pt(), N = fe()) : N = null, w.createIfStatement(p, B, N);
|
|
13702
13702
|
}
|
|
13703
|
-
function
|
|
13703
|
+
function Xi() {
|
|
13704
13704
|
var p, B, N;
|
|
13705
13705
|
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);
|
|
13706
13706
|
}
|
|
13707
|
-
function
|
|
13707
|
+
function Vi() {
|
|
13708
13708
|
var p, B, N;
|
|
13709
13709
|
return Wt("while"), vt("("), p = qt(), vt(")"), N = F.inIteration, F.inIteration = !0, B = fe(), F.inIteration = N, w.createWhileStatement(p, B);
|
|
13710
13710
|
}
|
|
13711
|
-
function
|
|
13711
|
+
function Hi() {
|
|
13712
13712
|
var p, B, N;
|
|
13713
13713
|
return N = S, p = pt(), B = ye(), w.markEnd(w.createVariableDeclaration(B, p.value), N);
|
|
13714
13714
|
}
|
|
13715
|
-
function
|
|
13715
|
+
function Qi() {
|
|
13716
13716
|
var p, B, N, X, lt, Ct, Gt;
|
|
13717
|
-
return p = B = N = null, Wt("for"), vt("("), wt(";") ? pt() : (Y("var") || Y("let") ? (F.allowIn = !1, p =
|
|
13717
|
+
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);
|
|
13718
13718
|
}
|
|
13719
|
-
function
|
|
13719
|
+
function Ji() {
|
|
13720
13720
|
var p = null, B;
|
|
13721
13721
|
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));
|
|
13722
13722
|
}
|
|
13723
|
-
function
|
|
13723
|
+
function Ki() {
|
|
13724
13724
|
var p = null, B;
|
|
13725
13725
|
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));
|
|
13726
13726
|
}
|
|
13727
|
-
function
|
|
13727
|
+
function Yi() {
|
|
13728
13728
|
var p = null;
|
|
13729
13729
|
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));
|
|
13730
13730
|
}
|
|
13731
|
-
function
|
|
13731
|
+
function to() {
|
|
13732
13732
|
var p, B;
|
|
13733
13733
|
return O && (G(), Dt({}, y.StrictModeWith)), Wt("with"), vt("("), p = qt(), vt(")"), B = fe(), w.createWithStatement(p, B);
|
|
13734
13734
|
}
|
|
13735
|
-
function
|
|
13735
|
+
function eo() {
|
|
13736
13736
|
var p, B = [], N, X;
|
|
13737
13737
|
for (X = S, Y("default") ? (pt(), p = null) : (Wt("case"), p = qt()), vt(":"); L < U && !(wt("}") || Y("default") || Y("case")); )
|
|
13738
13738
|
N = fe(), B.push(N);
|
|
13739
13739
|
return w.markEnd(w.createSwitchCase(p, B), X);
|
|
13740
13740
|
}
|
|
13741
|
-
function
|
|
13741
|
+
function no() {
|
|
13742
13742
|
var p, B, N, X, lt;
|
|
13743
13743
|
if (Wt("switch"), vt("("), p = qt(), vt(")"), vt("{"), B = [], wt("}"))
|
|
13744
13744
|
return pt(), w.createSwitchStatement(p, B);
|
|
13745
13745
|
for (X = F.inSwitch, F.inSwitch = !0, lt = !1; L < U && !wt("}"); )
|
|
13746
|
-
N =
|
|
13746
|
+
N = eo(), N.test === null && (lt && Pt({}, y.MultipleDefaultsInSwitch), lt = !0), B.push(N);
|
|
13747
13747
|
return F.inSwitch = X, vt("}"), w.createSwitchStatement(p, B);
|
|
13748
13748
|
}
|
|
13749
|
-
function
|
|
13749
|
+
function ao() {
|
|
13750
13750
|
var p;
|
|
13751
13751
|
return Wt("throw"), te() && Pt({}, y.NewlineAfterThrow), p = qt(), _(), w.createThrowStatement(p);
|
|
13752
13752
|
}
|
|
13753
|
-
function
|
|
13753
|
+
function io() {
|
|
13754
13754
|
var p, B, N;
|
|
13755
13755
|
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);
|
|
13756
13756
|
}
|
|
13757
|
-
function
|
|
13757
|
+
function oo() {
|
|
13758
13758
|
var p, B = [], N = null;
|
|
13759
|
-
return Wt("try"), p = Qt(), Y("catch") && B.push(
|
|
13759
|
+
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);
|
|
13760
13760
|
}
|
|
13761
|
-
function
|
|
13761
|
+
function co() {
|
|
13762
13762
|
return Wt("debugger"), _(), w.createDebuggerStatement();
|
|
13763
13763
|
}
|
|
13764
13764
|
function fe() {
|
|
@@ -13775,33 +13775,33 @@ var Gr = { exports: {} };
|
|
|
13775
13775
|
if (p === g.Keyword)
|
|
13776
13776
|
switch (S.value) {
|
|
13777
13777
|
case "break":
|
|
13778
|
-
return w.markEnd(
|
|
13778
|
+
return w.markEnd(Ki(), lt);
|
|
13779
13779
|
case "continue":
|
|
13780
|
-
return w.markEnd(
|
|
13780
|
+
return w.markEnd(Ji(), lt);
|
|
13781
13781
|
case "debugger":
|
|
13782
|
-
return w.markEnd(
|
|
13782
|
+
return w.markEnd(co(), lt);
|
|
13783
13783
|
case "do":
|
|
13784
|
-
return w.markEnd(
|
|
13784
|
+
return w.markEnd(Xi(), lt);
|
|
13785
13785
|
case "for":
|
|
13786
|
-
return w.markEnd(
|
|
13786
|
+
return w.markEnd(Qi(), lt);
|
|
13787
13787
|
case "function":
|
|
13788
|
-
return w.markEnd(
|
|
13788
|
+
return w.markEnd(aa(), lt);
|
|
13789
13789
|
case "if":
|
|
13790
13790
|
return w.markEnd(He(), lt);
|
|
13791
13791
|
case "return":
|
|
13792
|
-
return w.markEnd(
|
|
13792
|
+
return w.markEnd(Yi(), lt);
|
|
13793
13793
|
case "switch":
|
|
13794
|
-
return w.markEnd(eo(), lt);
|
|
13795
|
-
case "throw":
|
|
13796
13794
|
return w.markEnd(no(), lt);
|
|
13795
|
+
case "throw":
|
|
13796
|
+
return w.markEnd(ao(), lt);
|
|
13797
13797
|
case "try":
|
|
13798
|
-
return w.markEnd(
|
|
13798
|
+
return w.markEnd(oo(), lt);
|
|
13799
13799
|
case "var":
|
|
13800
13800
|
return w.markEnd(ke(), lt);
|
|
13801
13801
|
case "while":
|
|
13802
|
-
return w.markEnd(
|
|
13802
|
+
return w.markEnd(Vi(), lt);
|
|
13803
13803
|
case "with":
|
|
13804
|
-
return w.markEnd(
|
|
13804
|
+
return w.markEnd(to(), lt);
|
|
13805
13805
|
}
|
|
13806
13806
|
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));
|
|
13807
13807
|
}
|
|
@@ -13813,7 +13813,7 @@ var Gr = { exports: {} };
|
|
|
13813
13813
|
B.push(p);
|
|
13814
13814
|
return vt("}"), F.labelSet = Ct, F.inIteration = Gt, F.inSwitch = Xt, F.inFunctionBody = ie, w.markEnd(w.createBlockStatement(B), ae);
|
|
13815
13815
|
}
|
|
13816
|
-
function
|
|
13816
|
+
function na(p) {
|
|
13817
13817
|
var B, N = [], X, lt, Ct, Gt, Xt;
|
|
13818
13818
|
if (vt("("), !wt(")"))
|
|
13819
13819
|
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(")")); )
|
|
@@ -13825,13 +13825,13 @@ var Gr = { exports: {} };
|
|
|
13825
13825
|
message: Xt
|
|
13826
13826
|
};
|
|
13827
13827
|
}
|
|
13828
|
-
function
|
|
13828
|
+
function aa() {
|
|
13829
13829
|
var p, B = [], N, X, lt, Ct, Gt, Xt, ie, ae;
|
|
13830
|
-
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 =
|
|
13830
|
+
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);
|
|
13831
13831
|
}
|
|
13832
|
-
function
|
|
13832
|
+
function so() {
|
|
13833
13833
|
var p, B = null, N, X, lt, Ct, Gt = [], Xt, ie, ae;
|
|
13834
|
-
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 =
|
|
13834
|
+
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);
|
|
13835
13835
|
}
|
|
13836
13836
|
function Te() {
|
|
13837
13837
|
if (S.type === g.Keyword)
|
|
@@ -13840,25 +13840,25 @@ var Gr = { exports: {} };
|
|
|
13840
13840
|
case "let":
|
|
13841
13841
|
return _n(S.value);
|
|
13842
13842
|
case "function":
|
|
13843
|
-
return
|
|
13843
|
+
return aa();
|
|
13844
13844
|
default:
|
|
13845
13845
|
return fe();
|
|
13846
13846
|
}
|
|
13847
13847
|
if (S.type !== g.EOF)
|
|
13848
13848
|
return fe();
|
|
13849
13849
|
}
|
|
13850
|
-
function
|
|
13850
|
+
function ro() {
|
|
13851
13851
|
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))); )
|
|
13852
13852
|
X = x.slice(N.start + 1, N.end - 1), X === "use strict" ? (O = !0, lt && Dt(lt, y.StrictOctalLiteral)) : !lt && N.octal && (lt = N);
|
|
13853
13853
|
for (; L < U && (p = Te(), !(typeof p > "u")); )
|
|
13854
13854
|
B.push(p);
|
|
13855
13855
|
return B;
|
|
13856
13856
|
}
|
|
13857
|
-
function
|
|
13857
|
+
function lo() {
|
|
13858
13858
|
var p, B;
|
|
13859
|
-
return G(), $t(), B = S, O = !1, p =
|
|
13859
|
+
return G(), $t(), B = S, O = !1, p = ro(), w.markEnd(w.createProgram(p), B);
|
|
13860
13860
|
}
|
|
13861
|
-
function
|
|
13861
|
+
function ia() {
|
|
13862
13862
|
var p, B, N, X = [];
|
|
13863
13863
|
for (p = 0; p < r.tokens.length; ++p)
|
|
13864
13864
|
B = r.tokens[p], N = {
|
|
@@ -13867,7 +13867,7 @@ var Gr = { exports: {} };
|
|
|
13867
13867
|
}, r.range && (N.range = B.range), r.loc && (N.loc = B.loc), X.push(N);
|
|
13868
13868
|
r.tokens = X;
|
|
13869
13869
|
}
|
|
13870
|
-
function
|
|
13870
|
+
function uo(p, B) {
|
|
13871
13871
|
var N, X, lt;
|
|
13872
13872
|
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 = {
|
|
13873
13873
|
allowIn: !0,
|
|
@@ -13890,7 +13890,7 @@ var Gr = { exports: {} };
|
|
|
13890
13890
|
} else
|
|
13891
13891
|
throw Ct;
|
|
13892
13892
|
}
|
|
13893
|
-
|
|
13893
|
+
ia(), lt = r.tokens, typeof r.comments < "u" && (lt.comments = r.comments), typeof r.errors < "u" && (lt.errors = r.errors);
|
|
13894
13894
|
} catch (Ct) {
|
|
13895
13895
|
throw Ct;
|
|
13896
13896
|
} finally {
|
|
@@ -13898,7 +13898,7 @@ var Gr = { exports: {} };
|
|
|
13898
13898
|
}
|
|
13899
13899
|
return lt;
|
|
13900
13900
|
}
|
|
13901
|
-
function
|
|
13901
|
+
function fo(p, B) {
|
|
13902
13902
|
var N, X;
|
|
13903
13903
|
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 = {
|
|
13904
13904
|
allowIn: !0,
|
|
@@ -13909,7 +13909,7 @@ var Gr = { exports: {} };
|
|
|
13909
13909
|
lastCommentStart: -1
|
|
13910
13910
|
}, 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 = []));
|
|
13911
13911
|
try {
|
|
13912
|
-
N =
|
|
13912
|
+
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);
|
|
13913
13913
|
} catch (lt) {
|
|
13914
13914
|
throw lt;
|
|
13915
13915
|
} finally {
|
|
@@ -13917,7 +13917,7 @@ var Gr = { exports: {} };
|
|
|
13917
13917
|
}
|
|
13918
13918
|
return N;
|
|
13919
13919
|
}
|
|
13920
|
-
s.version = "1.2.2", s.tokenize =
|
|
13920
|
+
s.version = "1.2.2", s.tokenize = uo, s.parse = fo, s.Syntax = function() {
|
|
13921
13921
|
var p, B = {};
|
|
13922
13922
|
typeof Object.create == "function" && (B = /* @__PURE__ */ Object.create(null));
|
|
13923
13923
|
for (p in l)
|
|
@@ -15513,15 +15513,15 @@ Expecting ` + ft.join(", ") + ", got '" + (this.terminals_[T] || T) + "'" : at =
|
|
|
15513
15513
|
n.exports = e("./lib/index");
|
|
15514
15514
|
}, { "./lib/index": 5 }] }, {}, ["jsonpath"])("jsonpath");
|
|
15515
15515
|
});
|
|
15516
|
-
})(
|
|
15517
|
-
|
|
15518
|
-
const
|
|
15519
|
-
|
|
15520
|
-
function
|
|
15521
|
-
return
|
|
15522
|
-
}
|
|
15523
|
-
var
|
|
15524
|
-
|
|
15516
|
+
})(Zr);
|
|
15517
|
+
Ua.EventEmitter;
|
|
15518
|
+
const Wr = ta, Zi = $i, Xr = zn;
|
|
15519
|
+
Xr.inherits(Nn, Zi);
|
|
15520
|
+
function Nn(c, t) {
|
|
15521
|
+
return Wr.not.instanceStrict(this, Nn) ? new Nn(c, t) : Zi.call(this, c, { ...t, encoding: "utf8" });
|
|
15522
|
+
}
|
|
15523
|
+
var ea = { exports: {} };
|
|
15524
|
+
ea.exports;
|
|
15525
15525
|
(function(c) {
|
|
15526
15526
|
(function(t) {
|
|
15527
15527
|
c !== null ? c.exports = e : t.tryer = e;
|
|
@@ -15598,30 +15598,35 @@ ta.exports;
|
|
|
15598
15598
|
setTimeout(I, Math.abs(v));
|
|
15599
15599
|
}
|
|
15600
15600
|
})(Ye);
|
|
15601
|
-
})(
|
|
15602
|
-
|
|
15603
|
-
typeof process < "u" && process.versions != null && process.versions.node != null
|
|
15604
|
-
const Xr = (
|
|
15601
|
+
})(ea);
|
|
15602
|
+
ea.exports;
|
|
15603
|
+
const Vr = typeof process < "u" && process.versions != null && process.versions.node != null, Bn = (
|
|
15605
15604
|
// @ts-expect-error webpack check is done like this
|
|
15606
15605
|
typeof __webpack_require__ < "u"
|
|
15607
|
-
),
|
|
15608
|
-
|
|
15609
|
-
|
|
15610
|
-
|
|
15611
|
-
|
|
15612
|
-
|
|
15613
|
-
|
|
15614
|
-
|
|
15606
|
+
), Wi = new _o(), Hr = async (c) => {
|
|
15607
|
+
const { input: t, wasmFilePath: e, zKeyFilePath: n, chainId: a } = c.payload.data, {
|
|
15608
|
+
hostLocation: { origin: s },
|
|
15609
|
+
constants: {
|
|
15610
|
+
isDevelopment: g,
|
|
15611
|
+
chains: { chainIds: d }
|
|
15612
|
+
}
|
|
15613
|
+
} = c.metadata;
|
|
15614
|
+
let C = e, l = n;
|
|
15615
|
+
if (console.log({ isWebpack: Bn }), Vr) {
|
|
15616
|
+
g && !Bn ? (C = `test/circuits/${e}`, l = `test/circuits/${n}`) : Bn && (C = `libs/hardhat/test/circuits/${e}`, l = `libs/hardhat/test/circuits/${n}`);
|
|
15617
|
+
const o = require("path");
|
|
15618
|
+
C = o.resolve(C), l = o.resolve(l);
|
|
15619
|
+
} else
|
|
15620
|
+
a === d.localhost && (C = `${s}/${e}`, l = `${s}/${n}`);
|
|
15615
15621
|
try {
|
|
15616
|
-
|
|
15617
|
-
|
|
15618
|
-
|
|
15619
|
-
|
|
15620
|
-
console.log(d);
|
|
15622
|
+
const { proof: o, publicSignals: y } = await yr(t, C, l), E = await Cr(o, y), m = JSON.parse(`[${E}]`);
|
|
15623
|
+
Wi.postMessageToMainThread({ zkCallData: m, proof: o, publicSignals: y });
|
|
15624
|
+
} catch (o) {
|
|
15625
|
+
console.log(o);
|
|
15621
15626
|
}
|
|
15622
15627
|
};
|
|
15623
|
-
|
|
15628
|
+
Wi.attachWorkerSideOnMessage(Hr);
|
|
15624
15629
|
export {
|
|
15625
|
-
|
|
15626
|
-
|
|
15630
|
+
Wi as default,
|
|
15631
|
+
Hr as onWorkerMessage
|
|
15627
15632
|
};
|