@sabaaa1/common 0.0.44 → 0.0.45
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/{snarkjsWorkerLogic-B9NbAQYW.js → snarkjsWorkerLauncher-Cw1M6jKV.js} +535 -536
- package/assets/{utxoWorkerLogic-DEqWaadT.js → utxoWorkerLauncher-DU_Rrw_I.js} +16801 -15613
- package/assets/{zkProofWorkerLogic-DB9cbXu-.js → zkProofWorkerLauncher-BEDgIMB_.js} +16094 -14906
- package/data-structures/Hinkal/Hinkal.cjs +1 -1
- package/data-structures/Hinkal/Hinkal.mjs +5 -2
- package/data-structures/IndexedDB/activity-db.cjs +1 -1
- package/data-structures/IndexedDB/activity-db.mjs +25 -22
- package/data-structures/IndexedDB/contact-db.cjs +1 -1
- package/data-structures/IndexedDB/contact-db.mjs +24 -21
- package/data-structures/TokenDBs/EventsPublicTokensDB.cjs +1 -1
- package/data-structures/TokenDBs/EventsPublicTokensDB.mjs +16 -13
- package/functions/web3/functionCalls/transactCallRelayer.cjs +1 -1
- package/functions/web3/functionCalls/transactCallRelayer.mjs +5 -2
- package/package.json +1 -1
- package/providers/EthersProviderAdapter.cjs +1 -1
- package/providers/EthersProviderAdapter.mjs +19 -16
- package/providers/prepareEthersHinkal.cjs +1 -1
- package/providers/prepareEthersHinkal.mjs +5 -2
- package/providers/prepareWagmiHinkal.cjs +1 -1
- package/providers/prepareWagmiHinkal.mjs +5 -2
- package/webworker/snarkjsWorker/snarkjsWorkerLauncher.cjs +1 -1
- package/webworker/snarkjsWorker/snarkjsWorkerLauncher.mjs +1 -1
- package/webworker/utxoWorker/utxoWorkerLauncher.cjs +1 -1
- package/webworker/utxoWorker/utxoWorkerLauncher.mjs +2 -2
- package/webworker/workerFactory.cjs +1 -1
- package/webworker/workerFactory.mjs +26 -27
- package/webworker/zkProofWorker/zkProofWorkerLauncher.cjs +1 -1
- package/webworker/zkProofWorker/zkProofWorkerLauncher.mjs +1 -1
- package/assets/snarkjsWorkerLauncher-Dsmwcy9L.js +0 -1176
- package/assets/utxoWorkerLauncher-BUSzpnDL.js +0 -1205
- package/assets/zkProofWorkerLauncher-CoKmCKjC.js +0 -1205
|
@@ -60,12 +60,12 @@ function qi(o, t, n = !1) {
|
|
|
60
60
|
throw new Error(e);
|
|
61
61
|
}
|
|
62
62
|
var uo = /* @__PURE__ */ ((o) => (o.DEVELOPMENT = "development", o.PLAYGROUND = "playground", o.PRODUCTION = "production", o.STAGING = "staging", o))(uo || {});
|
|
63
|
-
const
|
|
63
|
+
const Ee = {
|
|
64
64
|
development: ["localhost", "192.", "127."],
|
|
65
65
|
playground: ["playground"],
|
|
66
66
|
staging: ["working", "staging"]
|
|
67
|
-
}, So = typeof process < "u" && process?.release?.name === "node",
|
|
68
|
-
function
|
|
67
|
+
}, So = typeof process < "u" && process?.release?.name === "node", Fe = typeof process < "u" && process.versions != null && process.versions.node != null, Oo = typeof __webpack_require__ < "u";
|
|
68
|
+
function xe(o, t) {
|
|
69
69
|
return t.some((n) => o.includes(n));
|
|
70
70
|
}
|
|
71
71
|
const oc = () => (require("dotenv").config({
|
|
@@ -81,17 +81,17 @@ const oc = () => (require("dotenv").config({
|
|
|
81
81
|
return t || "staging";
|
|
82
82
|
}
|
|
83
83
|
const o = window?.location?.host;
|
|
84
|
-
return
|
|
84
|
+
return xe(o, Ee.development) ? "development" : xe(o, Ee.playground) ? "playground" : xe(o, Ee.staging) ? "staging" : "production";
|
|
85
85
|
};
|
|
86
86
|
ic();
|
|
87
87
|
const ac = [0, 1, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4];
|
|
88
|
-
function
|
|
88
|
+
function Ae(o, t) {
|
|
89
89
|
if (!t || t == 10)
|
|
90
90
|
return BigInt(o);
|
|
91
91
|
if (t == 16)
|
|
92
92
|
return o.slice(0, 2) == "0x" ? BigInt(o) : BigInt("0x" + o);
|
|
93
93
|
}
|
|
94
|
-
const Tt =
|
|
94
|
+
const Tt = Ae;
|
|
95
95
|
function cc(o, t) {
|
|
96
96
|
let n = BigInt(0);
|
|
97
97
|
t = BigInt(t);
|
|
@@ -103,19 +103,19 @@ function Wn(o) {
|
|
|
103
103
|
const t = o.toString(16);
|
|
104
104
|
return (t.length - 1) * 4 + ac[parseInt(t[0], 16)];
|
|
105
105
|
}
|
|
106
|
-
function
|
|
106
|
+
function Mi(o) {
|
|
107
107
|
return BigInt(o) < BigInt(0);
|
|
108
108
|
}
|
|
109
|
-
function
|
|
109
|
+
function Qi(o) {
|
|
110
110
|
return !o;
|
|
111
111
|
}
|
|
112
112
|
function ge(o, t) {
|
|
113
113
|
return BigInt(o) << BigInt(t);
|
|
114
114
|
}
|
|
115
|
-
function
|
|
115
|
+
function Mn(o, t) {
|
|
116
116
|
return BigInt(o) >> BigInt(t);
|
|
117
117
|
}
|
|
118
|
-
const sc = ge, lc =
|
|
118
|
+
const sc = ge, lc = Mn;
|
|
119
119
|
function _o(o) {
|
|
120
120
|
return (BigInt(o) & BigInt(1)) == BigInt(1);
|
|
121
121
|
}
|
|
@@ -175,7 +175,7 @@ function _c(o, t) {
|
|
|
175
175
|
function gc(o) {
|
|
176
176
|
return BigInt(o) >= 0 ? BigInt(o) : -BigInt(o);
|
|
177
177
|
}
|
|
178
|
-
function
|
|
178
|
+
function Qn(o, t) {
|
|
179
179
|
return BigInt(o) / BigInt(t);
|
|
180
180
|
}
|
|
181
181
|
function an(o, t) {
|
|
@@ -190,7 +190,7 @@ function fc(o, t) {
|
|
|
190
190
|
function hc(o, t) {
|
|
191
191
|
return BigInt(o) < BigInt(t);
|
|
192
192
|
}
|
|
193
|
-
function
|
|
193
|
+
function Ve(o, t) {
|
|
194
194
|
return BigInt(o) > BigInt(t);
|
|
195
195
|
}
|
|
196
196
|
function pc(o, t) {
|
|
@@ -224,7 +224,7 @@ function Yn(o, t, n, e) {
|
|
|
224
224
|
for (let r = d; r < s.length; r++)
|
|
225
225
|
s[r] = 0;
|
|
226
226
|
for (let r = s.length * 4; r < e; r++)
|
|
227
|
-
o[r] = zi(fo(
|
|
227
|
+
o[r] = zi(fo(Mn(n, r * 8), 255));
|
|
228
228
|
}
|
|
229
229
|
function ki(o, t, n, e) {
|
|
230
230
|
const i = "0000000" + n.toString(16), s = new DataView(o.buffer, o.byteOffset + t, e), d = ((i.length - 7) * 4 - 1 >> 5) + 1;
|
|
@@ -236,14 +236,14 @@ function ki(o, t, n, e) {
|
|
|
236
236
|
function Zn(o, t, n) {
|
|
237
237
|
n = n || o.byteLength, t = t || 0;
|
|
238
238
|
const e = new Uint32Array(o.buffer, o.byteOffset + t, n / 4), i = new Array(n / 4);
|
|
239
|
-
return e.forEach((s, d) => i[i.length - d - 1] = s.toString(16).padStart(8, "0")),
|
|
239
|
+
return e.forEach((s, d) => i[i.length - d - 1] = s.toString(16).padStart(8, "0")), Ae(i.join(""), 16);
|
|
240
240
|
}
|
|
241
241
|
function Ni(o, t, n) {
|
|
242
242
|
n = n || o.byteLength, t = t || 0;
|
|
243
243
|
const e = new DataView(o.buffer, o.byteOffset + t, n), i = new Array(n / 4);
|
|
244
244
|
for (let s = 0; s < n / 4; s++)
|
|
245
245
|
i[s] = e.getUint32(s * 4, !1).toString(16).padStart(8, "0");
|
|
246
|
-
return
|
|
246
|
+
return Ae(i.join(""), 16);
|
|
247
247
|
}
|
|
248
248
|
function Gi(o, t) {
|
|
249
249
|
return o.toString(t);
|
|
@@ -262,19 +262,19 @@ var Cc = /* @__PURE__ */ Object.freeze({
|
|
|
262
262
|
bits: Ui,
|
|
263
263
|
bor: Lc,
|
|
264
264
|
bxor: Ac,
|
|
265
|
-
div:
|
|
265
|
+
div: Qn,
|
|
266
266
|
e: Tt,
|
|
267
267
|
eq: En,
|
|
268
268
|
exp: _c,
|
|
269
269
|
fromArray: cc,
|
|
270
270
|
fromRprBE: Ni,
|
|
271
271
|
fromRprLE: Zn,
|
|
272
|
-
fromString:
|
|
272
|
+
fromString: Ae,
|
|
273
273
|
geq: Di,
|
|
274
|
-
gt:
|
|
275
|
-
isNegative:
|
|
274
|
+
gt: Ve,
|
|
275
|
+
isNegative: Mi,
|
|
276
276
|
isOdd: _o,
|
|
277
|
-
isZero:
|
|
277
|
+
isZero: Qi,
|
|
278
278
|
land: bc,
|
|
279
279
|
leq: pc,
|
|
280
280
|
lnot: Ic,
|
|
@@ -288,7 +288,7 @@ var Cc = /* @__PURE__ */ Object.freeze({
|
|
|
288
288
|
one: Fn,
|
|
289
289
|
pow: Xn,
|
|
290
290
|
shiftLeft: ge,
|
|
291
|
-
shiftRight:
|
|
291
|
+
shiftRight: Mn,
|
|
292
292
|
shl: sc,
|
|
293
293
|
shr: lc,
|
|
294
294
|
square: uc,
|
|
@@ -302,7 +302,7 @@ var Cc = /* @__PURE__ */ Object.freeze({
|
|
|
302
302
|
zero: Ki
|
|
303
303
|
});
|
|
304
304
|
function vo(o, t, n) {
|
|
305
|
-
if (
|
|
305
|
+
if (Qi(n))
|
|
306
306
|
return o.one;
|
|
307
307
|
const e = Ui(n);
|
|
308
308
|
if (e.length == 0)
|
|
@@ -335,13 +335,13 @@ function mc(o) {
|
|
|
335
335
|
}
|
|
336
336
|
function wc(o) {
|
|
337
337
|
for (o.sqrt_q = Xn(o.p, o.m), o.sqrt_s = 0, o.sqrt_t = _n(o.sqrt_q, 1); !_o(o.sqrt_t); )
|
|
338
|
-
o.sqrt_s = o.sqrt_s + 1, o.sqrt_t =
|
|
338
|
+
o.sqrt_s = o.sqrt_s + 1, o.sqrt_t = Qn(o.sqrt_t, 2);
|
|
339
339
|
let t = o.one;
|
|
340
340
|
for (; o.eq(t, o.one); ) {
|
|
341
341
|
const n = o.random();
|
|
342
342
|
o.sqrt_z = o.pow(n, o.sqrt_t), t = o.pow(o.sqrt_z, 2 ** (o.sqrt_s - 1));
|
|
343
343
|
}
|
|
344
|
-
o.sqrt_tm1d2 =
|
|
344
|
+
o.sqrt_tm1d2 = Qn(_n(o.sqrt_t, 1), 2), o.sqrt = function(n) {
|
|
345
345
|
const e = this;
|
|
346
346
|
if (e.isZero(n))
|
|
347
347
|
return e.zero;
|
|
@@ -373,7 +373,7 @@ function Ec(o) {
|
|
|
373
373
|
};
|
|
374
374
|
}
|
|
375
375
|
function Fc(o) {
|
|
376
|
-
o.sqrt_q = Xn(o.p, o.m), o.sqrt_e1 =
|
|
376
|
+
o.sqrt_q = Xn(o.p, o.m), o.sqrt_e1 = Qn(_n(o.sqrt_q, 3), 4), o.sqrt = function(t) {
|
|
377
377
|
if (this.isZero(t))
|
|
378
378
|
return this.zero;
|
|
379
379
|
const n = this.pow(t, this.sqrt_e1), e = this.mul(this.square(n), t);
|
|
@@ -389,7 +389,7 @@ function xc(o) {
|
|
|
389
389
|
};
|
|
390
390
|
}
|
|
391
391
|
function Sc(o) {
|
|
392
|
-
o.sqrt_q = Xn(o.p, o.m / 2), o.sqrt_e34 =
|
|
392
|
+
o.sqrt_q = Xn(o.p, o.m / 2), o.sqrt_e34 = Qn(_n(o.sqrt_q, 3), 4), o.sqrt_e12 = Qn(_n(o.sqrt_q, 1), 2), o.frobenius = function(t, n) {
|
|
393
393
|
return t % 2 == 1 ? o.conjugate(n) : n;
|
|
394
394
|
}, o.sqrt = function(t) {
|
|
395
395
|
const n = this, e = n.pow(t, n.sqrt_e34), i = n.mul(n.square(e), t), s = n.mul(n.frobenius(1, i), i);
|
|
@@ -476,7 +476,7 @@ let se = null;
|
|
|
476
476
|
function ho() {
|
|
477
477
|
return se || (se = new Pc(qc()), se);
|
|
478
478
|
}
|
|
479
|
-
class
|
|
479
|
+
class Mc {
|
|
480
480
|
constructor(t, n, e) {
|
|
481
481
|
this.F = n, this.G = t, this.opMulGF = e;
|
|
482
482
|
let i = n.sqrt_t || n.t, s = n.sqrt_s || n.s, d = n.one;
|
|
@@ -538,7 +538,7 @@ function fe(o, t, n, e, i) {
|
|
|
538
538
|
u[l] = o.G.add(r[l], o.opMulGF(b[l], o.roots[n][l])), u[l + d] = o.G.sub(r[l], o.opMulGF(b[l], o.roots[n][l]));
|
|
539
539
|
return u;
|
|
540
540
|
}
|
|
541
|
-
class
|
|
541
|
+
class Qc {
|
|
542
542
|
constructor(t) {
|
|
543
543
|
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 = Wn(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);
|
|
544
544
|
const n = this.negone >> this.one;
|
|
@@ -548,7 +548,7 @@ class Mc {
|
|
|
548
548
|
this.nqr = this.nqr + this.one, e = this.pow(this.nqr, n);
|
|
549
549
|
for (this.s = 0, this.t = this.negone; (this.t & this.one) == this.zero; )
|
|
550
550
|
this.s = this.s + 1, this.t = this.t >> this.one;
|
|
551
|
-
this.nqr_to_t = this.pow(this.nqr, this.t), mc(this), this.FFT = new
|
|
551
|
+
this.nqr_to_t = this.pow(this.nqr, this.t), mc(this), this.FFT = new Mc(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);
|
|
552
552
|
}
|
|
553
553
|
e(t, n) {
|
|
554
554
|
let e;
|
|
@@ -970,7 +970,7 @@ var Uc = function(t, n, e) {
|
|
|
970
970
|
let D, it;
|
|
971
971
|
return L[y] ? D = f.getLocal("x" + y) : (D = f.teeLocal("x" + y, f.i64_load32_u(f.getLocal("x"), y * 4)), L[y] = !0), V[v] ? it = f.getLocal("y" + v) : (it = f.teeLocal("y" + v, f.i64_load32_u(f.getLocal("y"), v * 4)), V[v] = !0), f.i64_mul(D, it);
|
|
972
972
|
}
|
|
973
|
-
let X = "c0",
|
|
973
|
+
let X = "c0", M = "c1";
|
|
974
974
|
for (let y = 0; y < s * 2 - 1; y++) {
|
|
975
975
|
for (let v = Math.max(0, y - s + 1); v <= y && v < s; v++) {
|
|
976
976
|
const D = y - v;
|
|
@@ -987,9 +987,9 @@ var Uc = function(t, n, e) {
|
|
|
987
987
|
)
|
|
988
988
|
), F.addCode(
|
|
989
989
|
f.setLocal(
|
|
990
|
-
|
|
990
|
+
M,
|
|
991
991
|
f.i64_add(
|
|
992
|
-
f.getLocal(
|
|
992
|
+
f.getLocal(M),
|
|
993
993
|
f.i64_shr_u(
|
|
994
994
|
f.getLocal(X),
|
|
995
995
|
f.i64_const(32)
|
|
@@ -1004,9 +1004,9 @@ var Uc = function(t, n, e) {
|
|
|
1004
1004
|
y * 4,
|
|
1005
1005
|
f.getLocal(X)
|
|
1006
1006
|
)
|
|
1007
|
-
), [X,
|
|
1007
|
+
), [X, M] = [M, X], F.addCode(
|
|
1008
1008
|
f.setLocal(
|
|
1009
|
-
|
|
1009
|
+
M,
|
|
1010
1010
|
f.i64_shr_u(
|
|
1011
1011
|
f.getLocal(X),
|
|
1012
1012
|
f.i64_const(32)
|
|
@@ -1032,7 +1032,7 @@ var Uc = function(t, n, e) {
|
|
|
1032
1032
|
let it, nt;
|
|
1033
1033
|
return L[v] ? it = f.getLocal("x" + v) : (it = f.teeLocal("x" + v, f.i64_load32_u(f.getLocal("x"), v * 4)), L[v] = !0), L[D] ? nt = f.getLocal("x" + D) : (nt = f.teeLocal("x" + D, f.i64_load32_u(f.getLocal("x"), D * 4)), L[D] = !0), f.i64_mul(it, nt);
|
|
1034
1034
|
}
|
|
1035
|
-
let $ = "c0", X = "c1",
|
|
1035
|
+
let $ = "c0", X = "c1", M = "c0_old", y = "c1_old";
|
|
1036
1036
|
for (let v = 0; v < s * 2 - 1; v++) {
|
|
1037
1037
|
F.addCode(
|
|
1038
1038
|
f.setLocal($, f.i64_const(0)),
|
|
@@ -1120,7 +1120,7 @@ var Uc = function(t, n, e) {
|
|
|
1120
1120
|
f.i64_const(4294967295)
|
|
1121
1121
|
),
|
|
1122
1122
|
f.i64_and(
|
|
1123
|
-
f.getLocal(
|
|
1123
|
+
f.getLocal(M),
|
|
1124
1124
|
f.i64_const(4294967295)
|
|
1125
1125
|
)
|
|
1126
1126
|
)
|
|
@@ -1147,13 +1147,13 @@ var Uc = function(t, n, e) {
|
|
|
1147
1147
|
)
|
|
1148
1148
|
), F.addCode(
|
|
1149
1149
|
f.setLocal(
|
|
1150
|
-
|
|
1150
|
+
M,
|
|
1151
1151
|
f.getLocal(X)
|
|
1152
1152
|
),
|
|
1153
1153
|
f.setLocal(
|
|
1154
1154
|
y,
|
|
1155
1155
|
f.i64_shr_u(
|
|
1156
|
-
f.getLocal(
|
|
1156
|
+
f.getLocal(M),
|
|
1157
1157
|
f.i64_const(32)
|
|
1158
1158
|
)
|
|
1159
1159
|
)
|
|
@@ -1163,7 +1163,7 @@ var Uc = function(t, n, e) {
|
|
|
1163
1163
|
f.i64_store32(
|
|
1164
1164
|
f.getLocal("r"),
|
|
1165
1165
|
s * 4 * 2 - 4,
|
|
1166
|
-
f.getLocal(
|
|
1166
|
+
f.getLocal(M)
|
|
1167
1167
|
)
|
|
1168
1168
|
);
|
|
1169
1169
|
}
|
|
@@ -1266,7 +1266,7 @@ var Uc = function(t, n, e) {
|
|
|
1266
1266
|
x(), ot();
|
|
1267
1267
|
const F = t.addFunction(i + "_div");
|
|
1268
1268
|
F.addParam("x", "i32"), F.addParam("y", "i32"), F.addParam("c", "i32"), F.addParam("r", "i32"), F.addLocal("rr", "i32"), F.addLocal("cc", "i32"), F.addLocal("eX", "i32"), F.addLocal("eY", "i32"), F.addLocal("sy", "i64"), F.addLocal("sx", "i64"), F.addLocal("ec", "i32");
|
|
1269
|
-
const f = F.getCodeBuilder(), L = f.i32_const(t.alloc(d)), V = f.i32_const(t.alloc(d)), $ = f.i32_const(t.alloc(d)), X = f.getLocal("cc"),
|
|
1269
|
+
const f = F.getCodeBuilder(), L = f.i32_const(t.alloc(d)), V = f.i32_const(t.alloc(d)), $ = f.i32_const(t.alloc(d)), X = f.getLocal("cc"), M = f.getLocal("rr"), y = t.alloc(d * 2), v = f.i32_const(y), D = f.i32_const(y + d);
|
|
1270
1270
|
F.addCode(f.if(
|
|
1271
1271
|
f.getLocal("c"),
|
|
1272
1272
|
f.setLocal("cc", f.getLocal("c")),
|
|
@@ -1275,7 +1275,7 @@ var Uc = function(t, n, e) {
|
|
|
1275
1275
|
f.getLocal("r"),
|
|
1276
1276
|
f.setLocal("rr", f.getLocal("r")),
|
|
1277
1277
|
f.setLocal("rr", $)
|
|
1278
|
-
)), F.addCode(f.call(i + "_copy", f.getLocal("x"),
|
|
1278
|
+
)), F.addCode(f.call(i + "_copy", f.getLocal("x"), M)), F.addCode(f.call(i + "_copy", f.getLocal("y"), L)), F.addCode(f.call(i + "_zero", X)), F.addCode(f.call(i + "_zero", v)), F.addCode(f.setLocal("eX", f.i32_const(d - 1))), F.addCode(f.setLocal("eY", f.i32_const(d - 1))), F.addCode(f.block(f.loop(
|
|
1279
1279
|
f.br_if(
|
|
1280
1280
|
1,
|
|
1281
1281
|
f.i32_or(
|
|
@@ -1322,7 +1322,7 @@ var Uc = function(t, n, e) {
|
|
|
1322
1322
|
1,
|
|
1323
1323
|
f.i32_or(
|
|
1324
1324
|
f.i32_load8_u(
|
|
1325
|
-
f.i32_add(
|
|
1325
|
+
f.i32_add(M, f.getLocal("eX")),
|
|
1326
1326
|
0,
|
|
1327
1327
|
0
|
|
1328
1328
|
),
|
|
@@ -1339,7 +1339,7 @@ var Uc = function(t, n, e) {
|
|
|
1339
1339
|
"sx",
|
|
1340
1340
|
f.i64_load(
|
|
1341
1341
|
f.i32_sub(
|
|
1342
|
-
f.i32_add(
|
|
1342
|
+
f.i32_add(M, f.getLocal("eX")),
|
|
1343
1343
|
f.i32_const(7)
|
|
1344
1344
|
),
|
|
1345
1345
|
0,
|
|
@@ -1401,7 +1401,7 @@ var Uc = function(t, n, e) {
|
|
|
1401
1401
|
[
|
|
1402
1402
|
...f.br_if(
|
|
1403
1403
|
2,
|
|
1404
|
-
f.i32_eqz(f.call(i + "_gte",
|
|
1404
|
+
f.i32_eqz(f.call(i + "_gte", M, L))
|
|
1405
1405
|
),
|
|
1406
1406
|
...f.setLocal("sx", f.i64_const(1)),
|
|
1407
1407
|
...f.setLocal("ec", f.i32_const(0))
|
|
@@ -1410,9 +1410,9 @@ var Uc = function(t, n, e) {
|
|
|
1410
1410
|
f.call(i + "__mul1", L, f.getLocal("sx"), D),
|
|
1411
1411
|
f.drop(f.call(
|
|
1412
1412
|
i + "_sub",
|
|
1413
|
-
|
|
1413
|
+
M,
|
|
1414
1414
|
f.i32_sub(D, f.getLocal("ec")),
|
|
1415
|
-
|
|
1415
|
+
M
|
|
1416
1416
|
)),
|
|
1417
1417
|
f.call(
|
|
1418
1418
|
i + "__add1",
|
|
@@ -1425,7 +1425,7 @@ var Uc = function(t, n, e) {
|
|
|
1425
1425
|
function rt() {
|
|
1426
1426
|
const F = t.addFunction(i + "_inverseMod");
|
|
1427
1427
|
F.addParam("px", "i32"), F.addParam("pm", "i32"), F.addParam("pr", "i32"), F.addLocal("t", "i32"), F.addLocal("newt", "i32"), F.addLocal("r", "i32"), F.addLocal("qq", "i32"), F.addLocal("qr", "i32"), F.addLocal("newr", "i32"), F.addLocal("swp", "i32"), F.addLocal("x", "i32"), F.addLocal("signt", "i32"), F.addLocal("signnewt", "i32"), F.addLocal("signx", "i32");
|
|
1428
|
-
const f = F.getCodeBuilder(), L = f.i32_const(t.alloc(d)), V = f.i32_const(t.alloc(d)), $ = f.i32_const(t.alloc(d)), X = f.i32_const(t.alloc(d)),
|
|
1428
|
+
const f = F.getCodeBuilder(), L = f.i32_const(t.alloc(d)), V = f.i32_const(t.alloc(d)), $ = f.i32_const(t.alloc(d)), X = f.i32_const(t.alloc(d)), M = f.i32_const(t.alloc(d)), y = f.i32_const(t.alloc(d)), v = f.i32_const(t.alloc(d * 2)), D = f.i32_const(t.alloc(d));
|
|
1429
1429
|
F.addCode(
|
|
1430
1430
|
f.setLocal("t", L),
|
|
1431
1431
|
f.call(i + "_zero", L),
|
|
@@ -1440,7 +1440,7 @@ var Uc = function(t, n, e) {
|
|
|
1440
1440
|
), F.addCode(
|
|
1441
1441
|
f.setLocal("newr", X),
|
|
1442
1442
|
f.call(i + "_copy", f.getLocal("px"), X)
|
|
1443
|
-
), F.addCode(f.setLocal("qq",
|
|
1443
|
+
), F.addCode(f.setLocal("qq", M)), F.addCode(f.setLocal("qr", y)), F.addCode(f.setLocal("x", D)), F.addCode(f.block(f.loop(
|
|
1444
1444
|
f.br_if(
|
|
1445
1445
|
1,
|
|
1446
1446
|
f.call(i + "_isZero", f.getLocal("newr"))
|
|
@@ -1801,14 +1801,14 @@ function $i(o) {
|
|
|
1801
1801
|
function bo(o) {
|
|
1802
1802
|
return o % 2n === 0n;
|
|
1803
1803
|
}
|
|
1804
|
-
function
|
|
1804
|
+
function be(o) {
|
|
1805
1805
|
return o < 0n;
|
|
1806
1806
|
}
|
|
1807
1807
|
function kc(o) {
|
|
1808
1808
|
return o > 0n;
|
|
1809
1809
|
}
|
|
1810
1810
|
function Yi(o) {
|
|
1811
|
-
return
|
|
1811
|
+
return be(o) ? o.toString(2).length - 1 : o.toString(2).length;
|
|
1812
1812
|
}
|
|
1813
1813
|
function te(o) {
|
|
1814
1814
|
return o < 0n ? -o : o;
|
|
@@ -1821,13 +1821,13 @@ function Zi(o, t) {
|
|
|
1821
1821
|
d = i / s, r = n, b = i, n = e, i = s, e = r - d * e, s = b - d * s;
|
|
1822
1822
|
if (!zn(i))
|
|
1823
1823
|
throw new Error(o.toString() + " and " + t.toString() + " are not co-prime");
|
|
1824
|
-
return ji(n, 0n) === -1 && (n = n + t),
|
|
1824
|
+
return ji(n, 0n) === -1 && (n = n + t), be(o) ? -n : n;
|
|
1825
1825
|
}
|
|
1826
1826
|
function Ji(o, t, n) {
|
|
1827
1827
|
if (n === 0n)
|
|
1828
1828
|
throw new Error("Cannot take modPow with modulus 0");
|
|
1829
1829
|
var e = 1n, i = o % n;
|
|
1830
|
-
for (
|
|
1830
|
+
for (be(t) && (t = t * -1n, i = Zi(i, n)); kc(t); ) {
|
|
1831
1831
|
if (i === 0n)
|
|
1832
1832
|
return 0n;
|
|
1833
1833
|
$i(t) && (e = e * i % n), t = t / 2n, i = Ao(i) % n;
|
|
@@ -1854,7 +1854,7 @@ function Gc(o) {
|
|
|
1854
1854
|
function Kc(o) {
|
|
1855
1855
|
return o - 1n;
|
|
1856
1856
|
}
|
|
1857
|
-
function
|
|
1857
|
+
function Mo(o, t) {
|
|
1858
1858
|
for (var n = Kc(o), e = n, i = 0, s, d, r; bo(e); )
|
|
1859
1859
|
e = e / 2n, i++;
|
|
1860
1860
|
t:
|
|
@@ -1876,14 +1876,14 @@ function Hc(o) {
|
|
|
1876
1876
|
return t;
|
|
1877
1877
|
var n = te(o), e = Yi(n);
|
|
1878
1878
|
if (e <= 64)
|
|
1879
|
-
return
|
|
1879
|
+
return Mo(n, [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37]);
|
|
1880
1880
|
for (var i = Math.log(2) * Number(e), s = Math.ceil(i), d = [], r = 0; r < s; r++)
|
|
1881
1881
|
d.push(BigInt(r + 2));
|
|
1882
|
-
return
|
|
1882
|
+
return Mo(n, d);
|
|
1883
1883
|
}
|
|
1884
1884
|
Yt.bitLength = Yi;
|
|
1885
1885
|
Yt.isOdd = $i;
|
|
1886
|
-
Yt.isNegative =
|
|
1886
|
+
Yt.isNegative = be;
|
|
1887
1887
|
Yt.abs = te;
|
|
1888
1888
|
Yt.isUnit = zn;
|
|
1889
1889
|
Yt.compare = ji;
|
|
@@ -1891,7 +1891,7 @@ Yt.modInv = Zi;
|
|
|
1891
1891
|
Yt.modPow = Ji;
|
|
1892
1892
|
Yt.isPrime = Hc;
|
|
1893
1893
|
Yt.square = Ao;
|
|
1894
|
-
const Vc = Uc, rn = mn, jc = po, $c = Lo,
|
|
1894
|
+
const Vc = Uc, rn = mn, jc = po, $c = Lo, Se = Vi, Oe = Rc, { bitLength: Yc, modInv: ve, modPow: Qo, isPrime: Uo, isOdd: Zc, square: Jc } = Yt;
|
|
1895
1895
|
var yo = function(t, n, e, i) {
|
|
1896
1896
|
const s = BigInt(n), d = Math.floor((Yc(s - 1n) - 1) / 64) + 1, r = d * 2, b = d * 8, u = e || "f1m";
|
|
1897
1897
|
if (t.modules[u])
|
|
@@ -1975,7 +1975,7 @@ var yo = function(t, n, e, i) {
|
|
|
1975
1975
|
function $() {
|
|
1976
1976
|
const I = t.alloc(r * r * 8), h = t.addFunction(u + "_mReduct");
|
|
1977
1977
|
h.addParam("t", "i32"), h.addParam("r", "i32"), h.addLocal("np32", "i64"), h.addLocal("c", "i64"), h.addLocal("m", "i64");
|
|
1978
|
-
const S = h.getCodeBuilder(), W = Number(0x100000000n -
|
|
1978
|
+
const S = h.getCodeBuilder(), W = Number(0x100000000n - ve(s, 0x100000000n));
|
|
1979
1979
|
h.addCode(S.setLocal("np32", S.i64_const(W)));
|
|
1980
1980
|
for (let N = 0; N < r; N++) {
|
|
1981
1981
|
h.addCode(S.setLocal("c", S.i64_const(0))), h.addCode(
|
|
@@ -2037,7 +2037,7 @@ var yo = function(t, n, e, i) {
|
|
|
2037
2037
|
I.addParam("x", "i32"), I.addParam("y", "i32"), I.addParam("r", "i32"), I.addLocal("c0", "i64"), I.addLocal("c1", "i64"), I.addLocal("np32", "i64");
|
|
2038
2038
|
for (let gt = 0; gt < r; gt++)
|
|
2039
2039
|
I.addLocal("x" + gt, "i64"), I.addLocal("y" + gt, "i64"), I.addLocal("m" + gt, "i64"), I.addLocal("q" + gt, "i64");
|
|
2040
|
-
const h = I.getCodeBuilder(), S = Number(0x100000000n -
|
|
2040
|
+
const h = I.getCodeBuilder(), S = Number(0x100000000n - ve(s, 0x100000000n));
|
|
2041
2041
|
I.addCode(h.setLocal("np32", h.i64_const(S)));
|
|
2042
2042
|
const W = [], N = [], at = [];
|
|
2043
2043
|
function It(gt, dt) {
|
|
@@ -2171,12 +2171,12 @@ var yo = function(t, n, e, i) {
|
|
|
2171
2171
|
)
|
|
2172
2172
|
);
|
|
2173
2173
|
}
|
|
2174
|
-
function
|
|
2174
|
+
function M() {
|
|
2175
2175
|
const I = t.addFunction(u + "_square");
|
|
2176
2176
|
I.addParam("x", "i32"), I.addParam("r", "i32"), I.addLocal("c0", "i64"), I.addLocal("c1", "i64"), I.addLocal("c0_old", "i64"), I.addLocal("c1_old", "i64"), I.addLocal("np32", "i64");
|
|
2177
2177
|
for (let dt = 0; dt < r; dt++)
|
|
2178
2178
|
I.addLocal("x" + dt, "i64"), I.addLocal("m" + dt, "i64"), I.addLocal("q" + dt, "i64");
|
|
2179
|
-
const h = I.getCodeBuilder(), S = Number(0x100000000n -
|
|
2179
|
+
const h = I.getCodeBuilder(), S = Number(0x100000000n - ve(s, 0x100000000n));
|
|
2180
2180
|
I.addCode(h.setLocal("np32", h.i64_const(S)));
|
|
2181
2181
|
const W = [], N = [];
|
|
2182
2182
|
function at(dt, yt) {
|
|
@@ -2420,12 +2420,12 @@ var yo = function(t, n, e, i) {
|
|
|
2420
2420
|
}
|
|
2421
2421
|
let nt = 2n;
|
|
2422
2422
|
if (Uo(s))
|
|
2423
|
-
for (;
|
|
2423
|
+
for (; Qo(nt, E, s) !== P; )
|
|
2424
2424
|
nt = nt + 1n;
|
|
2425
2425
|
let K = 0, ct = P;
|
|
2426
2426
|
for (; !Zc(ct) && ct !== 0n; )
|
|
2427
2427
|
K++, ct = ct >> 1n;
|
|
2428
|
-
const J = t.alloc(b, rn.bigInt2BytesLE(ct, b)), st =
|
|
2428
|
+
const J = t.alloc(b, rn.bigInt2BytesLE(ct, b)), st = Qo(nt, ct, s), At = t.alloc(rn.bigInt2BytesLE((st << BigInt(d * 64)) % s, b)), Bt = ct + 1n >> 1n, pt = t.alloc(b, rn.bigInt2BytesLE(Bt, b));
|
|
2429
2429
|
function p() {
|
|
2430
2430
|
const I = t.addFunction(u + "_sqrt");
|
|
2431
2431
|
I.addParam("n", "i32"), I.addParam("r", "i32"), I.addLocal("m", "i32"), I.addLocal("i", "i32"), I.addLocal("j", "i32");
|
|
@@ -2549,7 +2549,7 @@ var yo = function(t, n, e, i) {
|
|
|
2549
2549
|
h.ret(h.call(l + "_eq", h.getLocal("x"), h.i32_const(A)))
|
|
2550
2550
|
);
|
|
2551
2551
|
}
|
|
2552
|
-
return t.exportFunction(l + "_copy", u + "_copy"), t.exportFunction(l + "_zero", u + "_zero"), t.exportFunction(l + "_isZero", u + "_isZero"), t.exportFunction(l + "_eq", u + "_eq"), w(), rt(), F(), f(), $(), X(),
|
|
2552
|
+
return t.exportFunction(l + "_copy", u + "_copy"), t.exportFunction(l + "_zero", u + "_zero"), t.exportFunction(l + "_isZero", u + "_isZero"), t.exportFunction(l + "_eq", u + "_eq"), w(), rt(), F(), f(), $(), X(), M(), y(), v(), D(), L(), V(), it(), T(), m(), c(), $c(t, u), Se(t, u + "_batchToMontgomery", u + "_toMontgomery", b, b), Se(t, u + "_batchFromMontgomery", u + "_fromMontgomery", b, b), Se(t, u + "_batchNeg", u + "_neg", b, b), Oe(t, u + "_batchAdd", u + "_add", b, b), Oe(t, u + "_batchSub", u + "_sub", b, b), Oe(t, u + "_batchMul", u + "_mul", b, b), t.exportFunction(u + "_add"), t.exportFunction(u + "_sub"), t.exportFunction(u + "_neg"), t.exportFunction(u + "_isNegative"), t.exportFunction(u + "_isOne"), t.exportFunction(u + "_sign"), t.exportFunction(u + "_mReduct"), t.exportFunction(u + "_mul"), t.exportFunction(u + "_square"), t.exportFunction(u + "_squareOld"), t.exportFunction(u + "_fromMontgomery"), t.exportFunction(u + "_toMontgomery"), t.exportFunction(u + "_inverse"), t.exportFunction(u + "_one"), t.exportFunction(u + "_load"), t.exportFunction(u + "_timesScalar"), jc(
|
|
2553
2553
|
t,
|
|
2554
2554
|
u + "_exp",
|
|
2555
2555
|
b,
|
|
@@ -2596,7 +2596,7 @@ var Wi = function(t, n, e, i, s) {
|
|
|
2596
2596
|
}
|
|
2597
2597
|
return P(), E(), z(), x(), t.exportFunction(C + "_add", u + "_add"), t.exportFunction(C + "_sub", u + "_sub"), t.exportFunction(C + "_neg", u + "_neg"), t.exportFunction(u + "_mul"), t.exportFunction(u + "_square"), t.exportFunction(u + "_inverse"), t.exportFunction(u + "_isNegative"), t.exportFunction(C + "_copy", u + "_copy"), t.exportFunction(C + "_zero", u + "_zero"), t.exportFunction(C + "_one", u + "_one"), t.exportFunction(C + "_isZero", u + "_isZero"), t.exportFunction(C + "_eq", u + "_eq"), u;
|
|
2598
2598
|
};
|
|
2599
|
-
const ts = po, ns = Lo,
|
|
2599
|
+
const ts = po, ns = Lo, Pe = mn;
|
|
2600
2600
|
var Xi = function(t, n, e, i) {
|
|
2601
2601
|
if (t.modules[e])
|
|
2602
2602
|
return e;
|
|
@@ -2605,55 +2605,55 @@ var Xi = function(t, n, e, i) {
|
|
|
2605
2605
|
n64: t.modules[i].n64 * 2
|
|
2606
2606
|
};
|
|
2607
2607
|
function r() {
|
|
2608
|
-
const
|
|
2609
|
-
|
|
2610
|
-
const y =
|
|
2611
|
-
|
|
2608
|
+
const M = t.addFunction(e + "_add");
|
|
2609
|
+
M.addParam("x", "i32"), M.addParam("y", "i32"), M.addParam("r", "i32");
|
|
2610
|
+
const y = M.getCodeBuilder(), v = y.getLocal("x"), D = y.i32_add(y.getLocal("x"), y.i32_const(s)), it = y.getLocal("y"), nt = y.i32_add(y.getLocal("y"), y.i32_const(s)), K = y.getLocal("r"), ct = y.i32_add(y.getLocal("r"), y.i32_const(s));
|
|
2611
|
+
M.addCode(
|
|
2612
2612
|
y.call(i + "_add", v, it, K),
|
|
2613
2613
|
y.call(i + "_add", D, nt, ct)
|
|
2614
2614
|
);
|
|
2615
2615
|
}
|
|
2616
2616
|
function b() {
|
|
2617
|
-
const
|
|
2618
|
-
|
|
2619
|
-
const y =
|
|
2620
|
-
|
|
2617
|
+
const M = t.addFunction(e + "_timesScalar");
|
|
2618
|
+
M.addParam("x", "i32"), M.addParam("scalar", "i32"), M.addParam("scalarLen", "i32"), M.addParam("r", "i32");
|
|
2619
|
+
const y = M.getCodeBuilder(), v = y.getLocal("x"), D = y.i32_add(y.getLocal("x"), y.i32_const(s)), it = y.getLocal("r"), nt = y.i32_add(y.getLocal("r"), y.i32_const(s));
|
|
2620
|
+
M.addCode(
|
|
2621
2621
|
y.call(i + "_timesScalar", v, y.getLocal("scalar"), y.getLocal("scalarLen"), it),
|
|
2622
2622
|
y.call(i + "_timesScalar", D, y.getLocal("scalar"), y.getLocal("scalarLen"), nt)
|
|
2623
2623
|
);
|
|
2624
2624
|
}
|
|
2625
2625
|
function u() {
|
|
2626
|
-
const
|
|
2627
|
-
|
|
2628
|
-
const y =
|
|
2629
|
-
|
|
2626
|
+
const M = t.addFunction(e + "_sub");
|
|
2627
|
+
M.addParam("x", "i32"), M.addParam("y", "i32"), M.addParam("r", "i32");
|
|
2628
|
+
const y = M.getCodeBuilder(), v = y.getLocal("x"), D = y.i32_add(y.getLocal("x"), y.i32_const(s)), it = y.getLocal("y"), nt = y.i32_add(y.getLocal("y"), y.i32_const(s)), K = y.getLocal("r"), ct = y.i32_add(y.getLocal("r"), y.i32_const(s));
|
|
2629
|
+
M.addCode(
|
|
2630
2630
|
y.call(i + "_sub", v, it, K),
|
|
2631
2631
|
y.call(i + "_sub", D, nt, ct)
|
|
2632
2632
|
);
|
|
2633
2633
|
}
|
|
2634
2634
|
function l() {
|
|
2635
|
-
const
|
|
2636
|
-
|
|
2637
|
-
const y =
|
|
2638
|
-
|
|
2635
|
+
const M = t.addFunction(e + "_neg");
|
|
2636
|
+
M.addParam("x", "i32"), M.addParam("r", "i32");
|
|
2637
|
+
const y = M.getCodeBuilder(), v = y.getLocal("x"), D = y.i32_add(y.getLocal("x"), y.i32_const(s)), it = y.getLocal("r"), nt = y.i32_add(y.getLocal("r"), y.i32_const(s));
|
|
2638
|
+
M.addCode(
|
|
2639
2639
|
y.call(i + "_neg", v, it),
|
|
2640
2640
|
y.call(i + "_neg", D, nt)
|
|
2641
2641
|
);
|
|
2642
2642
|
}
|
|
2643
2643
|
function C() {
|
|
2644
|
-
const
|
|
2645
|
-
|
|
2646
|
-
const y =
|
|
2647
|
-
|
|
2644
|
+
const M = t.addFunction(e + "_conjugate");
|
|
2645
|
+
M.addParam("x", "i32"), M.addParam("r", "i32");
|
|
2646
|
+
const y = M.getCodeBuilder(), v = y.getLocal("x"), D = y.i32_add(y.getLocal("x"), y.i32_const(s)), it = y.getLocal("r"), nt = y.i32_add(y.getLocal("r"), y.i32_const(s));
|
|
2647
|
+
M.addCode(
|
|
2648
2648
|
y.call(i + "_copy", v, it),
|
|
2649
2649
|
y.call(i + "_neg", D, nt)
|
|
2650
2650
|
);
|
|
2651
2651
|
}
|
|
2652
2652
|
function B() {
|
|
2653
|
-
const
|
|
2654
|
-
|
|
2655
|
-
const y =
|
|
2656
|
-
|
|
2653
|
+
const M = t.addFunction(e + "_isNegative");
|
|
2654
|
+
M.addParam("x", "i32"), M.setReturnType("i32");
|
|
2655
|
+
const y = M.getCodeBuilder(), v = y.getLocal("x"), D = y.i32_add(y.getLocal("x"), y.i32_const(s));
|
|
2656
|
+
M.addCode(
|
|
2657
2657
|
y.if(
|
|
2658
2658
|
y.call(i + "_isZero", D),
|
|
2659
2659
|
y.ret(y.call(i + "_isNegative", v))
|
|
@@ -2662,10 +2662,10 @@ var Xi = function(t, n, e, i) {
|
|
|
2662
2662
|
);
|
|
2663
2663
|
}
|
|
2664
2664
|
function A() {
|
|
2665
|
-
const
|
|
2666
|
-
|
|
2667
|
-
const y =
|
|
2668
|
-
|
|
2665
|
+
const M = t.addFunction(e + "_mul");
|
|
2666
|
+
M.addParam("x", "i32"), M.addParam("y", "i32"), M.addParam("r", "i32");
|
|
2667
|
+
const y = M.getCodeBuilder(), v = y.getLocal("x"), D = y.i32_add(y.getLocal("x"), y.i32_const(s)), it = y.getLocal("y"), nt = y.i32_add(y.getLocal("y"), y.i32_const(s)), K = y.getLocal("r"), ct = y.i32_add(y.getLocal("r"), y.i32_const(s)), J = y.i32_const(t.alloc(s)), st = y.i32_const(t.alloc(s)), At = y.i32_const(t.alloc(s)), Bt = y.i32_const(t.alloc(s));
|
|
2668
|
+
M.addCode(
|
|
2669
2669
|
y.call(i + "_mul", v, it, J),
|
|
2670
2670
|
// A = x0*y0
|
|
2671
2671
|
y.call(i + "_mul", D, nt, st),
|
|
@@ -2688,10 +2688,10 @@ var Xi = function(t, n, e, i) {
|
|
|
2688
2688
|
);
|
|
2689
2689
|
}
|
|
2690
2690
|
function O() {
|
|
2691
|
-
const
|
|
2692
|
-
|
|
2693
|
-
const y =
|
|
2694
|
-
|
|
2691
|
+
const M = t.addFunction(e + "_mul1");
|
|
2692
|
+
M.addParam("x", "i32"), M.addParam("y", "i32"), M.addParam("r", "i32");
|
|
2693
|
+
const y = M.getCodeBuilder(), v = y.getLocal("x"), D = y.i32_add(y.getLocal("x"), y.i32_const(s)), it = y.getLocal("y"), nt = y.getLocal("r"), K = y.i32_add(y.getLocal("r"), y.i32_const(s));
|
|
2694
|
+
M.addCode(
|
|
2695
2695
|
y.call(i + "_mul", v, it, nt),
|
|
2696
2696
|
// A = x0*y
|
|
2697
2697
|
y.call(i + "_mul", D, it, K)
|
|
@@ -2699,10 +2699,10 @@ var Xi = function(t, n, e, i) {
|
|
|
2699
2699
|
);
|
|
2700
2700
|
}
|
|
2701
2701
|
function P() {
|
|
2702
|
-
const
|
|
2703
|
-
|
|
2704
|
-
const y =
|
|
2705
|
-
|
|
2702
|
+
const M = t.addFunction(e + "_square");
|
|
2703
|
+
M.addParam("x", "i32"), M.addParam("r", "i32");
|
|
2704
|
+
const y = M.getCodeBuilder(), v = y.getLocal("x"), D = y.i32_add(y.getLocal("x"), y.i32_const(s)), it = y.getLocal("r"), nt = y.i32_add(y.getLocal("r"), y.i32_const(s)), K = y.i32_const(t.alloc(s)), ct = y.i32_const(t.alloc(s)), J = y.i32_const(t.alloc(s)), st = y.i32_const(t.alloc(s));
|
|
2705
|
+
M.addCode(
|
|
2706
2706
|
// AB = x0*y1
|
|
2707
2707
|
y.call(i + "_mul", v, D, K),
|
|
2708
2708
|
// APB = x0+y1
|
|
@@ -2721,55 +2721,55 @@ var Xi = function(t, n, e, i) {
|
|
|
2721
2721
|
);
|
|
2722
2722
|
}
|
|
2723
2723
|
function E() {
|
|
2724
|
-
const
|
|
2725
|
-
|
|
2726
|
-
const y =
|
|
2727
|
-
|
|
2724
|
+
const M = t.addFunction(e + "_toMontgomery");
|
|
2725
|
+
M.addParam("x", "i32"), M.addParam("r", "i32");
|
|
2726
|
+
const y = M.getCodeBuilder(), v = y.getLocal("x"), D = y.i32_add(y.getLocal("x"), y.i32_const(s)), it = y.getLocal("r"), nt = y.i32_add(y.getLocal("r"), y.i32_const(s));
|
|
2727
|
+
M.addCode(
|
|
2728
2728
|
y.call(i + "_toMontgomery", v, it),
|
|
2729
2729
|
y.call(i + "_toMontgomery", D, nt)
|
|
2730
2730
|
);
|
|
2731
2731
|
}
|
|
2732
2732
|
function z() {
|
|
2733
|
-
const
|
|
2734
|
-
|
|
2735
|
-
const y =
|
|
2736
|
-
|
|
2733
|
+
const M = t.addFunction(e + "_fromMontgomery");
|
|
2734
|
+
M.addParam("x", "i32"), M.addParam("r", "i32");
|
|
2735
|
+
const y = M.getCodeBuilder(), v = y.getLocal("x"), D = y.i32_add(y.getLocal("x"), y.i32_const(s)), it = y.getLocal("r"), nt = y.i32_add(y.getLocal("r"), y.i32_const(s));
|
|
2736
|
+
M.addCode(
|
|
2737
2737
|
y.call(i + "_fromMontgomery", v, it),
|
|
2738
2738
|
y.call(i + "_fromMontgomery", D, nt)
|
|
2739
2739
|
);
|
|
2740
2740
|
}
|
|
2741
2741
|
function x() {
|
|
2742
|
-
const
|
|
2743
|
-
|
|
2744
|
-
const y =
|
|
2745
|
-
|
|
2742
|
+
const M = t.addFunction(e + "_copy");
|
|
2743
|
+
M.addParam("x", "i32"), M.addParam("r", "i32");
|
|
2744
|
+
const y = M.getCodeBuilder(), v = y.getLocal("x"), D = y.i32_add(y.getLocal("x"), y.i32_const(s)), it = y.getLocal("r"), nt = y.i32_add(y.getLocal("r"), y.i32_const(s));
|
|
2745
|
+
M.addCode(
|
|
2746
2746
|
y.call(i + "_copy", v, it),
|
|
2747
2747
|
y.call(i + "_copy", D, nt)
|
|
2748
2748
|
);
|
|
2749
2749
|
}
|
|
2750
2750
|
function ot() {
|
|
2751
|
-
const
|
|
2752
|
-
|
|
2753
|
-
const y =
|
|
2754
|
-
|
|
2751
|
+
const M = t.addFunction(e + "_zero");
|
|
2752
|
+
M.addParam("x", "i32");
|
|
2753
|
+
const y = M.getCodeBuilder(), v = y.getLocal("x"), D = y.i32_add(y.getLocal("x"), y.i32_const(s));
|
|
2754
|
+
M.addCode(
|
|
2755
2755
|
y.call(i + "_zero", v),
|
|
2756
2756
|
y.call(i + "_zero", D)
|
|
2757
2757
|
);
|
|
2758
2758
|
}
|
|
2759
2759
|
function T() {
|
|
2760
|
-
const
|
|
2761
|
-
|
|
2762
|
-
const y =
|
|
2763
|
-
|
|
2760
|
+
const M = t.addFunction(e + "_one");
|
|
2761
|
+
M.addParam("x", "i32");
|
|
2762
|
+
const y = M.getCodeBuilder(), v = y.getLocal("x"), D = y.i32_add(y.getLocal("x"), y.i32_const(s));
|
|
2763
|
+
M.addCode(
|
|
2764
2764
|
y.call(i + "_one", v),
|
|
2765
2765
|
y.call(i + "_zero", D)
|
|
2766
2766
|
);
|
|
2767
2767
|
}
|
|
2768
2768
|
function rt() {
|
|
2769
|
-
const
|
|
2770
|
-
|
|
2771
|
-
const y =
|
|
2772
|
-
|
|
2769
|
+
const M = t.addFunction(e + "_eq");
|
|
2770
|
+
M.addParam("x", "i32"), M.addParam("y", "i32"), M.setReturnType("i32");
|
|
2771
|
+
const y = M.getCodeBuilder(), v = y.getLocal("x"), D = y.i32_add(y.getLocal("x"), y.i32_const(s)), it = y.getLocal("y"), nt = y.i32_add(y.getLocal("y"), y.i32_const(s));
|
|
2772
|
+
M.addCode(
|
|
2773
2773
|
y.i32_and(
|
|
2774
2774
|
y.call(i + "_eq", v, it),
|
|
2775
2775
|
y.call(i + "_eq", D, nt)
|
|
@@ -2777,10 +2777,10 @@ var Xi = function(t, n, e, i) {
|
|
|
2777
2777
|
);
|
|
2778
2778
|
}
|
|
2779
2779
|
function F() {
|
|
2780
|
-
const
|
|
2781
|
-
|
|
2782
|
-
const y =
|
|
2783
|
-
|
|
2780
|
+
const M = t.addFunction(e + "_isZero");
|
|
2781
|
+
M.addParam("x", "i32"), M.setReturnType("i32");
|
|
2782
|
+
const y = M.getCodeBuilder(), v = y.getLocal("x"), D = y.i32_add(y.getLocal("x"), y.i32_const(s));
|
|
2783
|
+
M.addCode(
|
|
2784
2784
|
y.i32_and(
|
|
2785
2785
|
y.call(i + "_isZero", v),
|
|
2786
2786
|
y.call(i + "_isZero", D)
|
|
@@ -2788,10 +2788,10 @@ var Xi = function(t, n, e, i) {
|
|
|
2788
2788
|
);
|
|
2789
2789
|
}
|
|
2790
2790
|
function f() {
|
|
2791
|
-
const
|
|
2792
|
-
|
|
2793
|
-
const y =
|
|
2794
|
-
|
|
2791
|
+
const M = t.addFunction(e + "_inverse");
|
|
2792
|
+
M.addParam("x", "i32"), M.addParam("r", "i32");
|
|
2793
|
+
const y = M.getCodeBuilder(), v = y.getLocal("x"), D = y.i32_add(y.getLocal("x"), y.i32_const(s)), it = y.getLocal("r"), nt = y.i32_add(y.getLocal("r"), y.i32_const(s)), K = y.i32_const(t.alloc(s)), ct = y.i32_const(t.alloc(s)), J = y.i32_const(t.alloc(s)), st = y.i32_const(t.alloc(s));
|
|
2794
|
+
M.addCode(
|
|
2795
2795
|
y.call(i + "_square", v, K),
|
|
2796
2796
|
y.call(i + "_square", D, ct),
|
|
2797
2797
|
// c.call(f1mPrefix+"_mul", t1, c.i32_const(pNonResidue), t2),
|
|
@@ -2804,10 +2804,10 @@ var Xi = function(t, n, e, i) {
|
|
|
2804
2804
|
);
|
|
2805
2805
|
}
|
|
2806
2806
|
function L() {
|
|
2807
|
-
const
|
|
2808
|
-
|
|
2809
|
-
const y =
|
|
2810
|
-
|
|
2807
|
+
const M = t.addFunction(e + "_sign");
|
|
2808
|
+
M.addParam("x", "i32"), M.addLocal("s", "i32"), M.setReturnType("i32");
|
|
2809
|
+
const y = M.getCodeBuilder(), v = y.getLocal("x"), D = y.i32_add(y.getLocal("x"), y.i32_const(s));
|
|
2810
|
+
M.addCode(
|
|
2811
2811
|
y.setLocal("s", y.call(i + "_sign", D)),
|
|
2812
2812
|
y.if(
|
|
2813
2813
|
y.getLocal("s"),
|
|
@@ -2817,10 +2817,10 @@ var Xi = function(t, n, e, i) {
|
|
|
2817
2817
|
);
|
|
2818
2818
|
}
|
|
2819
2819
|
function V() {
|
|
2820
|
-
const
|
|
2821
|
-
|
|
2822
|
-
const y =
|
|
2823
|
-
|
|
2820
|
+
const M = t.addFunction(e + "_isOne");
|
|
2821
|
+
M.addParam("x", "i32"), M.setReturnType("i32");
|
|
2822
|
+
const y = M.getCodeBuilder(), v = y.getLocal("x"), D = y.i32_add(y.getLocal("x"), y.i32_const(s));
|
|
2823
|
+
M.addCode(
|
|
2824
2824
|
y.ret(y.i32_and(
|
|
2825
2825
|
y.call(i + "_isOne", v),
|
|
2826
2826
|
y.call(i + "_isZero", D)
|
|
@@ -2828,10 +2828,10 @@ var Xi = function(t, n, e, i) {
|
|
|
2828
2828
|
);
|
|
2829
2829
|
}
|
|
2830
2830
|
function $() {
|
|
2831
|
-
const
|
|
2832
|
-
|
|
2833
|
-
const y =
|
|
2834
|
-
|
|
2831
|
+
const M = t.addFunction(e + "_sqrt");
|
|
2832
|
+
M.addParam("a", "i32"), M.addParam("pr", "i32");
|
|
2833
|
+
const y = M.getCodeBuilder(), v = y.i32_const(t.alloc(Pe.bigInt2BytesLE((BigInt(d || 0) - 3n) / 4n, s))), D = y.i32_const(t.alloc(Pe.bigInt2BytesLE((BigInt(d || 0) - 1n) / 2n, s))), it = y.getLocal("a"), nt = y.i32_const(t.alloc(s * 2)), K = y.i32_const(t.alloc(s * 2)), ct = y.i32_const(t.alloc(s * 2)), J = t.alloc(s * 2), st = y.i32_const(J), At = y.i32_const(J), Bt = y.i32_const(J + s), pt = y.i32_const(t.alloc(s * 2)), p = y.i32_const(t.alloc(s * 2));
|
|
2834
|
+
M.addCode(
|
|
2835
2835
|
y.call(e + "_one", st),
|
|
2836
2836
|
y.call(e + "_neg", st, st),
|
|
2837
2837
|
// const a1 = F.pow(a, F.sqrt_e34);
|
|
@@ -2867,10 +2867,10 @@ var Xi = function(t, n, e, i) {
|
|
|
2867
2867
|
);
|
|
2868
2868
|
}
|
|
2869
2869
|
function X() {
|
|
2870
|
-
const
|
|
2871
|
-
|
|
2872
|
-
const y =
|
|
2873
|
-
|
|
2870
|
+
const M = t.addFunction(e + "_isSquare");
|
|
2871
|
+
M.addParam("a", "i32"), M.setReturnType("i32");
|
|
2872
|
+
const y = M.getCodeBuilder(), v = y.i32_const(t.alloc(Pe.bigInt2BytesLE((BigInt(d || 0) - 3n) / 4n, s))), D = y.getLocal("a"), it = y.i32_const(t.alloc(s * 2)), nt = y.i32_const(t.alloc(s * 2)), K = y.i32_const(t.alloc(s * 2)), ct = t.alloc(s * 2), J = y.i32_const(ct);
|
|
2873
|
+
M.addCode(
|
|
2874
2874
|
y.call(e + "_one", J),
|
|
2875
2875
|
y.call(e + "_neg", J, J),
|
|
2876
2876
|
// const a1 = F.pow(a, F.sqrt_e34);
|
|
@@ -2914,9 +2914,9 @@ var ta = function(t, n, e, i) {
|
|
|
2914
2914
|
function d() {
|
|
2915
2915
|
const f = t.addFunction(e + "_add");
|
|
2916
2916
|
f.addParam("x", "i32"), f.addParam("y", "i32"), f.addParam("r", "i32");
|
|
2917
|
-
const L = f.getCodeBuilder(), V = L.getLocal("x"), $ = L.i32_add(L.getLocal("x"), L.i32_const(s)), X = L.i32_add(L.getLocal("x"), L.i32_const(2 * s)),
|
|
2917
|
+
const L = f.getCodeBuilder(), V = L.getLocal("x"), $ = L.i32_add(L.getLocal("x"), L.i32_const(s)), X = L.i32_add(L.getLocal("x"), L.i32_const(2 * s)), M = L.getLocal("y"), y = L.i32_add(L.getLocal("y"), L.i32_const(s)), v = L.i32_add(L.getLocal("y"), L.i32_const(2 * s)), D = L.getLocal("r"), it = L.i32_add(L.getLocal("r"), L.i32_const(s)), nt = L.i32_add(L.getLocal("r"), L.i32_const(2 * s));
|
|
2918
2918
|
f.addCode(
|
|
2919
|
-
L.call(i + "_add", V,
|
|
2919
|
+
L.call(i + "_add", V, M, D),
|
|
2920
2920
|
L.call(i + "_add", $, y, it),
|
|
2921
2921
|
L.call(i + "_add", X, v, nt)
|
|
2922
2922
|
);
|
|
@@ -2924,9 +2924,9 @@ var ta = function(t, n, e, i) {
|
|
|
2924
2924
|
function r() {
|
|
2925
2925
|
const f = t.addFunction(e + "_timesScalar");
|
|
2926
2926
|
f.addParam("x", "i32"), f.addParam("scalar", "i32"), f.addParam("scalarLen", "i32"), f.addParam("r", "i32");
|
|
2927
|
-
const L = f.getCodeBuilder(), V = L.getLocal("x"), $ = L.i32_add(L.getLocal("x"), L.i32_const(s)), X = L.i32_add(L.getLocal("x"), L.i32_const(2 * s)),
|
|
2927
|
+
const L = f.getCodeBuilder(), V = L.getLocal("x"), $ = L.i32_add(L.getLocal("x"), L.i32_const(s)), X = L.i32_add(L.getLocal("x"), L.i32_const(2 * s)), M = L.getLocal("r"), y = L.i32_add(L.getLocal("r"), L.i32_const(s)), v = L.i32_add(L.getLocal("r"), L.i32_const(2 * s));
|
|
2928
2928
|
f.addCode(
|
|
2929
|
-
L.call(i + "_timesScalar", V, L.getLocal("scalar"), L.getLocal("scalarLen"),
|
|
2929
|
+
L.call(i + "_timesScalar", V, L.getLocal("scalar"), L.getLocal("scalarLen"), M),
|
|
2930
2930
|
L.call(i + "_timesScalar", $, L.getLocal("scalar"), L.getLocal("scalarLen"), y),
|
|
2931
2931
|
L.call(i + "_timesScalar", X, L.getLocal("scalar"), L.getLocal("scalarLen"), v)
|
|
2932
2932
|
);
|
|
@@ -2934,9 +2934,9 @@ var ta = function(t, n, e, i) {
|
|
|
2934
2934
|
function b() {
|
|
2935
2935
|
const f = t.addFunction(e + "_sub");
|
|
2936
2936
|
f.addParam("x", "i32"), f.addParam("y", "i32"), f.addParam("r", "i32");
|
|
2937
|
-
const L = f.getCodeBuilder(), V = L.getLocal("x"), $ = L.i32_add(L.getLocal("x"), L.i32_const(s)), X = L.i32_add(L.getLocal("x"), L.i32_const(2 * s)),
|
|
2937
|
+
const L = f.getCodeBuilder(), V = L.getLocal("x"), $ = L.i32_add(L.getLocal("x"), L.i32_const(s)), X = L.i32_add(L.getLocal("x"), L.i32_const(2 * s)), M = L.getLocal("y"), y = L.i32_add(L.getLocal("y"), L.i32_const(s)), v = L.i32_add(L.getLocal("y"), L.i32_const(2 * s)), D = L.getLocal("r"), it = L.i32_add(L.getLocal("r"), L.i32_const(s)), nt = L.i32_add(L.getLocal("r"), L.i32_const(2 * s));
|
|
2938
2938
|
f.addCode(
|
|
2939
|
-
L.call(i + "_sub", V,
|
|
2939
|
+
L.call(i + "_sub", V, M, D),
|
|
2940
2940
|
L.call(i + "_sub", $, y, it),
|
|
2941
2941
|
L.call(i + "_sub", X, v, nt)
|
|
2942
2942
|
);
|
|
@@ -2944,9 +2944,9 @@ var ta = function(t, n, e, i) {
|
|
|
2944
2944
|
function u() {
|
|
2945
2945
|
const f = t.addFunction(e + "_neg");
|
|
2946
2946
|
f.addParam("x", "i32"), f.addParam("r", "i32");
|
|
2947
|
-
const L = f.getCodeBuilder(), V = L.getLocal("x"), $ = L.i32_add(L.getLocal("x"), L.i32_const(s)), X = L.i32_add(L.getLocal("x"), L.i32_const(2 * s)),
|
|
2947
|
+
const L = f.getCodeBuilder(), V = L.getLocal("x"), $ = L.i32_add(L.getLocal("x"), L.i32_const(s)), X = L.i32_add(L.getLocal("x"), L.i32_const(2 * s)), M = L.getLocal("r"), y = L.i32_add(L.getLocal("r"), L.i32_const(s)), v = L.i32_add(L.getLocal("r"), L.i32_const(2 * s));
|
|
2948
2948
|
f.addCode(
|
|
2949
|
-
L.call(i + "_neg", V,
|
|
2949
|
+
L.call(i + "_neg", V, M),
|
|
2950
2950
|
L.call(i + "_neg", $, y),
|
|
2951
2951
|
L.call(i + "_neg", X, v)
|
|
2952
2952
|
);
|
|
@@ -2970,15 +2970,15 @@ var ta = function(t, n, e, i) {
|
|
|
2970
2970
|
function C() {
|
|
2971
2971
|
const f = t.addFunction(e + "_mul");
|
|
2972
2972
|
f.addParam("x", "i32"), f.addParam("y", "i32"), f.addParam("r", "i32");
|
|
2973
|
-
const L = f.getCodeBuilder(), V = L.getLocal("x"), $ = L.i32_add(L.getLocal("x"), L.i32_const(s)), X = L.i32_add(L.getLocal("x"), L.i32_const(2 * s)),
|
|
2973
|
+
const L = f.getCodeBuilder(), V = L.getLocal("x"), $ = L.i32_add(L.getLocal("x"), L.i32_const(s)), X = L.i32_add(L.getLocal("x"), L.i32_const(2 * s)), M = L.getLocal("y"), y = L.i32_add(L.getLocal("y"), L.i32_const(s)), v = L.i32_add(L.getLocal("y"), L.i32_const(2 * s)), D = L.getLocal("r"), it = L.i32_add(L.getLocal("r"), L.i32_const(s)), nt = L.i32_add(L.getLocal("r"), L.i32_const(2 * s)), K = L.i32_const(t.alloc(s)), ct = L.i32_const(t.alloc(s)), J = L.i32_const(t.alloc(s)), st = L.i32_const(t.alloc(s)), At = L.i32_const(t.alloc(s)), Bt = L.i32_const(t.alloc(s)), pt = L.i32_const(t.alloc(s)), p = L.i32_const(t.alloc(s)), a = L.i32_const(t.alloc(s)), m = L.i32_const(t.alloc(s)), c = L.i32_const(t.alloc(s)), w = L.i32_const(t.alloc(s)), I = L.i32_const(t.alloc(s));
|
|
2974
2974
|
f.addCode(
|
|
2975
|
-
L.call(i + "_mul", V,
|
|
2975
|
+
L.call(i + "_mul", V, M, K),
|
|
2976
2976
|
L.call(i + "_mul", $, y, ct),
|
|
2977
2977
|
L.call(i + "_mul", X, v, J),
|
|
2978
2978
|
L.call(i + "_add", V, $, st),
|
|
2979
|
-
L.call(i + "_add",
|
|
2979
|
+
L.call(i + "_add", M, y, At),
|
|
2980
2980
|
L.call(i + "_add", V, X, Bt),
|
|
2981
|
-
L.call(i + "_add",
|
|
2981
|
+
L.call(i + "_add", M, v, pt),
|
|
2982
2982
|
L.call(i + "_add", $, X, p),
|
|
2983
2983
|
L.call(i + "_add", y, v, a),
|
|
2984
2984
|
L.call(i + "_add", K, ct, m),
|
|
@@ -3000,7 +3000,7 @@ var ta = function(t, n, e, i) {
|
|
|
3000
3000
|
function B() {
|
|
3001
3001
|
const f = t.addFunction(e + "_square");
|
|
3002
3002
|
f.addParam("x", "i32"), f.addParam("r", "i32");
|
|
3003
|
-
const L = f.getCodeBuilder(), V = L.getLocal("x"), $ = L.i32_add(L.getLocal("x"), L.i32_const(s)), X = L.i32_add(L.getLocal("x"), L.i32_const(2 * s)),
|
|
3003
|
+
const L = f.getCodeBuilder(), V = L.getLocal("x"), $ = L.i32_add(L.getLocal("x"), L.i32_const(s)), X = L.i32_add(L.getLocal("x"), L.i32_const(2 * s)), M = L.getLocal("r"), y = L.i32_add(L.getLocal("r"), L.i32_const(s)), v = L.i32_add(L.getLocal("r"), L.i32_const(2 * s)), D = L.i32_const(t.alloc(s)), it = L.i32_const(t.alloc(s)), nt = L.i32_const(t.alloc(s)), K = L.i32_const(t.alloc(s)), ct = L.i32_const(t.alloc(s)), J = L.i32_const(t.alloc(s)), st = L.i32_const(t.alloc(s));
|
|
3004
3004
|
f.addCode(
|
|
3005
3005
|
L.call(i + "_square", V, D),
|
|
3006
3006
|
L.call(i + "_mul", V, $, it),
|
|
@@ -3011,8 +3011,8 @@ var ta = function(t, n, e, i) {
|
|
|
3011
3011
|
L.call(i + "_mul", $, X, ct),
|
|
3012
3012
|
L.call(i + "_add", ct, ct, J),
|
|
3013
3013
|
L.call(i + "_square", X, st),
|
|
3014
|
-
L.call(n, J,
|
|
3015
|
-
L.call(i + "_add", D,
|
|
3014
|
+
L.call(n, J, M),
|
|
3015
|
+
L.call(i + "_add", D, M, M),
|
|
3016
3016
|
L.call(n, st, y),
|
|
3017
3017
|
L.call(i + "_add", nt, y, y),
|
|
3018
3018
|
L.call(i + "_add", D, st, v),
|
|
@@ -3024,9 +3024,9 @@ var ta = function(t, n, e, i) {
|
|
|
3024
3024
|
function A() {
|
|
3025
3025
|
const f = t.addFunction(e + "_toMontgomery");
|
|
3026
3026
|
f.addParam("x", "i32"), f.addParam("r", "i32");
|
|
3027
|
-
const L = f.getCodeBuilder(), V = L.getLocal("x"), $ = L.i32_add(L.getLocal("x"), L.i32_const(s)), X = L.i32_add(L.getLocal("x"), L.i32_const(2 * s)),
|
|
3027
|
+
const L = f.getCodeBuilder(), V = L.getLocal("x"), $ = L.i32_add(L.getLocal("x"), L.i32_const(s)), X = L.i32_add(L.getLocal("x"), L.i32_const(2 * s)), M = L.getLocal("r"), y = L.i32_add(L.getLocal("r"), L.i32_const(s)), v = L.i32_add(L.getLocal("r"), L.i32_const(2 * s));
|
|
3028
3028
|
f.addCode(
|
|
3029
|
-
L.call(i + "_toMontgomery", V,
|
|
3029
|
+
L.call(i + "_toMontgomery", V, M),
|
|
3030
3030
|
L.call(i + "_toMontgomery", $, y),
|
|
3031
3031
|
L.call(i + "_toMontgomery", X, v)
|
|
3032
3032
|
);
|
|
@@ -3034,9 +3034,9 @@ var ta = function(t, n, e, i) {
|
|
|
3034
3034
|
function O() {
|
|
3035
3035
|
const f = t.addFunction(e + "_fromMontgomery");
|
|
3036
3036
|
f.addParam("x", "i32"), f.addParam("r", "i32");
|
|
3037
|
-
const L = f.getCodeBuilder(), V = L.getLocal("x"), $ = L.i32_add(L.getLocal("x"), L.i32_const(s)), X = L.i32_add(L.getLocal("x"), L.i32_const(2 * s)),
|
|
3037
|
+
const L = f.getCodeBuilder(), V = L.getLocal("x"), $ = L.i32_add(L.getLocal("x"), L.i32_const(s)), X = L.i32_add(L.getLocal("x"), L.i32_const(2 * s)), M = L.getLocal("r"), y = L.i32_add(L.getLocal("r"), L.i32_const(s)), v = L.i32_add(L.getLocal("r"), L.i32_const(2 * s));
|
|
3038
3038
|
f.addCode(
|
|
3039
|
-
L.call(i + "_fromMontgomery", V,
|
|
3039
|
+
L.call(i + "_fromMontgomery", V, M),
|
|
3040
3040
|
L.call(i + "_fromMontgomery", $, y),
|
|
3041
3041
|
L.call(i + "_fromMontgomery", X, v)
|
|
3042
3042
|
);
|
|
@@ -3044,9 +3044,9 @@ var ta = function(t, n, e, i) {
|
|
|
3044
3044
|
function P() {
|
|
3045
3045
|
const f = t.addFunction(e + "_copy");
|
|
3046
3046
|
f.addParam("x", "i32"), f.addParam("r", "i32");
|
|
3047
|
-
const L = f.getCodeBuilder(), V = L.getLocal("x"), $ = L.i32_add(L.getLocal("x"), L.i32_const(s)), X = L.i32_add(L.getLocal("x"), L.i32_const(2 * s)),
|
|
3047
|
+
const L = f.getCodeBuilder(), V = L.getLocal("x"), $ = L.i32_add(L.getLocal("x"), L.i32_const(s)), X = L.i32_add(L.getLocal("x"), L.i32_const(2 * s)), M = L.getLocal("r"), y = L.i32_add(L.getLocal("r"), L.i32_const(s)), v = L.i32_add(L.getLocal("r"), L.i32_const(2 * s));
|
|
3048
3048
|
f.addCode(
|
|
3049
|
-
L.call(i + "_copy", V,
|
|
3049
|
+
L.call(i + "_copy", V, M),
|
|
3050
3050
|
L.call(i + "_copy", $, y),
|
|
3051
3051
|
L.call(i + "_copy", X, v)
|
|
3052
3052
|
);
|
|
@@ -3074,11 +3074,11 @@ var ta = function(t, n, e, i) {
|
|
|
3074
3074
|
function x() {
|
|
3075
3075
|
const f = t.addFunction(e + "_eq");
|
|
3076
3076
|
f.addParam("x", "i32"), f.addParam("y", "i32"), f.setReturnType("i32");
|
|
3077
|
-
const L = f.getCodeBuilder(), V = L.getLocal("x"), $ = L.i32_add(L.getLocal("x"), L.i32_const(s)), X = L.i32_add(L.getLocal("x"), L.i32_const(2 * s)),
|
|
3077
|
+
const L = f.getCodeBuilder(), V = L.getLocal("x"), $ = L.i32_add(L.getLocal("x"), L.i32_const(s)), X = L.i32_add(L.getLocal("x"), L.i32_const(2 * s)), M = L.getLocal("y"), y = L.i32_add(L.getLocal("y"), L.i32_const(s)), v = L.i32_add(L.getLocal("y"), L.i32_const(2 * s));
|
|
3078
3078
|
f.addCode(
|
|
3079
3079
|
L.i32_and(
|
|
3080
3080
|
L.i32_and(
|
|
3081
|
-
L.call(i + "_eq", V,
|
|
3081
|
+
L.call(i + "_eq", V, M),
|
|
3082
3082
|
L.call(i + "_eq", $, y)
|
|
3083
3083
|
),
|
|
3084
3084
|
L.call(i + "_eq", X, v)
|
|
@@ -3102,7 +3102,7 @@ var ta = function(t, n, e, i) {
|
|
|
3102
3102
|
function T() {
|
|
3103
3103
|
const f = t.addFunction(e + "_inverse");
|
|
3104
3104
|
f.addParam("x", "i32"), f.addParam("r", "i32");
|
|
3105
|
-
const L = f.getCodeBuilder(), V = L.getLocal("x"), $ = L.i32_add(L.getLocal("x"), L.i32_const(s)), X = L.i32_add(L.getLocal("x"), L.i32_const(2 * s)),
|
|
3105
|
+
const L = f.getCodeBuilder(), V = L.getLocal("x"), $ = L.i32_add(L.getLocal("x"), L.i32_const(s)), X = L.i32_add(L.getLocal("x"), L.i32_const(2 * s)), M = L.getLocal("r"), y = L.i32_add(L.getLocal("r"), L.i32_const(s)), v = L.i32_add(L.getLocal("r"), L.i32_const(2 * s)), D = L.i32_const(t.alloc(s)), it = L.i32_const(t.alloc(s)), nt = L.i32_const(t.alloc(s)), K = L.i32_const(t.alloc(s)), ct = L.i32_const(t.alloc(s)), J = L.i32_const(t.alloc(s)), st = L.i32_const(t.alloc(s)), At = L.i32_const(t.alloc(s)), Bt = L.i32_const(t.alloc(s)), pt = L.i32_const(t.alloc(s)), p = L.i32_const(t.alloc(s));
|
|
3106
3106
|
f.addCode(
|
|
3107
3107
|
L.call(i + "_square", V, D),
|
|
3108
3108
|
L.call(i + "_square", $, it),
|
|
@@ -3122,7 +3122,7 @@ var ta = function(t, n, e, i) {
|
|
|
3122
3122
|
L.call(i + "_mul", V, st, p),
|
|
3123
3123
|
L.call(i + "_add", p, pt, pt),
|
|
3124
3124
|
L.call(i + "_inverse", pt, pt),
|
|
3125
|
-
L.call(i + "_mul", pt, st,
|
|
3125
|
+
L.call(i + "_mul", pt, st, M),
|
|
3126
3126
|
L.call(i + "_mul", pt, At, y),
|
|
3127
3127
|
L.call(i + "_mul", pt, Bt, v)
|
|
3128
3128
|
);
|
|
@@ -4322,7 +4322,7 @@ var na = function(t, n, e, i) {
|
|
|
4322
4322
|
a.call(n + "_add", a.getLocal("p1"), m, a.getLocal("pr"))
|
|
4323
4323
|
);
|
|
4324
4324
|
}
|
|
4325
|
-
function
|
|
4325
|
+
function M() {
|
|
4326
4326
|
const p = t.addFunction(n + "_subMixed");
|
|
4327
4327
|
p.addParam("p1", "i32"), p.addParam("p2", "i32"), p.addParam("pr", "i32");
|
|
4328
4328
|
const a = p.getCodeBuilder(), m = a.i32_const(t.alloc(d * 3));
|
|
@@ -4640,7 +4640,7 @@ var na = function(t, n, e, i) {
|
|
|
4640
4640
|
)
|
|
4641
4641
|
);
|
|
4642
4642
|
}
|
|
4643
|
-
return b(), r(), B(), C(), l(), u(), it(), z(), O(), A(), E(), P(), L(), f(), F(), $(), V(), y(),
|
|
4643
|
+
return b(), r(), B(), C(), l(), u(), it(), z(), O(), A(), E(), P(), L(), f(), F(), $(), V(), y(), M(), X(), rt(), T(), ot(), x(), D(), Bt(), pt(), nt(), v(), K(), J(), ct(), st(), At(), kn(t, n + "_batchLEMtoU", n + "_LEMtoU", d * 2, d * 2), kn(t, n + "_batchLEMtoC", n + "_LEMtoC", d * 2, d), kn(t, n + "_batchUtoLEM", n + "_UtoLEM", d * 2, d * 2), kn(t, n + "_batchCtoLEM", n + "_CtoLEM", d, d * 2, !0), kn(t, n + "_batchToJacobian", n + "_toJacobian", d * 2, d * 3, !0), To(t, n, n + "_multiexp", n + "_add", d * 3), To(t, n, n + "_multiexpAffine", n + "_addMixed", d * 2), zo(
|
|
4644
4644
|
t,
|
|
4645
4645
|
n + "_timesScalar",
|
|
4646
4646
|
d * 3,
|
|
@@ -4700,10 +4700,10 @@ var ea = function(t, n, e, i, s) {
|
|
|
4700
4700
|
m & 1 << w && (c = c | 128 >> w);
|
|
4701
4701
|
return c;
|
|
4702
4702
|
}
|
|
4703
|
-
const
|
|
4703
|
+
const M = Array(256);
|
|
4704
4704
|
for (let m = 0; m < 256; m++)
|
|
4705
|
-
|
|
4706
|
-
const y = t.alloc(
|
|
4705
|
+
M[m] = X(m);
|
|
4706
|
+
const y = t.alloc(M);
|
|
4707
4707
|
function v() {
|
|
4708
4708
|
const m = t.addFunction(n + "__log2");
|
|
4709
4709
|
m.addParam("n", "i32"), m.setReturnType("i32"), m.addLocal("bits", "i32"), m.addLocal("aux", "i32");
|
|
@@ -6083,7 +6083,7 @@ var ea = function(t, n, e, i, s) {
|
|
|
6083
6083
|
))
|
|
6084
6084
|
), t.exportFunction(n);
|
|
6085
6085
|
};
|
|
6086
|
-
const xt = mn, ss = yo, ls = Wi, Do = Xi, rs = ta, ko = na,
|
|
6086
|
+
const xt = mn, ss = yo, ls = Wi, Do = Xi, rs = ta, ko = na, qe = ea, ds = oa, us = ia, Gn = aa, { bitLength: _s, modInv: gs, isOdd: No, isNegative: fs } = Yt;
|
|
6087
6087
|
var hs = function(t, n) {
|
|
6088
6088
|
const e = n || "bn128";
|
|
6089
6089
|
if (t.modules[e])
|
|
@@ -6091,7 +6091,7 @@ var hs = function(t, n) {
|
|
|
6091
6091
|
const i = 21888242871839275222246405745257275088696311157297823662689037894645226208583n, s = 21888242871839275222246405745257275088548364400416034343698204186575808495617n, d = Math.floor((_s(i - 1n) - 1) / 64) + 1, r = d * 8, b = r, u = r, l = u * 2, C = u * 12, B = t.alloc(xt.bigInt2BytesLE(s, b)), A = ss(t, i, "f1m");
|
|
6092
6092
|
ls(t, s, "fr", "frm");
|
|
6093
6093
|
const O = t.alloc(xt.bigInt2BytesLE(T(3n), u)), P = ko(t, "g1m", "f1m", O);
|
|
6094
|
-
|
|
6094
|
+
qe(t, "frm", "frm", "frm", "frm_mul"), ds(t, "pol", "frm"), us(t, "qap", "frm");
|
|
6095
6095
|
const E = Do(t, "f1m_neg", "f2m", "f1m"), z = t.alloc([
|
|
6096
6096
|
...xt.bigInt2BytesLE(T(19485874751759354771024239261021720505790618469301721065564631296452457478373n), u),
|
|
6097
6097
|
...xt.bigInt2BytesLE(T(266929791119991161246907387137283842545076965332900288569378510910307636690n), u)
|
|
@@ -6099,19 +6099,19 @@ var hs = function(t, n) {
|
|
|
6099
6099
|
function ot(G, _) {
|
|
6100
6100
|
const g = t.addFunction(G);
|
|
6101
6101
|
g.addParam("pG", "i32"), g.addParam("pFr", "i32"), g.addParam("pr", "i32");
|
|
6102
|
-
const
|
|
6102
|
+
const Q = g.getCodeBuilder(), R = Q.i32_const(t.alloc(r));
|
|
6103
6103
|
g.addCode(
|
|
6104
|
-
|
|
6105
|
-
|
|
6104
|
+
Q.call("frm_fromMontgomery", Q.getLocal("pFr"), R),
|
|
6105
|
+
Q.call(
|
|
6106
6106
|
_,
|
|
6107
|
-
|
|
6107
|
+
Q.getLocal("pG"),
|
|
6108
6108
|
R,
|
|
6109
|
-
|
|
6110
|
-
|
|
6109
|
+
Q.i32_const(r),
|
|
6110
|
+
Q.getLocal("pr")
|
|
6111
6111
|
)
|
|
6112
6112
|
), t.exportFunction(G);
|
|
6113
6113
|
}
|
|
6114
|
-
ot("g1m_timesFr", "g1m_timesScalar"),
|
|
6114
|
+
ot("g1m_timesFr", "g1m_timesScalar"), qe(t, "g1m", "g1m", "frm", "g1m_timesFr"), ot("g2m_timesFr", "g2m_timesScalar"), qe(t, "g2m", "g2m", "frm", "g2m_timesFr"), ot("g1m_timesFrAffine", "g1m_timesScalarAffine"), ot("g2m_timesFrAffine", "g2m_timesScalarAffine"), Gn(t, "frm_batchApplyKey", "fmr", "frm", r, r, r, "frm_mul"), Gn(t, "g1m_batchApplyKey", "g1m", "frm", r * 3, r * 3, r, "g1m_timesFr"), Gn(t, "g1m_batchApplyKeyMixed", "g1m", "frm", r * 2, r * 3, r, "g1m_timesFrAffine"), Gn(t, "g2m_batchApplyKey", "g2m", "frm", r * 2 * 3, r * 3 * 2, r, "g2m_timesFr"), Gn(t, "g2m_batchApplyKeyMixed", "g2m", "frm", r * 2 * 2, r * 3 * 2, r, "g2m_timesFrAffine");
|
|
6115
6115
|
function T(G) {
|
|
6116
6116
|
return BigInt(G) * (1n << BigInt(u * 8)) % i;
|
|
6117
6117
|
}
|
|
@@ -6170,7 +6170,7 @@ var hs = function(t, n) {
|
|
|
6170
6170
|
0n,
|
|
6171
6171
|
0n
|
|
6172
6172
|
]
|
|
6173
|
-
],
|
|
6173
|
+
], M = t.alloc(
|
|
6174
6174
|
[
|
|
6175
6175
|
...xt.bigInt2BytesLE(T(X[0][0]), u),
|
|
6176
6176
|
...xt.bigInt2BytesLE(T(X[0][1]), u),
|
|
@@ -6248,7 +6248,7 @@ var hs = function(t, n) {
|
|
|
6248
6248
|
pG1zero: L,
|
|
6249
6249
|
pG1b: O,
|
|
6250
6250
|
pG2gen: $,
|
|
6251
|
-
pG2zero:
|
|
6251
|
+
pG2zero: M,
|
|
6252
6252
|
pG2b: z,
|
|
6253
6253
|
pq: t.modules.f1m.pq,
|
|
6254
6254
|
pr: B,
|
|
@@ -6264,8 +6264,8 @@ var hs = function(t, n) {
|
|
|
6264
6264
|
const g = [];
|
|
6265
6265
|
for (; _ > 0n; ) {
|
|
6266
6266
|
if (No(_)) {
|
|
6267
|
-
const
|
|
6268
|
-
g.push(
|
|
6267
|
+
const Q = 2 - Number(_ % 4n);
|
|
6268
|
+
g.push(Q), _ = _ - BigInt(Q);
|
|
6269
6269
|
} else
|
|
6270
6270
|
g.push(0);
|
|
6271
6271
|
_ = _ >> 1n;
|
|
@@ -6291,13 +6291,13 @@ var hs = function(t, n) {
|
|
|
6291
6291
|
function at() {
|
|
6292
6292
|
const G = t.addFunction(e + "_prepAddStep");
|
|
6293
6293
|
G.addParam("pQ", "i32"), G.addParam("pR", "i32"), G.addParam("pCoef", "i32");
|
|
6294
|
-
const _ = G.getCodeBuilder(), g = _.getLocal("pQ"),
|
|
6294
|
+
const _ = G.getCodeBuilder(), g = _.getLocal("pQ"), Q = _.i32_add(_.getLocal("pQ"), _.i32_const(l)), R = _.getLocal("pR"), q = _.i32_add(_.getLocal("pR"), _.i32_const(l)), k = _.i32_add(_.getLocal("pR"), _.i32_const(2 * l)), U = _.getLocal("pCoef"), j = _.i32_add(_.getLocal("pCoef"), _.i32_const(l)), Y = _.i32_add(_.getLocal("pCoef"), _.i32_const(2 * l)), Z = j, H = _.i32_const(t.alloc(l)), et = _.i32_const(t.alloc(l)), ft = _.i32_const(t.alloc(l)), _t = _.i32_const(t.alloc(l)), lt = _.i32_const(t.alloc(l)), bt = _.i32_const(t.alloc(l)), mt = _.i32_const(t.alloc(l));
|
|
6295
6295
|
G.addCode(
|
|
6296
6296
|
// D = X1 - X2*Z1
|
|
6297
6297
|
_.call(E + "_mul", g, k, Z),
|
|
6298
6298
|
_.call(E + "_sub", R, Z, Z),
|
|
6299
6299
|
// E = Y1 - Y2*Z1
|
|
6300
|
-
_.call(E + "_mul",
|
|
6300
|
+
_.call(E + "_mul", Q, k, H),
|
|
6301
6301
|
_.call(E + "_sub", q, H, H),
|
|
6302
6302
|
// F = D^2
|
|
6303
6303
|
_.call(E + "_square", Z, et),
|
|
@@ -6322,7 +6322,7 @@ var hs = function(t, n) {
|
|
|
6322
6322
|
// Z3 (Z1) = Z1*H
|
|
6323
6323
|
_.call(E + "_mul", k, _t, k),
|
|
6324
6324
|
// ell_0 = xi * (E * X2 - D * Y2)
|
|
6325
|
-
_.call(E + "_mul", Z,
|
|
6325
|
+
_.call(E + "_mul", Z, Q, mt),
|
|
6326
6326
|
_.call(E + "_mul", H, g, U),
|
|
6327
6327
|
_.call(E + "_sub", U, mt, U),
|
|
6328
6328
|
_.call(E + "_mul", U, _.i32_const(it), U),
|
|
@@ -6335,13 +6335,13 @@ var hs = function(t, n) {
|
|
|
6335
6335
|
function It() {
|
|
6336
6336
|
const G = t.addFunction(e + "_prepDblStep");
|
|
6337
6337
|
G.addParam("pR", "i32"), G.addParam("pCoef", "i32");
|
|
6338
|
-
const _ = G.getCodeBuilder(), g = _.getLocal("pR"),
|
|
6338
|
+
const _ = G.getCodeBuilder(), g = _.getLocal("pR"), Q = _.i32_add(_.getLocal("pR"), _.i32_const(l)), R = _.i32_add(_.getLocal("pR"), _.i32_const(2 * l)), q = _.getLocal("pCoef"), k = _.i32_add(_.getLocal("pCoef"), _.i32_const(l)), U = _.i32_add(_.getLocal("pCoef"), _.i32_const(2 * l)), j = _.i32_const(t.alloc(l)), Y = _.i32_const(t.alloc(l)), Z = _.i32_const(t.alloc(l)), H = _.i32_const(t.alloc(l)), et = _.i32_const(t.alloc(l)), ft = _.i32_const(t.alloc(l)), _t = _.i32_const(t.alloc(l)), lt = _.i32_const(t.alloc(l)), bt = _.i32_const(t.alloc(l)), mt = _.i32_const(t.alloc(l)), Ot = _.i32_const(t.alloc(l)), Ct = _.i32_const(t.alloc(l));
|
|
6339
6339
|
G.addCode(
|
|
6340
6340
|
// A = X1 * Y1 / 2
|
|
6341
|
-
_.call(E + "_mul",
|
|
6341
|
+
_.call(E + "_mul", Q, _.i32_const(D), j),
|
|
6342
6342
|
_.call(E + "_mul", g, j, j),
|
|
6343
6343
|
// B = Y1^2
|
|
6344
|
-
_.call(E + "_square",
|
|
6344
|
+
_.call(E + "_square", Q, Y),
|
|
6345
6345
|
// C = Z1^2
|
|
6346
6346
|
_.call(E + "_square", R, Z),
|
|
6347
6347
|
// D = 3 * C
|
|
@@ -6357,7 +6357,7 @@ var hs = function(t, n) {
|
|
|
6357
6357
|
_.call(E + "_mul", _t, _.i32_const(D), _t),
|
|
6358
6358
|
// H = (Y1+Z1)^2-(B+C)
|
|
6359
6359
|
_.call(E + "_add", Y, Z, Ct),
|
|
6360
|
-
_.call(E + "_add",
|
|
6360
|
+
_.call(E + "_add", Q, R, lt),
|
|
6361
6361
|
_.call(E + "_square", lt, lt),
|
|
6362
6362
|
_.call(E + "_sub", lt, Ct, lt),
|
|
6363
6363
|
// I = E-B
|
|
@@ -6372,8 +6372,8 @@ var hs = function(t, n) {
|
|
|
6372
6372
|
// Y3 (Y1) = G^2 - 3*E^2
|
|
6373
6373
|
_.call(E + "_add", Ot, Ot, Ct),
|
|
6374
6374
|
_.call(E + "_add", Ot, Ct, Ct),
|
|
6375
|
-
_.call(E + "_square", _t,
|
|
6376
|
-
_.call(E + "_sub",
|
|
6375
|
+
_.call(E + "_square", _t, Q),
|
|
6376
|
+
_.call(E + "_sub", Q, Ct, Q),
|
|
6377
6377
|
// Z3 (Z1) = B * H
|
|
6378
6378
|
_.call(E + "_mul", Y, lt, R),
|
|
6379
6379
|
// ell_0 = xi * I
|
|
@@ -6388,7 +6388,7 @@ var hs = function(t, n) {
|
|
|
6388
6388
|
function ut() {
|
|
6389
6389
|
const G = t.addFunction(e + "_mulByQ");
|
|
6390
6390
|
G.addParam("p1", "i32"), G.addParam("pr", "i32");
|
|
6391
|
-
const _ = G.getCodeBuilder(), g = _.getLocal("p1"),
|
|
6391
|
+
const _ = G.getCodeBuilder(), g = _.getLocal("p1"), Q = _.i32_add(_.getLocal("p1"), _.i32_const(l)), R = _.i32_add(_.getLocal("p1"), _.i32_const(l * 2)), q = _.getLocal("pr"), k = _.i32_add(_.getLocal("pr"), _.i32_const(l)), U = _.i32_add(_.getLocal("pr"), _.i32_const(l * 2)), j = _.i32_const(t.alloc([
|
|
6392
6392
|
...xt.bigInt2BytesLE(T("21575463638280843010398324269430826099269044274347216827212613867836435027261"), u),
|
|
6393
6393
|
...xt.bigInt2BytesLE(T("10307601595873709700152284273816112264069230130616436755625194854815875713954"), u)
|
|
6394
6394
|
])), Y = _.i32_const(t.alloc([
|
|
@@ -6399,7 +6399,7 @@ var hs = function(t, n) {
|
|
|
6399
6399
|
// The frobeniusMap(1) in this field, is the conjugate
|
|
6400
6400
|
_.call(E + "_conjugate", g, q),
|
|
6401
6401
|
_.call(E + "_mul", j, q, q),
|
|
6402
|
-
_.call(E + "_conjugate",
|
|
6402
|
+
_.call(E + "_conjugate", Q, k),
|
|
6403
6403
|
_.call(E + "_mul", Y, k, k),
|
|
6404
6404
|
_.call(E + "_conjugate", R, U)
|
|
6405
6405
|
);
|
|
@@ -6408,7 +6408,7 @@ var hs = function(t, n) {
|
|
|
6408
6408
|
ut();
|
|
6409
6409
|
const G = t.addFunction(e + "_prepareG2");
|
|
6410
6410
|
G.addParam("pQ", "i32"), G.addParam("ppreQ", "i32"), G.addLocal("pCoef", "i32"), G.addLocal("i", "i32");
|
|
6411
|
-
const _ = G.getCodeBuilder(), g = _.getLocal("pQ"),
|
|
6411
|
+
const _ = G.getCodeBuilder(), g = _.getLocal("pQ"), Q = t.alloc(l * 3), R = _.i32_const(Q), q = _.i32_const(Q), k = _.i32_const(Q + l), U = _.i32_const(Q + 2 * l), j = _.i32_add(_.getLocal("ppreQ"), _.i32_const(0)), Y = _.i32_add(_.getLocal("ppreQ"), _.i32_const(l)), Z = t.alloc(l * 3), H = _.i32_const(Z), et = t.alloc(l * 3), ft = _.i32_const(et), _t = _.i32_const(et + l);
|
|
6412
6412
|
G.addCode(
|
|
6413
6413
|
_.call(x + "_normalize", g, j),
|
|
6414
6414
|
// TODO Remove if already in affine
|
|
@@ -6446,11 +6446,11 @@ var hs = function(t, n) {
|
|
|
6446
6446
|
function St() {
|
|
6447
6447
|
const G = t.addFunction(e + "__mulBy024Old");
|
|
6448
6448
|
G.addParam("pEll0", "i32"), G.addParam("pEllVW", "i32"), G.addParam("pEllVV", "i32"), G.addParam("pR", "i32");
|
|
6449
|
-
const _ = G.getCodeBuilder(), g = _.getLocal("pEll0"),
|
|
6449
|
+
const _ = G.getCodeBuilder(), g = _.getLocal("pEll0"), Q = _.getLocal("pEllVV"), R = _.getLocal("pEllVW"), q = _.getLocal("pR"), k = t.alloc(C), U = _.i32_const(k), j = _.i32_const(k), Y = _.i32_const(k + l), Z = _.i32_const(k + l * 2), H = _.i32_const(k + l * 3), et = _.i32_const(k + l * 4), ft = _.i32_const(k + l * 5);
|
|
6450
6450
|
G.addCode(
|
|
6451
6451
|
_.call(E + "_copy", g, j),
|
|
6452
6452
|
_.call(E + "_zero", Y),
|
|
6453
|
-
_.call(E + "_copy",
|
|
6453
|
+
_.call(E + "_copy", Q, Z),
|
|
6454
6454
|
_.call(E + "_zero", H),
|
|
6455
6455
|
_.call(E + "_copy", R, et),
|
|
6456
6456
|
_.call(E + "_zero", ft),
|
|
@@ -6460,12 +6460,12 @@ var hs = function(t, n) {
|
|
|
6460
6460
|
function gt() {
|
|
6461
6461
|
const G = t.addFunction(e + "__mulBy024");
|
|
6462
6462
|
G.addParam("pEll0", "i32"), G.addParam("pEllVW", "i32"), G.addParam("pEllVV", "i32"), G.addParam("pR", "i32");
|
|
6463
|
-
const _ = G.getCodeBuilder(), g = _.getLocal("pEll0"),
|
|
6463
|
+
const _ = G.getCodeBuilder(), g = _.getLocal("pEll0"), Q = _.getLocal("pEllVV"), R = _.getLocal("pEllVW"), q = _.getLocal("pR"), k = _.i32_add(_.getLocal("pR"), _.i32_const(2 * r)), U = _.i32_add(_.getLocal("pR"), _.i32_const(4 * r)), j = _.i32_add(_.getLocal("pR"), _.i32_const(6 * r)), Y = _.i32_add(_.getLocal("pR"), _.i32_const(8 * r)), Z = _.i32_add(_.getLocal("pR"), _.i32_const(10 * r)), H = _.i32_const(t.alloc(l)), et = _.i32_const(t.alloc(l)), ft = _.i32_const(t.alloc(l)), _t = _.i32_const(t.alloc(l)), lt = _.i32_const(t.alloc(l)), bt = _.i32_const(t.alloc(l)), mt = _.i32_const(t.alloc(l)), Ot = _.i32_const(t.alloc(l)), Ct = _.i32_const(t.alloc(l)), wt = _.i32_const(t.alloc(l)), ht = _.i32_const(t.alloc(l));
|
|
6464
6464
|
G.addCode(
|
|
6465
6465
|
// D0 = z0 * x0;
|
|
6466
6466
|
_.call(E + "_mul", q, g, mt),
|
|
6467
6467
|
// D2 = z2 * x2;
|
|
6468
|
-
_.call(E + "_mul", U,
|
|
6468
|
+
_.call(E + "_mul", U, Q, Ot),
|
|
6469
6469
|
// D4 = z4 * x4;
|
|
6470
6470
|
_.call(E + "_mul", Y, R, Ct),
|
|
6471
6471
|
// t2 = z0 + z4;
|
|
@@ -6477,7 +6477,7 @@ var hs = function(t, n) {
|
|
|
6477
6477
|
_.call(E + "_add", _t, Z, _t),
|
|
6478
6478
|
// For z.a_.a_ = z0.
|
|
6479
6479
|
// S1 = z1 * x2;
|
|
6480
|
-
_.call(E + "_mul", k,
|
|
6480
|
+
_.call(E + "_mul", k, Q, wt),
|
|
6481
6481
|
// T3 = S1 + D4;
|
|
6482
6482
|
_.call(E + "_add", wt, Ct, lt),
|
|
6483
6483
|
// T4 = my_Fp6::non_residue * T3 + D0;
|
|
@@ -6502,7 +6502,7 @@ var hs = function(t, n) {
|
|
|
6502
6502
|
// z1 = T4;
|
|
6503
6503
|
// For z.a_.c_ = z2
|
|
6504
6504
|
// t0 = x0 + x2;
|
|
6505
|
-
_.call(E + "_add", g,
|
|
6505
|
+
_.call(E + "_add", g, Q, H),
|
|
6506
6506
|
// T3 = t1 * t0 - D0 - D2;
|
|
6507
6507
|
_.call(E + "_mul", et, H, lt),
|
|
6508
6508
|
_.call(E + "_add", mt, Ot, ht),
|
|
@@ -6518,7 +6518,7 @@ var hs = function(t, n) {
|
|
|
6518
6518
|
// z2 = T3;
|
|
6519
6519
|
_.call(E + "_add", lt, bt, U),
|
|
6520
6520
|
// t1 = x2 + x4;
|
|
6521
|
-
_.call(E + "_add",
|
|
6521
|
+
_.call(E + "_add", Q, R, et),
|
|
6522
6522
|
// T3 = t0 * t1 - D2 - D4;
|
|
6523
6523
|
_.call(E + "_mul", et, H, lt),
|
|
6524
6524
|
_.call(E + "_add", Ot, Ct, ht),
|
|
@@ -6534,7 +6534,7 @@ var hs = function(t, n) {
|
|
|
6534
6534
|
// z3 = T4;
|
|
6535
6535
|
// For z.b_.b_ = z4
|
|
6536
6536
|
// T3 = z5 * x2;
|
|
6537
|
-
_.call(E + "_mul", Z,
|
|
6537
|
+
_.call(E + "_mul", Z, Q, lt),
|
|
6538
6538
|
// S1 = S1 + T3;
|
|
6539
6539
|
_.call(E + "_add", wt, lt, wt),
|
|
6540
6540
|
// T4 = my_Fp6::non_residue * T3;
|
|
@@ -6550,7 +6550,7 @@ var hs = function(t, n) {
|
|
|
6550
6550
|
// z4 = T4;
|
|
6551
6551
|
// For z.b_.c_ = z5.
|
|
6552
6552
|
// t0 = x0 + x2 + x4;
|
|
6553
|
-
_.call(E + "_add", g,
|
|
6553
|
+
_.call(E + "_add", g, Q, H),
|
|
6554
6554
|
_.call(E + "_add", H, R, H),
|
|
6555
6555
|
// T3 = s0 * t0 - S1;
|
|
6556
6556
|
_.call(E + "_mul", _t, H, lt),
|
|
@@ -6561,21 +6561,21 @@ var hs = function(t, n) {
|
|
|
6561
6561
|
function dt() {
|
|
6562
6562
|
const G = t.addFunction(e + "_millerLoop");
|
|
6563
6563
|
G.addParam("ppreP", "i32"), G.addParam("ppreQ", "i32"), G.addParam("r", "i32"), G.addLocal("pCoef", "i32"), G.addLocal("i", "i32");
|
|
6564
|
-
const _ = G.getCodeBuilder(), g = _.getLocal("ppreP"),
|
|
6564
|
+
const _ = G.getCodeBuilder(), g = _.getLocal("ppreP"), Q = _.i32_add(_.getLocal("ppreP"), _.i32_const(u)), R = _.getLocal("pCoef"), q = _.i32_add(_.getLocal("pCoef"), _.i32_const(l)), k = _.i32_add(_.getLocal("pCoef"), _.i32_const(2 * l)), U = t.alloc(l), j = _.i32_const(U), Y = t.alloc(l), Z = _.i32_const(Y), H = _.getLocal("r");
|
|
6565
6565
|
G.addCode(
|
|
6566
6566
|
_.call(st + "_one", H),
|
|
6567
6567
|
_.setLocal("pCoef", _.i32_add(_.getLocal("ppreQ"), _.i32_const(l * 3))),
|
|
6568
6568
|
_.setLocal("i", _.i32_const(Bt.length - 2)),
|
|
6569
6569
|
_.block(_.loop(
|
|
6570
6570
|
_.call(st + "_square", H, H),
|
|
6571
|
-
_.call(E + "_mul1", q,
|
|
6571
|
+
_.call(E + "_mul1", q, Q, j),
|
|
6572
6572
|
_.call(E + "_mul1", k, g, Z),
|
|
6573
6573
|
_.call(e + "__mulBy024", R, j, Z, H),
|
|
6574
6574
|
_.setLocal("pCoef", _.i32_add(_.getLocal("pCoef"), _.i32_const(p))),
|
|
6575
6575
|
_.if(
|
|
6576
6576
|
_.i32_load8_s(_.getLocal("i"), pt),
|
|
6577
6577
|
[
|
|
6578
|
-
..._.call(E + "_mul1", q,
|
|
6578
|
+
..._.call(E + "_mul1", q, Q, j),
|
|
6579
6579
|
..._.call(E + "_mul1", k, g, Z),
|
|
6580
6580
|
..._.call(e + "__mulBy024", R, j, Z, H),
|
|
6581
6581
|
..._.setLocal("pCoef", _.i32_add(_.getLocal("pCoef"), _.i32_const(p)))
|
|
@@ -6586,11 +6586,11 @@ var hs = function(t, n) {
|
|
|
6586
6586
|
_.br(0)
|
|
6587
6587
|
))
|
|
6588
6588
|
), G.addCode(
|
|
6589
|
-
_.call(E + "_mul1", q,
|
|
6589
|
+
_.call(E + "_mul1", q, Q, j),
|
|
6590
6590
|
_.call(E + "_mul1", k, g, Z),
|
|
6591
6591
|
_.call(e + "__mulBy024", R, j, Z, H),
|
|
6592
6592
|
_.setLocal("pCoef", _.i32_add(_.getLocal("pCoef"), _.i32_const(p))),
|
|
6593
|
-
_.call(E + "_mul1", q,
|
|
6593
|
+
_.call(E + "_mul1", q, Q, j),
|
|
6594
6594
|
_.call(E + "_mul1", k, g, Z),
|
|
6595
6595
|
_.call(e + "__mulBy024", R, j, Z, H),
|
|
6596
6596
|
_.setLocal("pCoef", _.i32_add(_.getLocal("pCoef"), _.i32_const(p)))
|
|
@@ -6651,19 +6651,19 @@ var hs = function(t, n) {
|
|
|
6651
6651
|
[21888242871839275220042445260109153167277707414472061641714758635765020556616n, 0n],
|
|
6652
6652
|
[13981852324922362344252311234282257507216387789820983642040889267519694726527n, 7629828391165209371577384193250820201684255241773809077146787135900891633097n]
|
|
6653
6653
|
]
|
|
6654
|
-
],
|
|
6655
|
-
|
|
6656
|
-
const R =
|
|
6654
|
+
], Q = t.addFunction(e + "__frobeniusMap" + G);
|
|
6655
|
+
Q.addParam("x", "i32"), Q.addParam("r", "i32");
|
|
6656
|
+
const R = Q.getCodeBuilder();
|
|
6657
6657
|
for (let k = 0; k < 6; k++) {
|
|
6658
6658
|
const U = k == 0 ? R.getLocal("x") : R.i32_add(R.getLocal("x"), R.i32_const(k * l)), j = U, Y = R.i32_add(R.getLocal("x"), R.i32_const(k * l + u)), Z = k == 0 ? R.getLocal("r") : R.i32_add(R.getLocal("r"), R.i32_const(k * l)), H = Z, et = R.i32_add(R.getLocal("r"), R.i32_const(k * l + u)), ft = q(_[Math.floor(k / 3)][G % 12], g[k % 3][G % 6]), _t = t.alloc([
|
|
6659
6659
|
...xt.bigInt2BytesLE(T(ft[0]), 32),
|
|
6660
6660
|
...xt.bigInt2BytesLE(T(ft[1]), 32)
|
|
6661
6661
|
]);
|
|
6662
|
-
G % 2 == 1 ?
|
|
6662
|
+
G % 2 == 1 ? Q.addCode(
|
|
6663
6663
|
R.call(A + "_copy", j, H),
|
|
6664
6664
|
R.call(A + "_neg", Y, et),
|
|
6665
6665
|
R.call(E + "_mul", Z, R.i32_const(_t), Z)
|
|
6666
|
-
) :
|
|
6666
|
+
) : Q.addCode(R.call(E + "_mul", U, R.i32_const(_t), Z));
|
|
6667
6667
|
}
|
|
6668
6668
|
function q(k, U) {
|
|
6669
6669
|
const j = BigInt(k[0]), Y = BigInt(k[1]), Z = BigInt(U[0]), H = BigInt(U[1]), et = [
|
|
@@ -6676,10 +6676,10 @@ var hs = function(t, n) {
|
|
|
6676
6676
|
function vt() {
|
|
6677
6677
|
const G = t.addFunction(e + "__finalExponentiationFirstChunk");
|
|
6678
6678
|
G.addParam("x", "i32"), G.addParam("r", "i32");
|
|
6679
|
-
const _ = G.getCodeBuilder(), g = _.getLocal("x"),
|
|
6679
|
+
const _ = G.getCodeBuilder(), g = _.getLocal("x"), Q = g, R = _.i32_add(g, _.i32_const(r * 6)), q = _.getLocal("r"), k = t.alloc(C), U = _.i32_const(k), j = U, Y = _.i32_const(k + r * 6), Z = _.i32_const(t.alloc(C)), H = _.i32_const(t.alloc(C)), et = _.i32_const(t.alloc(C));
|
|
6680
6680
|
G.addCode(
|
|
6681
6681
|
// const alt_bn128_Fq12 A = alt_bn128_Fq12(elt.c0,-elt.c1);
|
|
6682
|
-
_.call(ct + "_copy",
|
|
6682
|
+
_.call(ct + "_copy", Q, j),
|
|
6683
6683
|
_.call(ct + "_neg", R, Y),
|
|
6684
6684
|
// const alt_bn128_Fq12 B = elt.inverse();
|
|
6685
6685
|
_.call(st + "_inverse", g, Z),
|
|
@@ -6694,7 +6694,7 @@ var hs = function(t, n) {
|
|
|
6694
6694
|
function Ut() {
|
|
6695
6695
|
const G = t.addFunction(e + "__cyclotomicSquare");
|
|
6696
6696
|
G.addParam("x", "i32"), G.addParam("r", "i32");
|
|
6697
|
-
const _ = G.getCodeBuilder(), g = _.getLocal("x"),
|
|
6697
|
+
const _ = G.getCodeBuilder(), g = _.getLocal("x"), Q = _.i32_add(_.getLocal("x"), _.i32_const(l)), R = _.i32_add(_.getLocal("x"), _.i32_const(2 * l)), q = _.i32_add(_.getLocal("x"), _.i32_const(3 * l)), k = _.i32_add(_.getLocal("x"), _.i32_const(4 * l)), U = _.i32_add(_.getLocal("x"), _.i32_const(5 * l)), j = _.getLocal("r"), Y = _.i32_add(_.getLocal("r"), _.i32_const(l)), Z = _.i32_add(_.getLocal("r"), _.i32_const(2 * l)), H = _.i32_add(_.getLocal("r"), _.i32_const(3 * l)), et = _.i32_add(_.getLocal("r"), _.i32_const(4 * l)), ft = _.i32_add(_.getLocal("r"), _.i32_const(5 * l)), _t = _.i32_const(t.alloc(l)), lt = _.i32_const(t.alloc(l)), bt = _.i32_const(t.alloc(l)), mt = _.i32_const(t.alloc(l)), Ot = _.i32_const(t.alloc(l)), Ct = _.i32_const(t.alloc(l)), wt = _.i32_const(t.alloc(l)), ht = _.i32_const(t.alloc(l));
|
|
6698
6698
|
G.addCode(
|
|
6699
6699
|
// // t0 + t1*y = (z0 + z1*y)^2 = a^2
|
|
6700
6700
|
// tmp = z0 * z1;
|
|
@@ -6726,10 +6726,10 @@ var hs = function(t, n) {
|
|
|
6726
6726
|
// tmp = z4 * z5;
|
|
6727
6727
|
// t4 = (z4 + z5) * (z4 + my_Fp6::non_residue * z5) - tmp - my_Fp6::non_residue * tmp;
|
|
6728
6728
|
// t5 = tmp + tmp;
|
|
6729
|
-
_.call(E + "_mul",
|
|
6729
|
+
_.call(E + "_mul", Q, U, wt),
|
|
6730
6730
|
_.call(E + "_mul", U, _.i32_const(v), Ot),
|
|
6731
|
-
_.call(E + "_add",
|
|
6732
|
-
_.call(E + "_add",
|
|
6731
|
+
_.call(E + "_add", Q, Ot, Ot),
|
|
6732
|
+
_.call(E + "_add", Q, U, ht),
|
|
6733
6733
|
_.call(E + "_mul", ht, Ot, Ot),
|
|
6734
6734
|
_.call(E + "_mul", _.i32_const(v), wt, ht),
|
|
6735
6735
|
_.call(E + "_add", wt, ht, ht),
|
|
@@ -6756,7 +6756,7 @@ var hs = function(t, n) {
|
|
|
6756
6756
|
_.call(E + "_add", Ot, Z, Z),
|
|
6757
6757
|
// For C
|
|
6758
6758
|
// z4 = 3 * t2 - 2 * z4
|
|
6759
|
-
_.call(E + "_sub", bt,
|
|
6759
|
+
_.call(E + "_sub", bt, Q, Y),
|
|
6760
6760
|
_.call(E + "_add", Y, Y, Y),
|
|
6761
6761
|
_.call(E + "_add", bt, Y, Y),
|
|
6762
6762
|
// z5 = 3 * t3 + 2 * z5
|
|
@@ -6766,14 +6766,14 @@ var hs = function(t, n) {
|
|
|
6766
6766
|
);
|
|
6767
6767
|
}
|
|
6768
6768
|
function Vt(G, _) {
|
|
6769
|
-
const g = S(G).map((Y) => Y == -1 ? 255 : Y),
|
|
6769
|
+
const g = S(G).map((Y) => Y == -1 ? 255 : Y), Q = t.alloc(g), R = t.addFunction(e + "__cyclotomicExp_" + _);
|
|
6770
6770
|
R.addParam("x", "i32"), R.addParam("r", "i32"), R.addLocal("bit", "i32"), R.addLocal("i", "i32");
|
|
6771
6771
|
const q = R.getCodeBuilder(), k = q.getLocal("x"), U = q.getLocal("r"), j = q.i32_const(t.alloc(C));
|
|
6772
6772
|
R.addCode(
|
|
6773
6773
|
q.call(st + "_conjugate", k, j),
|
|
6774
6774
|
q.call(st + "_one", U),
|
|
6775
6775
|
q.if(
|
|
6776
|
-
q.teeLocal("bit", q.i32_load8_s(q.i32_const(g.length - 1),
|
|
6776
|
+
q.teeLocal("bit", q.i32_load8_s(q.i32_const(g.length - 1), Q)),
|
|
6777
6777
|
q.if(
|
|
6778
6778
|
q.i32_eq(
|
|
6779
6779
|
q.getLocal("bit"),
|
|
@@ -6787,7 +6787,7 @@ var hs = function(t, n) {
|
|
|
6787
6787
|
q.block(q.loop(
|
|
6788
6788
|
q.call(e + "__cyclotomicSquare", U, U),
|
|
6789
6789
|
q.if(
|
|
6790
|
-
q.teeLocal("bit", q.i32_load8_s(q.getLocal("i"),
|
|
6790
|
+
q.teeLocal("bit", q.i32_load8_s(q.getLocal("i"), Q)),
|
|
6791
6791
|
q.if(
|
|
6792
6792
|
q.i32_eq(
|
|
6793
6793
|
q.getLocal("bit"),
|
|
@@ -6807,7 +6807,7 @@ var hs = function(t, n) {
|
|
|
6807
6807
|
Ut(), Vt(h, "w0");
|
|
6808
6808
|
const G = t.addFunction(e + "__finalExponentiationLastChunk");
|
|
6809
6809
|
G.addParam("x", "i32"), G.addParam("r", "i32");
|
|
6810
|
-
const _ = G.getCodeBuilder(), g = _.getLocal("x"),
|
|
6810
|
+
const _ = G.getCodeBuilder(), g = _.getLocal("x"), Q = _.getLocal("r"), R = _.i32_const(t.alloc(C)), q = _.i32_const(t.alloc(C)), k = _.i32_const(t.alloc(C)), U = _.i32_const(t.alloc(C)), j = _.i32_const(t.alloc(C)), Y = _.i32_const(t.alloc(C)), Z = _.i32_const(t.alloc(C)), H = _.i32_const(t.alloc(C)), et = _.i32_const(t.alloc(C)), ft = _.i32_const(t.alloc(C)), _t = _.i32_const(t.alloc(C)), lt = _.i32_const(t.alloc(C)), bt = _.i32_const(t.alloc(C)), mt = _.i32_const(t.alloc(C)), Ot = _.i32_const(t.alloc(C)), Ct = _.i32_const(t.alloc(C)), wt = _.i32_const(t.alloc(C)), ht = _.i32_const(t.alloc(C)), qt = _.i32_const(t.alloc(C)), Ht = _.i32_const(t.alloc(C)), Wt = _.i32_const(t.alloc(C));
|
|
6811
6811
|
G.addCode(
|
|
6812
6812
|
// A = exp_by_neg_z(elt) // = elt^(-z)
|
|
6813
6813
|
_.call(e + "__cyclotomicExp_w0", g, R),
|
|
@@ -6855,7 +6855,7 @@ var hs = function(t, n) {
|
|
|
6855
6855
|
// U = T.Frobenius_map(3) // = elt^(q^3(12*z^3 + 6*z^2 + 4*z - 1))
|
|
6856
6856
|
_.call(e + "__frobeniusMap3", Ht, Wt),
|
|
6857
6857
|
// V = U * R // = elt^(q^3(12*z^3 + 6*z^2 + 4*z - 1) + q^2 * (12*z^3 + 6*z^2 + 6*z) + q*(12*z^3 + 6*z^2 + 4*z) * (12*z^3 + 12*z^2 + 6*z + 1))
|
|
6858
|
-
_.call(st + "_mul", Wt, ht,
|
|
6858
|
+
_.call(st + "_mul", Wt, ht, Q)
|
|
6859
6859
|
// result = V
|
|
6860
6860
|
);
|
|
6861
6861
|
}
|
|
@@ -6863,18 +6863,18 @@ var hs = function(t, n) {
|
|
|
6863
6863
|
vt(), Dt();
|
|
6864
6864
|
const G = t.addFunction(e + "_finalExponentiation");
|
|
6865
6865
|
G.addParam("x", "i32"), G.addParam("r", "i32");
|
|
6866
|
-
const _ = G.getCodeBuilder(), g = _.getLocal("x"),
|
|
6866
|
+
const _ = G.getCodeBuilder(), g = _.getLocal("x"), Q = _.getLocal("r"), R = _.i32_const(t.alloc(C));
|
|
6867
6867
|
G.addCode(
|
|
6868
6868
|
_.call(e + "__finalExponentiationFirstChunk", g, R),
|
|
6869
|
-
_.call(e + "__finalExponentiationLastChunk", R,
|
|
6869
|
+
_.call(e + "__finalExponentiationLastChunk", R, Q)
|
|
6870
6870
|
);
|
|
6871
6871
|
}
|
|
6872
6872
|
function zt() {
|
|
6873
6873
|
const G = t.addFunction(e + "_finalExponentiationOld");
|
|
6874
6874
|
G.addParam("x", "i32"), G.addParam("r", "i32");
|
|
6875
|
-
const g = t.alloc(xt.bigInt2BytesLE(552484233613224096312617126783173147097382103762957654188882734314196910839907541213974502761540629817009608548654680343627701153829446747810907373256841551006201639677726139946029199968412598804882391702273019083653272047566316584365559776493027495458238373902875937659943504873220554161550525926302303331747463515644711876653177129578303191095900909191624817826566688241804408081892785725967931714097716709526092261278071952560171111444072049229123565057483750161460024353346284167282452756217662335528813519139808291170539072125381230815729071544861602750936964829313608137325426383735122175229541155376346436093930287402089517426973178917569713384748081827255472576937471496195752727188261435633271238710131736096299798168852925540549342330775279877006784354801422249722573783561685179618816480037695005515426162362431072245638324744480n, 352)),
|
|
6875
|
+
const g = t.alloc(xt.bigInt2BytesLE(552484233613224096312617126783173147097382103762957654188882734314196910839907541213974502761540629817009608548654680343627701153829446747810907373256841551006201639677726139946029199968412598804882391702273019083653272047566316584365559776493027495458238373902875937659943504873220554161550525926302303331747463515644711876653177129578303191095900909191624817826566688241804408081892785725967931714097716709526092261278071952560171111444072049229123565057483750161460024353346284167282452756217662335528813519139808291170539072125381230815729071544861602750936964829313608137325426383735122175229541155376346436093930287402089517426973178917569713384748081827255472576937471496195752727188261435633271238710131736096299798168852925540549342330775279877006784354801422249722573783561685179618816480037695005515426162362431072245638324744480n, 352)), Q = G.getCodeBuilder();
|
|
6876
6876
|
G.addCode(
|
|
6877
|
-
|
|
6877
|
+
Q.call(st + "_exp", Q.getLocal("x"), Q.i32_const(g), Q.i32_const(352), Q.getLocal("r"))
|
|
6878
6878
|
);
|
|
6879
6879
|
}
|
|
6880
6880
|
const Nt = t.alloc(w), Kt = t.alloc(I);
|
|
@@ -6883,11 +6883,11 @@ var hs = function(t, n) {
|
|
|
6883
6883
|
for (let q = 0; q < G; q++)
|
|
6884
6884
|
_.addParam("p_" + q, "i32"), _.addParam("q_" + q, "i32");
|
|
6885
6885
|
_.addParam("c", "i32"), _.setReturnType("i32");
|
|
6886
|
-
const g = _.getCodeBuilder(),
|
|
6887
|
-
_.addCode(g.call(st + "_one",
|
|
6886
|
+
const g = _.getCodeBuilder(), Q = g.i32_const(t.alloc(C)), R = g.i32_const(t.alloc(C));
|
|
6887
|
+
_.addCode(g.call(st + "_one", Q));
|
|
6888
6888
|
for (let q = 0; q < G; q++)
|
|
6889
|
-
_.addCode(g.call(e + "_prepareG1", g.getLocal("p_" + q), g.i32_const(Nt))), _.addCode(g.call(e + "_prepareG2", g.getLocal("q_" + q), g.i32_const(Kt))), _.addCode(g.call(e + "_millerLoop", g.i32_const(Nt), g.i32_const(Kt), R)), _.addCode(g.call(st + "_mul",
|
|
6890
|
-
_.addCode(g.call(e + "_finalExponentiation",
|
|
6889
|
+
_.addCode(g.call(e + "_prepareG1", g.getLocal("p_" + q), g.i32_const(Nt))), _.addCode(g.call(e + "_prepareG2", g.getLocal("q_" + q), g.i32_const(Kt))), _.addCode(g.call(e + "_millerLoop", g.i32_const(Nt), g.i32_const(Kt), R)), _.addCode(g.call(st + "_mul", Q, R, Q));
|
|
6890
|
+
_.addCode(g.call(e + "_finalExponentiation", Q, Q)), _.addCode(g.call(st + "_eq", Q, g.getLocal("c")));
|
|
6891
6891
|
}
|
|
6892
6892
|
function Zt() {
|
|
6893
6893
|
const G = t.addFunction(e + "_pairing");
|
|
@@ -6903,7 +6903,7 @@ var hs = function(t, n) {
|
|
|
6903
6903
|
en(G), t.exportFunction(e + "_pairingEq" + G);
|
|
6904
6904
|
Zt(), t.exportFunction(e + "_pairing"), t.exportFunction(e + "_prepareG1"), t.exportFunction(e + "_prepareG2"), t.exportFunction(e + "_millerLoop"), t.exportFunction(e + "_finalExponentiation"), t.exportFunction(e + "_finalExponentiationOld"), t.exportFunction(e + "__mulBy024"), t.exportFunction(e + "__mulBy024Old"), t.exportFunction(e + "__cyclotomicSquare"), t.exportFunction(e + "__cyclotomicExp_w0");
|
|
6905
6905
|
};
|
|
6906
|
-
const Et = mn, ps = yo, Ls = Wi, Go = Xi, As = ta, Ko = na,
|
|
6906
|
+
const Et = mn, ps = yo, Ls = Wi, Go = Xi, As = ta, Ko = na, Me = ea, bs = oa, ys = ia, Kn = aa, { bitLength: Ho, isOdd: Vo, isNegative: Is } = Yt;
|
|
6907
6907
|
var Cs = function(t, n) {
|
|
6908
6908
|
const e = n || "bls12381";
|
|
6909
6909
|
if (t.modules[e])
|
|
@@ -6911,16 +6911,16 @@ var Cs = function(t, n) {
|
|
|
6911
6911
|
const i = 0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaabn, s = 0x73eda753299d7d483339d80809a1d80553bda402fffe5bfeffffffff00000001n, d = Math.floor((Ho(i - 1n) - 1) / 64) + 1, r = d * 8, b = r, u = b * 2, l = b * 12, C = Math.floor((Ho(s - 1n) - 1) / 64) + 1, B = C * 8, A = B, O = t.alloc(Et.bigInt2BytesLE(s, A)), P = ps(t, i, "f1m", "intq");
|
|
6912
6912
|
Ls(t, s, "fr", "frm", "intr");
|
|
6913
6913
|
const E = t.alloc(Et.bigInt2BytesLE(F(4n), b)), z = Ko(t, "g1m", "f1m", E);
|
|
6914
|
-
|
|
6914
|
+
Me(t, "frm", "frm", "frm", "frm_mul"), bs(t, "pol", "frm"), ys(t, "qap", "frm");
|
|
6915
6915
|
const x = Go(t, "f1m_neg", "f2m", "f1m"), ot = t.alloc([
|
|
6916
6916
|
...Et.bigInt2BytesLE(F(4n), b),
|
|
6917
6917
|
...Et.bigInt2BytesLE(F(4n), b)
|
|
6918
6918
|
]), T = Ko(t, "g2m", "f2m", ot);
|
|
6919
6919
|
function rt(_, g) {
|
|
6920
|
-
const
|
|
6921
|
-
|
|
6922
|
-
const R =
|
|
6923
|
-
|
|
6920
|
+
const Q = t.addFunction(_);
|
|
6921
|
+
Q.addParam("pG", "i32"), Q.addParam("pFr", "i32"), Q.addParam("pr", "i32");
|
|
6922
|
+
const R = Q.getCodeBuilder(), q = R.i32_const(t.alloc(B));
|
|
6923
|
+
Q.addCode(
|
|
6924
6924
|
R.call("frm_fromMontgomery", R.getLocal("pFr"), q),
|
|
6925
6925
|
R.call(
|
|
6926
6926
|
g,
|
|
@@ -6931,7 +6931,7 @@ var Cs = function(t, n) {
|
|
|
6931
6931
|
)
|
|
6932
6932
|
), t.exportFunction(_);
|
|
6933
6933
|
}
|
|
6934
|
-
rt("g1m_timesFr", "g1m_timesScalar"),
|
|
6934
|
+
rt("g1m_timesFr", "g1m_timesScalar"), Me(t, "g1m", "g1m", "frm", "g1m_timesFr"), rt("g2m_timesFr", "g2m_timesScalar"), Me(t, "g2m", "g2m", "frm", "g2m_timesFr"), rt("g1m_timesFrAffine", "g1m_timesScalarAffine"), rt("g2m_timesFrAffine", "g2m_timesScalarAffine"), Kn(t, "frm_batchApplyKey", "fmr", "frm", B, B, B, "frm_mul"), Kn(t, "g1m_batchApplyKey", "g1m", "frm", r * 3, r * 3, B, "g1m_timesFr"), Kn(t, "g1m_batchApplyKeyMixed", "g1m", "frm", r * 2, r * 3, B, "g1m_timesFrAffine"), Kn(t, "g2m_batchApplyKey", "g2m", "frm", r * 2 * 3, r * 3 * 2, B, "g2m_timesFr"), Kn(t, "g2m_batchApplyKeyMixed", "g2m", "frm", r * 2 * 2, r * 3 * 2, B, "g2m_timesFrAffine");
|
|
6935
6935
|
function F(_) {
|
|
6936
6936
|
return BigInt(_) * (1n << BigInt(b * 8)) % i;
|
|
6937
6937
|
}
|
|
@@ -6968,7 +6968,7 @@ var Cs = function(t, n) {
|
|
|
6968
6968
|
1n,
|
|
6969
6969
|
0n
|
|
6970
6970
|
]
|
|
6971
|
-
],
|
|
6971
|
+
], M = t.alloc(
|
|
6972
6972
|
[
|
|
6973
6973
|
...Et.bigInt2BytesLE(F(X[0][0]), b),
|
|
6974
6974
|
...Et.bigInt2BytesLE(F(X[0][1]), b),
|
|
@@ -7019,11 +7019,11 @@ var Cs = function(t, n) {
|
|
|
7019
7019
|
function nt() {
|
|
7020
7020
|
const _ = t.addFunction(x + "_mulNR");
|
|
7021
7021
|
_.addParam("x", "i32"), _.addParam("pr", "i32");
|
|
7022
|
-
const g = _.getCodeBuilder(),
|
|
7022
|
+
const g = _.getCodeBuilder(), Q = g.i32_const(t.alloc(b)), R = g.getLocal("x"), q = g.i32_add(g.getLocal("x"), g.i32_const(b)), k = g.getLocal("pr"), U = g.i32_add(g.getLocal("pr"), g.i32_const(b));
|
|
7023
7023
|
_.addCode(
|
|
7024
|
-
g.call(P + "_copy", R,
|
|
7024
|
+
g.call(P + "_copy", R, Q),
|
|
7025
7025
|
g.call(P + "_sub", R, q, k),
|
|
7026
|
-
g.call(P + "_add",
|
|
7026
|
+
g.call(P + "_add", Q, q, U)
|
|
7027
7027
|
);
|
|
7028
7028
|
}
|
|
7029
7029
|
nt();
|
|
@@ -7031,12 +7031,12 @@ var Cs = function(t, n) {
|
|
|
7031
7031
|
function ct() {
|
|
7032
7032
|
const _ = t.addFunction(K + "_mulNR");
|
|
7033
7033
|
_.addParam("x", "i32"), _.addParam("pr", "i32");
|
|
7034
|
-
const g = _.getCodeBuilder(),
|
|
7034
|
+
const g = _.getCodeBuilder(), Q = g.i32_const(t.alloc(b * 2));
|
|
7035
7035
|
_.addCode(
|
|
7036
7036
|
g.call(
|
|
7037
7037
|
x + "_copy",
|
|
7038
7038
|
g.getLocal("x"),
|
|
7039
|
-
|
|
7039
|
+
Q
|
|
7040
7040
|
),
|
|
7041
7041
|
g.call(
|
|
7042
7042
|
x + "_mulNR",
|
|
@@ -7050,7 +7050,7 @@ var Cs = function(t, n) {
|
|
|
7050
7050
|
),
|
|
7051
7051
|
g.call(
|
|
7052
7052
|
x + "_copy",
|
|
7053
|
-
|
|
7053
|
+
Q,
|
|
7054
7054
|
g.i32_add(g.getLocal("pr"), g.i32_const(r * 2))
|
|
7055
7055
|
)
|
|
7056
7056
|
);
|
|
@@ -7065,7 +7065,7 @@ var Cs = function(t, n) {
|
|
|
7065
7065
|
pG1gen: L,
|
|
7066
7066
|
pG1zero: $,
|
|
7067
7067
|
pG1b: E,
|
|
7068
|
-
pG2gen:
|
|
7068
|
+
pG2gen: M,
|
|
7069
7069
|
pG2zero: v,
|
|
7070
7070
|
pG2b: ot,
|
|
7071
7071
|
pq: t.modules.f1m.pq,
|
|
@@ -7078,23 +7078,23 @@ var Cs = function(t, n) {
|
|
|
7078
7078
|
};
|
|
7079
7079
|
function S(_) {
|
|
7080
7080
|
let g = _;
|
|
7081
|
-
const
|
|
7081
|
+
const Q = [];
|
|
7082
7082
|
for (; g > 0n; ) {
|
|
7083
7083
|
if (Vo(g)) {
|
|
7084
7084
|
const R = 2 - Number(g % 4n);
|
|
7085
|
-
|
|
7085
|
+
Q.push(R), g = g - BigInt(R);
|
|
7086
7086
|
} else
|
|
7087
|
-
|
|
7087
|
+
Q.push(0);
|
|
7088
7088
|
g = g >> 1n;
|
|
7089
7089
|
}
|
|
7090
|
-
return
|
|
7090
|
+
return Q;
|
|
7091
7091
|
}
|
|
7092
7092
|
function W(_) {
|
|
7093
7093
|
let g = _;
|
|
7094
|
-
const
|
|
7094
|
+
const Q = [];
|
|
7095
7095
|
for (; g > 0n; )
|
|
7096
|
-
Vo(g) ?
|
|
7097
|
-
return
|
|
7096
|
+
Vo(g) ? Q.push(1) : Q.push(0), g = g >> 1n;
|
|
7097
|
+
return Q;
|
|
7098
7098
|
}
|
|
7099
7099
|
function N() {
|
|
7100
7100
|
const _ = t.addFunction(e + "_prepareG1");
|
|
@@ -7108,16 +7108,16 @@ var Cs = function(t, n) {
|
|
|
7108
7108
|
function at() {
|
|
7109
7109
|
const _ = t.addFunction(e + "_prepDblStep");
|
|
7110
7110
|
_.addParam("R", "i32"), _.addParam("r", "i32");
|
|
7111
|
-
const g = _.getCodeBuilder(),
|
|
7111
|
+
const g = _.getCodeBuilder(), Q = g.getLocal("R"), R = g.i32_add(g.getLocal("R"), g.i32_const(2 * r)), q = g.i32_add(g.getLocal("R"), g.i32_const(4 * r)), k = g.getLocal("r"), U = g.i32_add(g.getLocal("r"), g.i32_const(2 * r)), j = g.i32_add(g.getLocal("r"), g.i32_const(4 * r)), Y = g.i32_const(t.alloc(u)), Z = g.i32_const(t.alloc(u)), H = g.i32_const(t.alloc(u)), et = g.i32_const(t.alloc(u)), ft = g.i32_const(t.alloc(u));
|
|
7112
7112
|
_.addCode(
|
|
7113
7113
|
// tmp0 = r.x.square();
|
|
7114
|
-
g.call(x + "_square",
|
|
7114
|
+
g.call(x + "_square", Q, k),
|
|
7115
7115
|
// tmp1 = r.y.square();
|
|
7116
7116
|
g.call(x + "_square", R, Z),
|
|
7117
7117
|
// tmp2 = tmp1.square();
|
|
7118
7118
|
g.call(x + "_square", Z, H),
|
|
7119
7119
|
// tmp3 = (tmp1 + r.x).square() - tmp0 - tmp2;
|
|
7120
|
-
g.call(x + "_add", Z,
|
|
7120
|
+
g.call(x + "_add", Z, Q, U),
|
|
7121
7121
|
g.call(x + "_square", U, U),
|
|
7122
7122
|
g.call(x + "_sub", U, k, U),
|
|
7123
7123
|
g.call(x + "_sub", U, H, U),
|
|
@@ -7127,21 +7127,21 @@ var Cs = function(t, n) {
|
|
|
7127
7127
|
g.call(x + "_add", k, k, et),
|
|
7128
7128
|
g.call(x + "_add", et, k, et),
|
|
7129
7129
|
// tmp6 = r.x + tmp4;
|
|
7130
|
-
g.call(x + "_add",
|
|
7130
|
+
g.call(x + "_add", Q, et, j),
|
|
7131
7131
|
// tmp5 = tmp4.square();
|
|
7132
7132
|
g.call(x + "_square", et, ft),
|
|
7133
7133
|
// zsquared = r.z.square();
|
|
7134
7134
|
g.call(x + "_square", q, Y),
|
|
7135
7135
|
// r.x = tmp5 - tmp3 - tmp3;
|
|
7136
|
-
g.call(x + "_sub", ft, U,
|
|
7137
|
-
g.call(x + "_sub",
|
|
7136
|
+
g.call(x + "_sub", ft, U, Q),
|
|
7137
|
+
g.call(x + "_sub", Q, U, Q),
|
|
7138
7138
|
// r.z = (r.z + r.y).square() - tmp1 - zsquared;
|
|
7139
7139
|
g.call(x + "_add", q, R, q),
|
|
7140
7140
|
g.call(x + "_square", q, q),
|
|
7141
7141
|
g.call(x + "_sub", q, Z, q),
|
|
7142
7142
|
g.call(x + "_sub", q, Y, q),
|
|
7143
7143
|
// r.y = (tmp3 - r.x) * tmp4;
|
|
7144
|
-
g.call(x + "_sub", U,
|
|
7144
|
+
g.call(x + "_sub", U, Q, R),
|
|
7145
7145
|
g.call(x + "_mul", R, et, R),
|
|
7146
7146
|
// tmp2 = tmp2 + tmp2;
|
|
7147
7147
|
g.call(x + "_add", H, H, H),
|
|
@@ -7176,7 +7176,7 @@ var Cs = function(t, n) {
|
|
|
7176
7176
|
function It() {
|
|
7177
7177
|
const _ = t.addFunction(e + "_prepAddStep");
|
|
7178
7178
|
_.addParam("R", "i32"), _.addParam("Q", "i32"), _.addParam("r", "i32");
|
|
7179
|
-
const g = _.getCodeBuilder(),
|
|
7179
|
+
const g = _.getCodeBuilder(), Q = g.getLocal("R"), R = g.i32_add(g.getLocal("R"), g.i32_const(2 * r)), q = g.i32_add(g.getLocal("R"), g.i32_const(4 * r)), k = g.getLocal("Q"), U = g.i32_add(g.getLocal("Q"), g.i32_const(2 * r)), j = g.getLocal("r"), Y = g.i32_add(g.getLocal("r"), g.i32_const(2 * r)), Z = g.i32_add(g.getLocal("r"), g.i32_const(4 * r)), H = g.i32_const(t.alloc(u)), et = g.i32_const(t.alloc(u)), ft = g.i32_const(t.alloc(u)), _t = g.i32_const(t.alloc(u)), lt = g.i32_const(t.alloc(u)), bt = g.i32_const(t.alloc(u)), mt = g.i32_const(t.alloc(u)), Ot = g.i32_const(t.alloc(u)), Ct = g.i32_const(t.alloc(u)), wt = g.i32_const(t.alloc(u)), ht = g.i32_const(t.alloc(u));
|
|
7180
7180
|
_.addCode(
|
|
7181
7181
|
// zsquared = r.z.square();
|
|
7182
7182
|
g.call(x + "_square", q, H),
|
|
@@ -7191,7 +7191,7 @@ var Cs = function(t, n) {
|
|
|
7191
7191
|
g.call(x + "_sub", Y, H, Y),
|
|
7192
7192
|
g.call(x + "_mul", Y, H, Y),
|
|
7193
7193
|
// t2 = t0 - r.x;
|
|
7194
|
-
g.call(x + "_sub", _t,
|
|
7194
|
+
g.call(x + "_sub", _t, Q, lt),
|
|
7195
7195
|
// t3 = t2.square();
|
|
7196
7196
|
g.call(x + "_square", lt, bt),
|
|
7197
7197
|
// t4 = t3 + t3;
|
|
@@ -7206,12 +7206,12 @@ var Cs = function(t, n) {
|
|
|
7206
7206
|
// t9 = t6 * q.x;
|
|
7207
7207
|
g.call(x + "_mul", Ct, k, Z),
|
|
7208
7208
|
// t7 = t4 * r.x;
|
|
7209
|
-
g.call(x + "_mul", mt,
|
|
7209
|
+
g.call(x + "_mul", mt, Q, wt),
|
|
7210
7210
|
// r.x = t6.square() - t5 - t7 - t7;
|
|
7211
|
-
g.call(x + "_square", Ct,
|
|
7212
|
-
g.call(x + "_sub",
|
|
7213
|
-
g.call(x + "_sub",
|
|
7214
|
-
g.call(x + "_sub",
|
|
7211
|
+
g.call(x + "_square", Ct, Q),
|
|
7212
|
+
g.call(x + "_sub", Q, Ot, Q),
|
|
7213
|
+
g.call(x + "_sub", Q, wt, Q),
|
|
7214
|
+
g.call(x + "_sub", Q, wt, Q),
|
|
7215
7215
|
// r.z = (r.z + t2).square() - zsquared - t3;
|
|
7216
7216
|
g.call(x + "_add", q, lt, q),
|
|
7217
7217
|
g.call(x + "_square", q, q),
|
|
@@ -7220,7 +7220,7 @@ var Cs = function(t, n) {
|
|
|
7220
7220
|
// t10 = q.y + r.z;
|
|
7221
7221
|
g.call(x + "_add", U, q, j),
|
|
7222
7222
|
// t8 = (t7 - r.x) * t6;
|
|
7223
|
-
g.call(x + "_sub", wt,
|
|
7223
|
+
g.call(x + "_sub", wt, Q, ht),
|
|
7224
7224
|
g.call(x + "_mul", ht, Ct, ht),
|
|
7225
7225
|
// t0 = r.y * t5;
|
|
7226
7226
|
g.call(x + "_mul", R, Ot, _t),
|
|
@@ -7249,9 +7249,9 @@ var Cs = function(t, n) {
|
|
|
7249
7249
|
function ut() {
|
|
7250
7250
|
const _ = t.addFunction(e + "_prepareG2");
|
|
7251
7251
|
_.addParam("pQ", "i32"), _.addParam("ppreQ", "i32"), _.addLocal("pCoef", "i32"), _.addLocal("i", "i32");
|
|
7252
|
-
const g = _.getCodeBuilder(),
|
|
7252
|
+
const g = _.getCodeBuilder(), Q = g.getLocal("pQ"), R = t.alloc(u * 3), q = g.i32_const(R), k = g.getLocal("ppreQ");
|
|
7253
7253
|
_.addCode(
|
|
7254
|
-
g.call(T + "_normalize",
|
|
7254
|
+
g.call(T + "_normalize", Q, k),
|
|
7255
7255
|
g.if(
|
|
7256
7256
|
g.call(T + "_isZero", k),
|
|
7257
7257
|
g.ret([])
|
|
@@ -7279,9 +7279,9 @@ var Cs = function(t, n) {
|
|
|
7279
7279
|
function Lt() {
|
|
7280
7280
|
const _ = t.addFunction(K + "_mul1");
|
|
7281
7281
|
_.addParam("pA", "i32"), _.addParam("pC1", "i32"), _.addParam("pR", "i32");
|
|
7282
|
-
const g = _.getCodeBuilder(),
|
|
7282
|
+
const g = _.getCodeBuilder(), Q = g.getLocal("pA"), R = g.i32_add(g.getLocal("pA"), g.i32_const(b * 2)), q = g.i32_add(g.getLocal("pA"), g.i32_const(b * 4)), k = g.getLocal("pC1"), U = g.getLocal("pR"), j = g.i32_add(g.getLocal("pR"), g.i32_const(b * 2)), Y = g.i32_add(g.getLocal("pR"), g.i32_const(b * 4)), Z = g.i32_const(t.alloc(b * 2)), H = g.i32_const(t.alloc(b * 2));
|
|
7283
7283
|
_.addCode(
|
|
7284
|
-
g.call(x + "_add",
|
|
7284
|
+
g.call(x + "_add", Q, R, Z),
|
|
7285
7285
|
g.call(x + "_add", R, q, H),
|
|
7286
7286
|
// let b_b = self.c1 * c1;
|
|
7287
7287
|
g.call(x + "_mul", R, k, Y),
|
|
@@ -7299,14 +7299,14 @@ var Cs = function(t, n) {
|
|
|
7299
7299
|
function St() {
|
|
7300
7300
|
const _ = t.addFunction(K + "_mul01");
|
|
7301
7301
|
_.addParam("pA", "i32"), _.addParam("pC0", "i32"), _.addParam("pC1", "i32"), _.addParam("pR", "i32");
|
|
7302
|
-
const g = _.getCodeBuilder(),
|
|
7302
|
+
const g = _.getCodeBuilder(), Q = g.getLocal("pA"), R = g.i32_add(g.getLocal("pA"), g.i32_const(b * 2)), q = g.i32_add(g.getLocal("pA"), g.i32_const(b * 4)), k = g.getLocal("pC0"), U = g.getLocal("pC1"), j = g.getLocal("pR"), Y = g.i32_add(g.getLocal("pR"), g.i32_const(b * 2)), Z = g.i32_add(g.getLocal("pR"), g.i32_const(b * 4)), H = g.i32_const(t.alloc(b * 2)), et = g.i32_const(t.alloc(b * 2)), ft = g.i32_const(t.alloc(b * 2)), _t = g.i32_const(t.alloc(b * 2));
|
|
7303
7303
|
_.addCode(
|
|
7304
7304
|
// let a_a = self.c0 * c0;
|
|
7305
|
-
g.call(x + "_mul",
|
|
7305
|
+
g.call(x + "_mul", Q, k, H),
|
|
7306
7306
|
// let b_b = self.c1 * c1;
|
|
7307
7307
|
g.call(x + "_mul", R, U, et),
|
|
7308
|
-
g.call(x + "_add",
|
|
7309
|
-
g.call(x + "_add",
|
|
7308
|
+
g.call(x + "_add", Q, R, ft),
|
|
7309
|
+
g.call(x + "_add", Q, q, _t),
|
|
7310
7310
|
// let t1 = (self.c1 + self.c2) * c1 - b_b;
|
|
7311
7311
|
g.call(x + "_add", R, q, j),
|
|
7312
7312
|
g.call(x + "_mul", j, U, j),
|
|
@@ -7329,16 +7329,16 @@ var Cs = function(t, n) {
|
|
|
7329
7329
|
function gt() {
|
|
7330
7330
|
const _ = t.addFunction(J + "_mul014");
|
|
7331
7331
|
_.addParam("pA", "i32"), _.addParam("pC0", "i32"), _.addParam("pC1", "i32"), _.addParam("pC4", "i32"), _.addParam("pR", "i32");
|
|
7332
|
-
const g = _.getCodeBuilder(),
|
|
7332
|
+
const g = _.getCodeBuilder(), Q = g.getLocal("pA"), R = g.i32_add(g.getLocal("pA"), g.i32_const(b * 6)), q = g.getLocal("pC0"), k = g.getLocal("pC1"), U = g.getLocal("pC4"), j = g.i32_const(t.alloc(b * 6)), Y = g.i32_const(t.alloc(b * 6)), Z = g.i32_const(t.alloc(b * 2)), H = g.getLocal("pR"), et = g.i32_add(g.getLocal("pR"), g.i32_const(b * 6));
|
|
7333
7333
|
_.addCode(
|
|
7334
7334
|
// let aa = self.c0.mul_by_01(c0, c1);
|
|
7335
|
-
g.call(K + "_mul01",
|
|
7335
|
+
g.call(K + "_mul01", Q, q, k, j),
|
|
7336
7336
|
// let bb = self.c1.mul_by_1(c4);
|
|
7337
7337
|
g.call(K + "_mul1", R, U, Y),
|
|
7338
7338
|
// let o = c1 + c4;
|
|
7339
7339
|
g.call(x + "_add", k, U, Z),
|
|
7340
7340
|
// let c1 = self.c1 + self.c0;
|
|
7341
|
-
g.call(K + "_add", R,
|
|
7341
|
+
g.call(K + "_add", R, Q, et),
|
|
7342
7342
|
// let c1 = c1.mul_by_01(c0, &o);
|
|
7343
7343
|
g.call(K + "_mul01", et, q, Z, et),
|
|
7344
7344
|
// let c1 = c1 - aa - bb;
|
|
@@ -7356,7 +7356,7 @@ var Cs = function(t, n) {
|
|
|
7356
7356
|
function dt() {
|
|
7357
7357
|
const _ = t.addFunction(e + "_ell");
|
|
7358
7358
|
_.addParam("pP", "i32"), _.addParam("pCoefs", "i32"), _.addParam("pF", "i32");
|
|
7359
|
-
const g = _.getCodeBuilder(),
|
|
7359
|
+
const g = _.getCodeBuilder(), Q = g.getLocal("pP"), R = g.i32_add(g.getLocal("pP"), g.i32_const(r)), q = g.getLocal("pF"), k = g.getLocal("pCoefs"), U = g.i32_add(g.getLocal("pCoefs"), g.i32_const(b)), j = g.i32_add(g.getLocal("pCoefs"), g.i32_const(b * 2)), Y = g.i32_add(g.getLocal("pCoefs"), g.i32_const(b * 3)), Z = g.i32_add(g.getLocal("pCoefs"), g.i32_const(b * 4)), H = t.alloc(b * 2), et = g.i32_const(H), ft = g.i32_const(H), _t = g.i32_const(H + b), lt = t.alloc(b * 2), bt = g.i32_const(lt), mt = g.i32_const(lt), Ot = g.i32_const(lt + b);
|
|
7360
7360
|
_.addCode(
|
|
7361
7361
|
// let mut c0 = coeffs.0;
|
|
7362
7362
|
// let mut c1 = coeffs.1;
|
|
@@ -7370,8 +7370,8 @@ var Cs = function(t, n) {
|
|
|
7370
7370
|
// f.mul_by_014(&coeffs.2, &c1, &c0)
|
|
7371
7371
|
g.call(P + "_mul", k, R, ft),
|
|
7372
7372
|
g.call(P + "_mul", U, R, _t),
|
|
7373
|
-
g.call(P + "_mul", j,
|
|
7374
|
-
g.call(P + "_mul", Y,
|
|
7373
|
+
g.call(P + "_mul", j, Q, mt),
|
|
7374
|
+
g.call(P + "_mul", Y, Q, Ot),
|
|
7375
7375
|
g.call(J + "_mul014", q, Z, bt, et, q)
|
|
7376
7376
|
);
|
|
7377
7377
|
}
|
|
@@ -7379,11 +7379,11 @@ var Cs = function(t, n) {
|
|
|
7379
7379
|
function yt() {
|
|
7380
7380
|
const _ = t.addFunction(e + "_millerLoop");
|
|
7381
7381
|
_.addParam("ppreP", "i32"), _.addParam("ppreQ", "i32"), _.addParam("r", "i32"), _.addLocal("pCoef", "i32"), _.addLocal("i", "i32");
|
|
7382
|
-
const g = _.getCodeBuilder(),
|
|
7382
|
+
const g = _.getCodeBuilder(), Q = g.getLocal("ppreP"), R = g.getLocal("pCoef"), q = g.getLocal("r");
|
|
7383
7383
|
_.addCode(
|
|
7384
7384
|
g.call(J + "_one", q),
|
|
7385
7385
|
g.if(
|
|
7386
|
-
g.call(z + "_isZero",
|
|
7386
|
+
g.call(z + "_isZero", Q),
|
|
7387
7387
|
g.ret([])
|
|
7388
7388
|
),
|
|
7389
7389
|
g.if(
|
|
@@ -7393,12 +7393,12 @@ var Cs = function(t, n) {
|
|
|
7393
7393
|
g.setLocal("pCoef", g.i32_add(g.getLocal("ppreQ"), g.i32_const(u * 3))),
|
|
7394
7394
|
g.setLocal("i", g.i32_const(At.length - 2)),
|
|
7395
7395
|
g.block(g.loop(
|
|
7396
|
-
g.call(e + "_ell",
|
|
7396
|
+
g.call(e + "_ell", Q, R, q),
|
|
7397
7397
|
g.setLocal("pCoef", g.i32_add(g.getLocal("pCoef"), g.i32_const(pt))),
|
|
7398
7398
|
g.if(
|
|
7399
7399
|
g.i32_load8_s(g.getLocal("i"), Bt),
|
|
7400
7400
|
[
|
|
7401
|
-
...g.call(e + "_ell",
|
|
7401
|
+
...g.call(e + "_ell", Q, R, q),
|
|
7402
7402
|
...g.setLocal("pCoef", g.i32_add(g.getLocal("pCoef"), g.i32_const(pt)))
|
|
7403
7403
|
]
|
|
7404
7404
|
),
|
|
@@ -7407,7 +7407,7 @@ var Cs = function(t, n) {
|
|
|
7407
7407
|
g.setLocal("i", g.i32_sub(g.getLocal("i"), g.i32_const(1))),
|
|
7408
7408
|
g.br(0)
|
|
7409
7409
|
)),
|
|
7410
|
-
g.call(e + "_ell",
|
|
7410
|
+
g.call(e + "_ell", Q, R, q)
|
|
7411
7411
|
), _.addCode(
|
|
7412
7412
|
g.call(J + "_conjugate", q, q)
|
|
7413
7413
|
);
|
|
@@ -7442,7 +7442,7 @@ var Cs = function(t, n) {
|
|
|
7442
7442
|
[4002409555221667392624310435006688643935503118305586438271171395842971157480381377015405980053539358417135540939437n, 0n],
|
|
7443
7443
|
[877076961050607968509681729531255177986764537961432449499635504522207616027455086505066378536590128544573588734230n, 3125332594171059424908108096204648978570118281977575435832422631601824034463382777937621250592425535493320683825557n]
|
|
7444
7444
|
]
|
|
7445
|
-
],
|
|
7445
|
+
], Q = [
|
|
7446
7446
|
[
|
|
7447
7447
|
[1n, 0n],
|
|
7448
7448
|
[1n, 0n],
|
|
@@ -7471,7 +7471,7 @@ var Cs = function(t, n) {
|
|
|
7471
7471
|
R.addParam("x", "i32"), R.addParam("r", "i32");
|
|
7472
7472
|
const q = R.getCodeBuilder();
|
|
7473
7473
|
for (let U = 0; U < 6; U++) {
|
|
7474
|
-
const j = U == 0 ? q.getLocal("x") : q.i32_add(q.getLocal("x"), q.i32_const(U * u)), Y = j, Z = q.i32_add(q.getLocal("x"), q.i32_const(U * u + b)), H = U == 0 ? q.getLocal("r") : q.i32_add(q.getLocal("r"), q.i32_const(U * u)), et = H, ft = q.i32_add(q.getLocal("r"), q.i32_const(U * u + b)), _t = k(g[Math.floor(U / 3)][_ % 12],
|
|
7474
|
+
const j = U == 0 ? q.getLocal("x") : q.i32_add(q.getLocal("x"), q.i32_const(U * u)), Y = j, Z = q.i32_add(q.getLocal("x"), q.i32_const(U * u + b)), H = U == 0 ? q.getLocal("r") : q.i32_add(q.getLocal("r"), q.i32_const(U * u)), et = H, ft = q.i32_add(q.getLocal("r"), q.i32_const(U * u + b)), _t = k(g[Math.floor(U / 3)][_ % 12], Q[U % 3][_ % 6]), lt = t.alloc([
|
|
7475
7475
|
...Et.bigInt2BytesLE(F(_t[0]), r),
|
|
7476
7476
|
...Et.bigInt2BytesLE(F(_t[1]), r)
|
|
7477
7477
|
]);
|
|
@@ -7492,16 +7492,16 @@ var Cs = function(t, n) {
|
|
|
7492
7492
|
function Ut() {
|
|
7493
7493
|
const _ = t.addFunction(e + "__cyclotomicSquare");
|
|
7494
7494
|
_.addParam("x", "i32"), _.addParam("r", "i32");
|
|
7495
|
-
const g = _.getCodeBuilder(),
|
|
7495
|
+
const g = _.getCodeBuilder(), Q = g.getLocal("x"), R = g.i32_add(g.getLocal("x"), g.i32_const(u)), q = g.i32_add(g.getLocal("x"), g.i32_const(2 * u)), k = g.i32_add(g.getLocal("x"), g.i32_const(3 * u)), U = g.i32_add(g.getLocal("x"), g.i32_const(4 * u)), j = g.i32_add(g.getLocal("x"), g.i32_const(5 * u)), Y = g.getLocal("r"), Z = g.i32_add(g.getLocal("r"), g.i32_const(u)), H = g.i32_add(g.getLocal("r"), g.i32_const(2 * u)), et = g.i32_add(g.getLocal("r"), g.i32_const(3 * u)), ft = g.i32_add(g.getLocal("r"), g.i32_const(4 * u)), _t = g.i32_add(g.getLocal("r"), g.i32_const(5 * u)), lt = g.i32_const(t.alloc(u)), bt = g.i32_const(t.alloc(u)), mt = g.i32_const(t.alloc(u)), Ot = g.i32_const(t.alloc(u)), Ct = g.i32_const(t.alloc(u)), wt = g.i32_const(t.alloc(u)), ht = g.i32_const(t.alloc(u)), qt = g.i32_const(t.alloc(u));
|
|
7496
7496
|
_.addCode(
|
|
7497
7497
|
// // t0 + t1*y = (z0 + z1*y)^2 = a^2
|
|
7498
7498
|
// tmp = z0 * z1;
|
|
7499
7499
|
// t0 = (z0 + z1) * (z0 + my_Fp6::non_residue * z1) - tmp - my_Fp6::non_residue * tmp;
|
|
7500
7500
|
// t1 = tmp + tmp;
|
|
7501
|
-
g.call(x + "_mul",
|
|
7501
|
+
g.call(x + "_mul", Q, U, ht),
|
|
7502
7502
|
g.call(x + "_mulNR", U, lt),
|
|
7503
|
-
g.call(x + "_add",
|
|
7504
|
-
g.call(x + "_add",
|
|
7503
|
+
g.call(x + "_add", Q, lt, lt),
|
|
7504
|
+
g.call(x + "_add", Q, U, qt),
|
|
7505
7505
|
g.call(x + "_mul", qt, lt, lt),
|
|
7506
7506
|
g.call(x + "_mulNR", ht, qt),
|
|
7507
7507
|
g.call(x + "_add", ht, qt, qt),
|
|
@@ -7535,7 +7535,7 @@ var Cs = function(t, n) {
|
|
|
7535
7535
|
g.call(x + "_add", ht, ht, wt),
|
|
7536
7536
|
// For A
|
|
7537
7537
|
// z0 = 3 * t0 - 2 * z0
|
|
7538
|
-
g.call(x + "_sub", lt,
|
|
7538
|
+
g.call(x + "_sub", lt, Q, Y),
|
|
7539
7539
|
g.call(x + "_add", Y, Y, Y),
|
|
7540
7540
|
g.call(x + "_add", lt, Y, Y),
|
|
7541
7541
|
// z1 = 3 * t1 + 2 * z1
|
|
@@ -7563,8 +7563,8 @@ var Cs = function(t, n) {
|
|
|
7563
7563
|
g.call(x + "_add", Ot, _t, _t)
|
|
7564
7564
|
);
|
|
7565
7565
|
}
|
|
7566
|
-
function Vt(_, g,
|
|
7567
|
-
const R = S(_).map((H) => H == -1 ? 255 : H), q = t.alloc(R), k = t.addFunction(e + "__cyclotomicExp_" +
|
|
7566
|
+
function Vt(_, g, Q) {
|
|
7567
|
+
const R = S(_).map((H) => H == -1 ? 255 : H), q = t.alloc(R), k = t.addFunction(e + "__cyclotomicExp_" + Q);
|
|
7568
7568
|
k.addParam("x", "i32"), k.addParam("r", "i32"), k.addLocal("bit", "i32"), k.addLocal("i", "i32");
|
|
7569
7569
|
const U = k.getCodeBuilder(), j = U.getLocal("x"), Y = U.getLocal("r"), Z = U.i32_const(t.alloc(l));
|
|
7570
7570
|
k.addCode(
|
|
@@ -7607,12 +7607,12 @@ var Cs = function(t, n) {
|
|
|
7607
7607
|
Ut(), Vt(h, I, "w0");
|
|
7608
7608
|
const _ = t.addFunction(e + "_finalExponentiation");
|
|
7609
7609
|
_.addParam("x", "i32"), _.addParam("r", "i32");
|
|
7610
|
-
const g = _.getCodeBuilder(),
|
|
7610
|
+
const g = _.getCodeBuilder(), Q = g.getLocal("x"), R = g.getLocal("r"), q = g.i32_const(t.alloc(l)), k = g.i32_const(t.alloc(l)), U = g.i32_const(t.alloc(l)), j = g.i32_const(t.alloc(l)), Y = g.i32_const(t.alloc(l)), Z = g.i32_const(t.alloc(l)), H = g.i32_const(t.alloc(l));
|
|
7611
7611
|
_.addCode(
|
|
7612
7612
|
// let mut t0 = f.frobenius_map(6)
|
|
7613
|
-
g.call(J + "_frobeniusMap6",
|
|
7613
|
+
g.call(J + "_frobeniusMap6", Q, q),
|
|
7614
7614
|
// let t1 = f.invert()
|
|
7615
|
-
g.call(J + "_inverse",
|
|
7615
|
+
g.call(J + "_inverse", Q, k),
|
|
7616
7616
|
// let mut t2 = t0 * t1;
|
|
7617
7617
|
g.call(J + "_mul", q, k, U),
|
|
7618
7618
|
// t1 = t2.clone();
|
|
@@ -7670,9 +7670,9 @@ var Cs = function(t, n) {
|
|
|
7670
7670
|
function jt() {
|
|
7671
7671
|
const _ = t.addFunction(e + "_finalExponentiationOld");
|
|
7672
7672
|
_.addParam("x", "i32"), _.addParam("r", "i32");
|
|
7673
|
-
const
|
|
7673
|
+
const Q = t.alloc(Et.bigInt2BytesLE(322277361516934140462891564586510139908379969514828494218366688025288661041104682794998680497580008899973249814104447692778988208376779573819485263026159588510513834876303014016798809919343532899164848730280942609956670917565618115867287399623286813270357901731510188149934363360381614501334086825442271920079363289954510565375378443704372994881406797882676971082200626541916413184642520269678897559532260949334760604962086348898118982248842634379637598665468817769075878555493752214492790122785850202957575200176084204422751485957336465472324810982833638490904279282696134323072515220044451592646885410572234451732790590013479358343841220074174848221722017083597872017638514103174122784843925578370430843522959600095676285723737049438346544753168912974976791528535276317256904336520179281145394686565050419250614107803233314658825463117900250701199181529205942363159325765991819433914303908860460720581408201373164047773794825411011922305820065611121544561808414055302212057471395719432072209245600258134364584636810093520285711072578721435517884103526483832733289802426157301542744476740008494780363354305116978805620671467071400711358839553375340724899735460480144599782014906586543813292157922220645089192130209334926661588737007768565838519456601560804957985667880395221049249803753582637708560n, 544)), R = _.getCodeBuilder();
|
|
7674
7674
|
_.addCode(
|
|
7675
|
-
R.call(J + "_exp", R.getLocal("x"), R.i32_const(
|
|
7675
|
+
R.call(J + "_exp", R.getLocal("x"), R.i32_const(Q), R.i32_const(544), R.getLocal("r"))
|
|
7676
7676
|
);
|
|
7677
7677
|
}
|
|
7678
7678
|
const zt = t.alloc(c), Nt = t.alloc(w);
|
|
@@ -7681,39 +7681,39 @@ var Cs = function(t, n) {
|
|
|
7681
7681
|
for (let k = 0; k < _; k++)
|
|
7682
7682
|
g.addParam("p_" + k, "i32"), g.addParam("q_" + k, "i32");
|
|
7683
7683
|
g.addParam("c", "i32"), g.setReturnType("i32");
|
|
7684
|
-
const
|
|
7685
|
-
g.addCode(
|
|
7684
|
+
const Q = g.getCodeBuilder(), R = Q.i32_const(t.alloc(l)), q = Q.i32_const(t.alloc(l));
|
|
7685
|
+
g.addCode(Q.call(J + "_one", R));
|
|
7686
7686
|
for (let k = 0; k < _; k++)
|
|
7687
|
-
g.addCode(
|
|
7688
|
-
|
|
7689
|
-
|
|
7690
|
-
|
|
7687
|
+
g.addCode(Q.call(e + "_prepareG1", Q.getLocal("p_" + k), Q.i32_const(zt))), g.addCode(Q.call(e + "_prepareG2", Q.getLocal("q_" + k), Q.i32_const(Nt))), g.addCode(
|
|
7688
|
+
Q.if(
|
|
7689
|
+
Q.i32_eqz(Q.call(z + "_inGroupAffine", Q.i32_const(zt))),
|
|
7690
|
+
Q.ret(Q.i32_const(0))
|
|
7691
7691
|
),
|
|
7692
|
-
|
|
7693
|
-
|
|
7694
|
-
|
|
7692
|
+
Q.if(
|
|
7693
|
+
Q.i32_eqz(Q.call(T + "_inGroupAffine", Q.i32_const(Nt))),
|
|
7694
|
+
Q.ret(Q.i32_const(0))
|
|
7695
7695
|
)
|
|
7696
|
-
), g.addCode(
|
|
7697
|
-
g.addCode(
|
|
7696
|
+
), g.addCode(Q.call(e + "_millerLoop", Q.i32_const(zt), Q.i32_const(Nt), q)), g.addCode(Q.call(J + "_mul", R, q, R));
|
|
7697
|
+
g.addCode(Q.call(e + "_finalExponentiation", R, R)), g.addCode(Q.call(J + "_eq", R, Q.getLocal("c")));
|
|
7698
7698
|
}
|
|
7699
7699
|
function en() {
|
|
7700
7700
|
const _ = t.addFunction(e + "_pairing");
|
|
7701
7701
|
_.addParam("p", "i32"), _.addParam("q", "i32"), _.addParam("r", "i32");
|
|
7702
|
-
const g = _.getCodeBuilder(),
|
|
7703
|
-
_.addCode(g.call(e + "_prepareG1", g.getLocal("p"), g.i32_const(zt))), _.addCode(g.call(e + "_prepareG2", g.getLocal("q"), g.i32_const(Nt))), _.addCode(g.call(e + "_millerLoop", g.i32_const(zt), g.i32_const(Nt),
|
|
7702
|
+
const g = _.getCodeBuilder(), Q = g.i32_const(t.alloc(l));
|
|
7703
|
+
_.addCode(g.call(e + "_prepareG1", g.getLocal("p"), g.i32_const(zt))), _.addCode(g.call(e + "_prepareG2", g.getLocal("q"), g.i32_const(Nt))), _.addCode(g.call(e + "_millerLoop", g.i32_const(zt), g.i32_const(Nt), Q)), _.addCode(g.call(e + "_finalExponentiation", Q, g.getLocal("r")));
|
|
7704
7704
|
}
|
|
7705
7705
|
function Zt() {
|
|
7706
7706
|
const _ = t.addFunction(T + "_inGroupAffine");
|
|
7707
7707
|
_.addParam("p", "i32"), _.setReturnType("i32");
|
|
7708
|
-
const g = _.getCodeBuilder(),
|
|
7708
|
+
const g = _.getCodeBuilder(), Q = [
|
|
7709
7709
|
2001204777610833696708894912867952078278441409969503942666029068062015825245418932221343814564507832018947136279894n,
|
|
7710
7710
|
2001204777610833696708894912867952078278441409969503942666029068062015825245418932221343814564507832018947136279893n
|
|
7711
7711
|
], R = 4002409555221667392624310435006688643935503118305586438271171395842971157480381377015405980053539358417135540939436n, q = [
|
|
7712
7712
|
2973677408986561043442465346520108879172042883009249989176415018091420807192182638567116318576472649347015917690530n,
|
|
7713
7713
|
2973677408986561043442465346520108879172042883009249989176415018091420807192182638567116318576472649347015917690530n
|
|
7714
7714
|
], k = g.i32_const(t.alloc([
|
|
7715
|
-
...Et.bigInt2BytesLE(F(
|
|
7716
|
-
...Et.bigInt2BytesLE(F(
|
|
7715
|
+
...Et.bigInt2BytesLE(F(Q[0]), r),
|
|
7716
|
+
...Et.bigInt2BytesLE(F(Q[1]), r)
|
|
7717
7717
|
])), U = g.i32_const(t.alloc(Et.bigInt2BytesLE(F(R), r))), j = g.i32_const(t.alloc([
|
|
7718
7718
|
...Et.bigInt2BytesLE(F(q[0]), r),
|
|
7719
7719
|
...Et.bigInt2BytesLE(F(q[1]), r)
|
|
@@ -7765,7 +7765,7 @@ var Cs = function(t, n) {
|
|
|
7765
7765
|
function G() {
|
|
7766
7766
|
const _ = t.addFunction(z + "_inGroupAffine");
|
|
7767
7767
|
_.addParam("p", "i32"), _.setReturnType("i32");
|
|
7768
|
-
const g = _.getCodeBuilder(),
|
|
7768
|
+
const g = _.getCodeBuilder(), Q = 4002409555221667392624310435006688643935503118305586438271171395842971157480381377015405980053539358417135540939436n, R = 793479390729215512621379701633421447060886740281060493010456487427281649075476305620758731620350n, q = (h * h - 1n) / 3n, k = g.i32_const(t.alloc(Et.bigInt2BytesLE(F(Q), r))), U = g.i32_const(t.alloc(Et.bigInt2BytesLE(F(R), r))), j = g.i32_const(t.alloc(Et.bigInt2BytesLE(q, 16))), Y = g.getLocal("p"), Z = g.i32_add(g.getLocal("p"), g.i32_const(b)), H = t.alloc(b * 3), et = g.i32_const(H), ft = g.i32_const(H), _t = g.i32_const(H + b), lt = t.alloc(b * 2), bt = g.i32_const(lt), mt = g.i32_const(lt), Ot = g.i32_const(lt + b);
|
|
7769
7769
|
_.addCode(
|
|
7770
7770
|
g.if(
|
|
7771
7771
|
g.call(z + "_isZeroAffine", g.getLocal("p")),
|
|
@@ -7804,34 +7804,34 @@ var Cs = function(t, n) {
|
|
|
7804
7804
|
Kt(_), t.exportFunction(e + "_pairingEq" + _);
|
|
7805
7805
|
en(), t.exportFunction(e + "_pairing"), t.exportFunction(e + "_prepareG1"), t.exportFunction(e + "_prepareG2"), t.exportFunction(e + "_millerLoop"), t.exportFunction(e + "_finalExponentiation"), t.exportFunction(e + "_finalExponentiationOld"), t.exportFunction(e + "__cyclotomicSquare"), t.exportFunction(e + "__cyclotomicExp_w0"), t.exportFunction(K + "_mul1"), t.exportFunction(K + "_mul01"), t.exportFunction(J + "_mul014"), t.exportFunction(z + "_inGroupAffine"), t.exportFunction(z + "_inGroup"), t.exportFunction(T + "_inGroupAffine"), t.exportFunction(T + "_inGroup");
|
|
7806
7806
|
}, ms = hs, ws = Cs;
|
|
7807
|
-
function
|
|
7807
|
+
function je(o) {
|
|
7808
7808
|
if (typeof o == "bigint" || o.eq !== void 0)
|
|
7809
7809
|
return o.toString(10);
|
|
7810
7810
|
if (o instanceof Uint8Array)
|
|
7811
7811
|
return Zn(o, 0);
|
|
7812
7812
|
if (Array.isArray(o))
|
|
7813
|
-
return o.map(
|
|
7813
|
+
return o.map(je);
|
|
7814
7814
|
if (typeof o == "object") {
|
|
7815
7815
|
const t = {};
|
|
7816
7816
|
return Object.keys(o).forEach((e) => {
|
|
7817
|
-
t[e] =
|
|
7817
|
+
t[e] = je(o[e]);
|
|
7818
7818
|
}), t;
|
|
7819
7819
|
} else
|
|
7820
7820
|
return o;
|
|
7821
7821
|
}
|
|
7822
|
-
function
|
|
7822
|
+
function $e(o) {
|
|
7823
7823
|
if (typeof o == "string" && /^[0-9]+$/.test(o))
|
|
7824
7824
|
return BigInt(o);
|
|
7825
7825
|
if (typeof o == "string" && /^0x[0-9a-fA-F]+$/.test(o))
|
|
7826
7826
|
return BigInt(o);
|
|
7827
7827
|
if (Array.isArray(o))
|
|
7828
|
-
return o.map(
|
|
7828
|
+
return o.map($e);
|
|
7829
7829
|
if (typeof o == "object") {
|
|
7830
7830
|
if (o === null)
|
|
7831
7831
|
return null;
|
|
7832
7832
|
const t = {};
|
|
7833
7833
|
return Object.keys(o).forEach((e) => {
|
|
7834
|
-
t[e] =
|
|
7834
|
+
t[e] = $e(o[e]);
|
|
7835
7835
|
}), t;
|
|
7836
7836
|
} else
|
|
7837
7837
|
return o;
|
|
@@ -7871,34 +7871,34 @@ function ca(o, t) {
|
|
|
7871
7871
|
throw new Error("Number does not fit in this length");
|
|
7872
7872
|
return e;
|
|
7873
7873
|
}
|
|
7874
|
-
function
|
|
7874
|
+
function Ye(o, t) {
|
|
7875
7875
|
if (typeof t == "bigint" || t.eq !== void 0)
|
|
7876
7876
|
return t.toString(10);
|
|
7877
7877
|
if (t instanceof Uint8Array)
|
|
7878
7878
|
return o.toString(o.e(t));
|
|
7879
7879
|
if (Array.isArray(t))
|
|
7880
|
-
return t.map(
|
|
7880
|
+
return t.map(Ye.bind(this, o));
|
|
7881
7881
|
if (typeof t == "object") {
|
|
7882
7882
|
const n = {};
|
|
7883
7883
|
return Object.keys(t).forEach((i) => {
|
|
7884
|
-
n[i] =
|
|
7884
|
+
n[i] = Ye(o, t[i]);
|
|
7885
7885
|
}), n;
|
|
7886
7886
|
} else
|
|
7887
7887
|
return t;
|
|
7888
7888
|
}
|
|
7889
|
-
function
|
|
7889
|
+
function Ze(o, t) {
|
|
7890
7890
|
if (typeof t == "string" && /^[0-9]+$/.test(t))
|
|
7891
7891
|
return o.e(t);
|
|
7892
7892
|
if (typeof t == "string" && /^0x[0-9a-fA-F]+$/.test(t))
|
|
7893
7893
|
return o.e(t);
|
|
7894
7894
|
if (Array.isArray(t))
|
|
7895
|
-
return t.map(
|
|
7895
|
+
return t.map(Ze.bind(this, o));
|
|
7896
7896
|
if (typeof t == "object") {
|
|
7897
7897
|
if (t === null)
|
|
7898
7898
|
return null;
|
|
7899
7899
|
const n = {};
|
|
7900
7900
|
return Object.keys(t).forEach((i) => {
|
|
7901
|
-
n[i] =
|
|
7901
|
+
n[i] = Ze(o, t[i]);
|
|
7902
7902
|
}), n;
|
|
7903
7903
|
} else
|
|
7904
7904
|
return t;
|
|
@@ -7953,13 +7953,13 @@ var Ss = /* @__PURE__ */ Object.freeze({
|
|
|
7953
7953
|
leBuff2int: Fs,
|
|
7954
7954
|
leInt2Buff: ca,
|
|
7955
7955
|
log2: Jt,
|
|
7956
|
-
stringifyBigInts:
|
|
7957
|
-
stringifyFElements:
|
|
7958
|
-
unstringifyBigInts:
|
|
7959
|
-
unstringifyFElements:
|
|
7956
|
+
stringifyBigInts: je,
|
|
7957
|
+
stringifyFElements: Ye,
|
|
7958
|
+
unstringifyBigInts: $e,
|
|
7959
|
+
unstringifyFElements: Ze
|
|
7960
7960
|
});
|
|
7961
7961
|
const Gt = 1 << 30;
|
|
7962
|
-
class
|
|
7962
|
+
class Mt {
|
|
7963
7963
|
constructor(t) {
|
|
7964
7964
|
this.buffers = [], this.byteLength = t;
|
|
7965
7965
|
for (let n = 0; n < t; n += Gt) {
|
|
@@ -7977,7 +7977,7 @@ class Qt {
|
|
|
7977
7977
|
const l = b + u > Gt ? Gt - b : u, C = new Uint8Array(this.buffers[r].buffer, this.buffers[r].byteOffset + b, l);
|
|
7978
7978
|
if (l == e)
|
|
7979
7979
|
return C.slice();
|
|
7980
|
-
d || (e <= Gt ? d = new Uint8Array(e) : d = new
|
|
7980
|
+
d || (e <= Gt ? d = new Uint8Array(e) : d = new Mt(e)), d.set(C, e - u), u = u - l, r++, b = 0;
|
|
7981
7981
|
}
|
|
7982
7982
|
return d;
|
|
7983
7983
|
}
|
|
@@ -7988,7 +7988,7 @@ class Qt {
|
|
|
7988
7988
|
return;
|
|
7989
7989
|
const i = Math.floor(n / Gt), s = Math.floor((n + e - 1) / Gt);
|
|
7990
7990
|
if (i == s)
|
|
7991
|
-
return t instanceof
|
|
7991
|
+
return t instanceof Mt && t.buffers.length == 1 ? this.buffers[i].set(t.buffers[0], n % Gt) : this.buffers[i].set(t, n % Gt);
|
|
7992
7992
|
let d = i, r = n % Gt, b = e;
|
|
7993
7993
|
for (; b > 0; ) {
|
|
7994
7994
|
const u = r + b > Gt ? Gt - r : b, l = t.slice(e - b, e - b + u);
|
|
@@ -8022,7 +8022,7 @@ function Cn(o, t, n, e) {
|
|
|
8022
8022
|
}
|
|
8023
8023
|
const u = await Promise.all(b);
|
|
8024
8024
|
let l;
|
|
8025
|
-
s instanceof
|
|
8025
|
+
s instanceof Mt ? l = new Mt(d * e) : l = new Uint8Array(d * e);
|
|
8026
8026
|
let C = 0;
|
|
8027
8027
|
for (let B = 0; B < u.length; B++)
|
|
8028
8028
|
l.set(u[B][0], C), C += u[B][0].byteLength;
|
|
@@ -8031,16 +8031,16 @@ function Cn(o, t, n, e) {
|
|
|
8031
8031
|
}
|
|
8032
8032
|
class jo {
|
|
8033
8033
|
constructor(t, n, e, i) {
|
|
8034
|
-
if (this.tm = t, this.prefix = n, this.p = i, this.n8 = e, this.type = "F1", this.m = 1, this.half =
|
|
8034
|
+
if (this.tm = t, this.prefix = n, this.p = i, this.n8 = e, this.type = "F1", this.m = 1, this.half = Mn(i, Fn), this.bitLength = Wn(i), this.mask = _n(ge(Fn, this.bitLength), Fn), this.pOp1 = t.alloc(e), this.pOp2 = t.alloc(e), this.pOp3 = t.alloc(e), this.tm.instance.exports[n + "_zero"](this.pOp1), this.zero = this.tm.getBuff(this.pOp1, this.n8), this.tm.instance.exports[n + "_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(e / 8), this.n32 = Math.floor(e / 4), this.n64 * 8 != this.n8)
|
|
8035
8035
|
throw new Error("n8 must be a multiple of 8");
|
|
8036
|
-
this.half =
|
|
8036
|
+
this.half = Mn(this.p, Fn), this.nqr = this.two;
|
|
8037
8037
|
let s = this.exp(this.nqr, this.half);
|
|
8038
8038
|
for (; !this.eq(s, this.negone); )
|
|
8039
8039
|
this.nqr = this.add(this.nqr, this.one), s = this.exp(this.nqr, this.half);
|
|
8040
8040
|
this.shift = this.mul(this.nqr, this.nqr), this.shiftInv = this.inv(this.shift), this.s = 0;
|
|
8041
8041
|
let d = _n(this.p, Fn);
|
|
8042
8042
|
for (; !_o(d); )
|
|
8043
|
-
this.s = this.s + 1, d =
|
|
8043
|
+
this.s = this.s + 1, d = Mn(d, Fn);
|
|
8044
8044
|
this.w = [], this.w[this.s] = this.exp(this.nqr, d);
|
|
8045
8045
|
for (let r = this.s - 1; r >= 0; r--)
|
|
8046
8046
|
this.w[r] = this.square(this.w[r + 1]);
|
|
@@ -8109,7 +8109,7 @@ class jo {
|
|
|
8109
8109
|
if (t instanceof Uint8Array)
|
|
8110
8110
|
return t;
|
|
8111
8111
|
let e = Tt(t, n);
|
|
8112
|
-
|
|
8112
|
+
Mi(e) ? (e = Ti(e), Ve(e, this.p) && (e = an(e, this.p)), e = _n(this.p, e)) : Ve(e, this.p) && (e = an(e, this.p));
|
|
8113
8113
|
const i = ca(e, this.n8);
|
|
8114
8114
|
return this.toMontgomery(i);
|
|
8115
8115
|
}
|
|
@@ -8185,7 +8185,7 @@ class jo {
|
|
|
8185
8185
|
}
|
|
8186
8186
|
const b = await Promise.all(r);
|
|
8187
8187
|
let u;
|
|
8188
|
-
t instanceof
|
|
8188
|
+
t instanceof Mt ? u = new Mt(s * i) : u = new Uint8Array(s * i);
|
|
8189
8189
|
let l = 0;
|
|
8190
8190
|
for (let C = 0; C < b.length; C++)
|
|
8191
8191
|
u.set(b[C][0], l), l += b[C][0].byteLength;
|
|
@@ -8714,7 +8714,7 @@ class Zo {
|
|
|
8714
8714
|
function Ps(o) {
|
|
8715
8715
|
return new Promise((t) => setTimeout(t, o));
|
|
8716
8716
|
}
|
|
8717
|
-
let
|
|
8717
|
+
let Je;
|
|
8718
8718
|
const Jo = `(function thread(self) {
|
|
8719
8719
|
const MAXMEM = 32767;
|
|
8720
8720
|
let instance;
|
|
@@ -8837,11 +8837,11 @@ const Jo = `(function thread(self) {
|
|
|
8837
8837
|
})(self)`;
|
|
8838
8838
|
if (globalThis?.Blob) {
|
|
8839
8839
|
const o = new TextEncoder().encode(Jo), t = new Blob([o], { type: "application/javascript" });
|
|
8840
|
-
|
|
8840
|
+
Je = URL.createObjectURL(t);
|
|
8841
8841
|
} else
|
|
8842
|
-
|
|
8842
|
+
Je = "data:application/javascript;base64," + globalThis.btoa(Jo);
|
|
8843
8843
|
async function qs(o, t) {
|
|
8844
|
-
const n = new
|
|
8844
|
+
const n = new Ms();
|
|
8845
8845
|
n.memory = new WebAssembly.Memory({ initial: Qe }), n.u8 = new Uint8Array(n.memory.buffer), n.u32 = new Uint32Array(n.memory.buffer);
|
|
8846
8846
|
const e = await WebAssembly.compile(o.code);
|
|
8847
8847
|
if (n.instance = await WebAssembly.instantiate(e, {
|
|
@@ -8859,7 +8859,7 @@ async function qs(o, t) {
|
|
|
8859
8859
|
let s = 2;
|
|
8860
8860
|
typeof navigator == "object" && navigator.hardwareConcurrency && (s = navigator.hardwareConcurrency), s == 0 && (s = 2), s > 64 && (s = 64), n.concurrency = s;
|
|
8861
8861
|
for (let r = 0; r < s; r++)
|
|
8862
|
-
n.workers[r] = new Worker(
|
|
8862
|
+
n.workers[r] = new Worker(Je), n.workers[r].addEventListener("message", i(r)), n.working[r] = !1;
|
|
8863
8863
|
const d = [];
|
|
8864
8864
|
for (let r = 0; r < n.workers.length; r++) {
|
|
8865
8865
|
const b = o.code.slice();
|
|
@@ -8879,7 +8879,7 @@ async function qs(o, t) {
|
|
|
8879
8879
|
};
|
|
8880
8880
|
}
|
|
8881
8881
|
}
|
|
8882
|
-
class
|
|
8882
|
+
class Ms {
|
|
8883
8883
|
constructor() {
|
|
8884
8884
|
this.actionQueue = [], this.oldPFree = 0;
|
|
8885
8885
|
}
|
|
@@ -8943,7 +8943,7 @@ class Qs {
|
|
|
8943
8943
|
await Ps(200);
|
|
8944
8944
|
}
|
|
8945
8945
|
}
|
|
8946
|
-
function
|
|
8946
|
+
function Ue(o, t) {
|
|
8947
8947
|
const n = o[t], e = o.Fr, i = o.tm;
|
|
8948
8948
|
o[t].batchApplyKey = async function(s, d, r, b, u) {
|
|
8949
8949
|
b = b || "affine", u = u || "affine";
|
|
@@ -8990,14 +8990,14 @@ function Me(o, t) {
|
|
|
8990
8990
|
}
|
|
8991
8991
|
const ot = await Promise.all(z);
|
|
8992
8992
|
let T;
|
|
8993
|
-
s instanceof
|
|
8993
|
+
s instanceof Mt ? T = new Mt(P * O) : T = new Uint8Array(P * O);
|
|
8994
8994
|
let rt = 0;
|
|
8995
8995
|
for (let F = 0; F < ot.length; F++)
|
|
8996
8996
|
T.set(ot[F][0], rt), rt += ot[F][0].byteLength;
|
|
8997
8997
|
return T;
|
|
8998
8998
|
};
|
|
8999
8999
|
}
|
|
9000
|
-
function
|
|
9000
|
+
function Qs(o) {
|
|
9001
9001
|
const t = o.tm;
|
|
9002
9002
|
o.pairing = function(e, i) {
|
|
9003
9003
|
t.startSyncOp();
|
|
@@ -9185,7 +9185,7 @@ function Xo(o, t) {
|
|
|
9185
9185
|
return await s(r, b, "affine", u, l);
|
|
9186
9186
|
};
|
|
9187
9187
|
}
|
|
9188
|
-
function
|
|
9188
|
+
function ze(o, t) {
|
|
9189
9189
|
const n = o[t], e = o.Fr, i = n.tm;
|
|
9190
9190
|
async function s(u, l, C, B, A, O) {
|
|
9191
9191
|
C = C || "affine", B = B || "affine";
|
|
@@ -9203,7 +9203,7 @@ function Ue(o, t) {
|
|
|
9203
9203
|
}
|
|
9204
9204
|
let X;
|
|
9205
9205
|
l && (X = e.inv(e.e(V)));
|
|
9206
|
-
let
|
|
9206
|
+
let M;
|
|
9207
9207
|
la(u, E);
|
|
9208
9208
|
let y, v = Math.min(1 << P, V), D = V / v;
|
|
9209
9209
|
for (; D < i.concurrency && v >= 16; )
|
|
@@ -9255,16 +9255,16 @@ function Ue(o, t) {
|
|
|
9255
9255
|
y[p] = m[0], y[a] = m[1];
|
|
9256
9256
|
}
|
|
9257
9257
|
}
|
|
9258
|
-
if (u instanceof
|
|
9259
|
-
|
|
9258
|
+
if (u instanceof Mt ? M = new Mt(V * x) : M = new Uint8Array(V * x), l) {
|
|
9259
|
+
M.set(y[0].slice((v - 1) * x));
|
|
9260
9260
|
let K = x;
|
|
9261
9261
|
for (let ct = D - 1; ct > 0; ct--)
|
|
9262
|
-
|
|
9263
|
-
|
|
9262
|
+
M.set(y[ct], K), K += v * x, delete y[ct];
|
|
9263
|
+
M.set(y[0].slice(0, (v - 1) * x), K), delete y[0];
|
|
9264
9264
|
} else
|
|
9265
9265
|
for (let K = 0; K < D; K++)
|
|
9266
|
-
|
|
9267
|
-
return L ? he(
|
|
9266
|
+
M.set(y[K], v * x * K), delete y[K];
|
|
9267
|
+
return L ? he(M, x) : M;
|
|
9268
9268
|
}
|
|
9269
9269
|
async function d(u, l, C, B, A) {
|
|
9270
9270
|
let O, P;
|
|
@@ -9273,7 +9273,7 @@ function Ue(o, t) {
|
|
|
9273
9273
|
[O, P] = await b(O, P, "fftJoinExt", e.one, e.shift, l, "jacobian", B, A), E.push(s(O, !1, "jacobian", C, B, A)), E.push(s(P, !1, "jacobian", C, B, A));
|
|
9274
9274
|
const z = await Promise.all(E);
|
|
9275
9275
|
let x;
|
|
9276
|
-
return z[0].byteLength > 1 << 28 ? x = new
|
|
9276
|
+
return z[0].byteLength > 1 << 28 ? x = new Mt(z[0].byteLength * 2) : x = new Uint8Array(z[0].byteLength * 2), x.set(z[0]), x.set(z[1], z[0].byteLength), x;
|
|
9277
9277
|
}
|
|
9278
9278
|
async function r(u, l, C, B, A) {
|
|
9279
9279
|
let O, P;
|
|
@@ -9282,7 +9282,7 @@ function Ue(o, t) {
|
|
|
9282
9282
|
E.push(s(O, !0, l, "jacobian", B, A)), E.push(s(P, !0, l, "jacobian", B, A)), [O, P] = await Promise.all(E);
|
|
9283
9283
|
const z = await b(O, P, "fftJoinExtInv", e.one, e.shiftInv, "jacobian", C, B, A);
|
|
9284
9284
|
let x;
|
|
9285
|
-
return z[0].byteLength > 1 << 28 ? x = new
|
|
9285
|
+
return z[0].byteLength > 1 << 28 ? x = new Mt(z[0].byteLength * 2) : x = new Uint8Array(z[0].byteLength * 2), x.set(z[0]), x.set(z[1], z[0].byteLength), x;
|
|
9286
9286
|
}
|
|
9287
9287
|
async function b(u, l, C, B, A, O, P, E, z) {
|
|
9288
9288
|
let T, rt, F, f, L, V;
|
|
@@ -9301,7 +9301,7 @@ function Ue(o, t) {
|
|
|
9301
9301
|
throw new Error("Invalid number of points");
|
|
9302
9302
|
let X = Math.floor($ / i.concurrency);
|
|
9303
9303
|
X < 16 && (X = 16), X > 65536 && (X = 65536);
|
|
9304
|
-
const
|
|
9304
|
+
const M = [];
|
|
9305
9305
|
for (let nt = 0; nt < $; nt += X) {
|
|
9306
9306
|
E && E.debug(`${z}: fftJoinExt Start: ${nt}/${$}`);
|
|
9307
9307
|
const K = Math.min($ - nt, X), ct = e.mul(B, e.exp(A, nt)), J = [], st = u.slice(nt * L, (nt + K) * L), At = l.slice(nt * L, (nt + K) * L);
|
|
@@ -9312,13 +9312,13 @@ function Ue(o, t) {
|
|
|
9312
9312
|
{ var: 2 },
|
|
9313
9313
|
{ var: 3 },
|
|
9314
9314
|
{ val: e.s }
|
|
9315
|
-
] }), F && (J.push({ cmd: "CALL", fnName: F, params: [{ var: 0 }, { val: K }, { var: 0 }] }), J.push({ cmd: "CALL", fnName: F, params: [{ var: 1 }, { val: K }, { var: 1 }] })), J.push({ cmd: "GET", out: 0, var: 0, len: K * f }), J.push({ cmd: "GET", out: 1, var: 1, len: K * f }),
|
|
9315
|
+
] }), F && (J.push({ cmd: "CALL", fnName: F, params: [{ var: 0 }, { val: K }, { var: 0 }] }), J.push({ cmd: "CALL", fnName: F, params: [{ var: 1 }, { val: K }, { var: 1 }] })), J.push({ cmd: "GET", out: 0, var: 0, len: K * f }), J.push({ cmd: "GET", out: 1, var: 1, len: K * f }), M.push(
|
|
9316
9316
|
i.queueAction(J).then((Bt) => (E && E.debug(`${z}: fftJoinExt End: ${nt}/${$}`), Bt))
|
|
9317
9317
|
);
|
|
9318
9318
|
}
|
|
9319
|
-
const y = await Promise.all(
|
|
9319
|
+
const y = await Promise.all(M);
|
|
9320
9320
|
let v, D;
|
|
9321
|
-
$ * f > 1 << 28 ? (v = new
|
|
9321
|
+
$ * f > 1 << 28 ? (v = new Mt($ * f), D = new Mt($ * f)) : (v = new Uint8Array($ * f), D = new Uint8Array($ * f));
|
|
9322
9322
|
let it = 0;
|
|
9323
9323
|
for (let nt = 0; nt < y.length; nt++)
|
|
9324
9324
|
v.set(y[nt][0], it), D.set(y[nt][1], it), it += y[nt][0].byteLength;
|
|
@@ -9352,7 +9352,7 @@ function Ue(o, t) {
|
|
|
9352
9352
|
const rt = [];
|
|
9353
9353
|
rt.push(s(z, !0, "jacobian", C, B, A + " t0")), rt.push(s(x, !0, "jacobian", C, B, A + " t1")), [z, x] = await Promise.all(rt);
|
|
9354
9354
|
let F;
|
|
9355
|
-
return z.byteLength > 1 << 28 ? F = new
|
|
9355
|
+
return z.byteLength > 1 << 28 ? F = new Mt(z.byteLength * 2) : F = new Uint8Array(z.byteLength * 2), F.set(z), F.set(x, z.byteLength), F;
|
|
9356
9356
|
}, n.fftMix = async function(l) {
|
|
9357
9357
|
const C = n.F.n8 * 3;
|
|
9358
9358
|
let B, A;
|
|
@@ -9397,15 +9397,15 @@ function Ue(o, t) {
|
|
|
9397
9397
|
{ var: 3 }
|
|
9398
9398
|
] }), ct.push({ cmd: "GET", out: 0, var: 0, len: z * C }), ct.push({ cmd: "GET", out: 1, var: 1, len: z * C }), X.push(i.queueAction(ct));
|
|
9399
9399
|
}
|
|
9400
|
-
const
|
|
9400
|
+
const M = await Promise.all(X);
|
|
9401
9401
|
for (let y = 0; y < V; y++)
|
|
9402
9402
|
for (let v = 0; v < $ / 2; v++) {
|
|
9403
|
-
const D = y * $ + v, it = y * $ + v + $ / 2, nt =
|
|
9403
|
+
const D = y * $ + v, it = y * $ + v + $ / 2, nt = M.shift();
|
|
9404
9404
|
rt[D] = nt[0], rt[it] = nt[1];
|
|
9405
9405
|
}
|
|
9406
9406
|
}
|
|
9407
9407
|
let F;
|
|
9408
|
-
l instanceof
|
|
9408
|
+
l instanceof Mt ? F = new Mt(O * C) : F = new Uint8Array(O * C);
|
|
9409
9409
|
let f = 0;
|
|
9410
9410
|
for (let L = 0; L < E; L++)
|
|
9411
9411
|
F.set(rt[L], f), f += rt[L].byteLength;
|
|
@@ -9430,8 +9430,8 @@ function Ue(o, t) {
|
|
|
9430
9430
|
E <= z * 2 && (z = 1);
|
|
9431
9431
|
const x = E / z, ot = [];
|
|
9432
9432
|
for (let L = 0; L < z; L++) {
|
|
9433
|
-
const V = [], $ = e.mul(B, e.exp(A, L * x)), X = l.slice(L * x * O, (L + 1) * x * O),
|
|
9434
|
-
V.push({ cmd: "ALLOCSET", var: 0, buff: X }), V.push({ cmd: "ALLOCSET", var: 1, buff:
|
|
9433
|
+
const V = [], $ = e.mul(B, e.exp(A, L * x)), X = l.slice(L * x * O, (L + 1) * x * O), M = C.slice(L * x * O, (L + 1) * x * O);
|
|
9434
|
+
V.push({ cmd: "ALLOCSET", var: 0, buff: X }), V.push({ cmd: "ALLOCSET", var: 1, buff: M }), V.push({ cmd: "ALLOCSET", var: 2, buff: $ }), V.push({ cmd: "ALLOCSET", var: 3, buff: A }), V.push({ cmd: "CALL", fnName: P, params: [
|
|
9435
9435
|
{ var: 0 },
|
|
9436
9436
|
{ var: 1 },
|
|
9437
9437
|
{ val: x },
|
|
@@ -9443,7 +9443,7 @@ function Ue(o, t) {
|
|
|
9443
9443
|
}
|
|
9444
9444
|
const T = await Promise.all(ot);
|
|
9445
9445
|
let rt, F;
|
|
9446
|
-
l instanceof
|
|
9446
|
+
l instanceof Mt ? (rt = new Mt(E * O), F = new Mt(E * O)) : (rt = new Uint8Array(E * O), F = new Uint8Array(E * O));
|
|
9447
9447
|
let f = 0;
|
|
9448
9448
|
for (let L = 0; L < T.length; L++)
|
|
9449
9449
|
rt.set(T[L][0], f), F.set(T[L][1], f), f += T[L][0].byteLength;
|
|
@@ -9480,7 +9480,7 @@ function Ue(o, t) {
|
|
|
9480
9480
|
}
|
|
9481
9481
|
const ot = await Promise.all(x);
|
|
9482
9482
|
let T;
|
|
9483
|
-
l instanceof
|
|
9483
|
+
l instanceof Mt ? T = new Mt(E * A) : T = new Uint8Array(E * A);
|
|
9484
9484
|
let rt = 0;
|
|
9485
9485
|
for (let F = ot.length - 1; F >= 0; F--)
|
|
9486
9486
|
T.set(ot[F][0], rt), rt += ot[F][0].byteLength;
|
|
@@ -9489,7 +9489,7 @@ function Ue(o, t) {
|
|
|
9489
9489
|
}
|
|
9490
9490
|
async function ra(o) {
|
|
9491
9491
|
const t = await qs(o.wasm, o.singleThread), n = {};
|
|
9492
|
-
return n.q = Tt(o.wasm.q.toString()), n.r = Tt(o.wasm.r.toString()), n.name = o.name, n.tm = t, n.prePSize = o.wasm.prePSize, n.preQSize = o.wasm.preQSize, n.Fr = new jo(t, "frm", o.n8r, o.r), n.F1 = new jo(t, "f1m", o.n8q, o.q), n.F2 = new $o(t, "f2m", n.F1), n.G1 = new Yo(t, "g1m", n.F1, o.wasm.pG1gen, o.wasm.pG1b, o.cofactorG1), n.G2 = new Yo(t, "g2m", n.F2, o.wasm.pG2gen, o.wasm.pG2b, o.cofactorG2), n.F6 = new Os(t, "f6m", n.F2), n.F12 = new $o(t, "ftm", n.F6), n.Gt = n.F12,
|
|
9492
|
+
return n.q = Tt(o.wasm.q.toString()), n.r = Tt(o.wasm.r.toString()), n.name = o.name, n.tm = t, n.prePSize = o.wasm.prePSize, n.preQSize = o.wasm.preQSize, n.Fr = new jo(t, "frm", o.n8r, o.r), n.F1 = new jo(t, "f1m", o.n8q, o.q), n.F2 = new $o(t, "f2m", n.F1), n.G1 = new Yo(t, "g1m", n.F1, o.wasm.pG1gen, o.wasm.pG1b, o.cofactorG1), n.G2 = new Yo(t, "g2m", n.F2, o.wasm.pG2gen, o.wasm.pG2b, o.cofactorG2), n.F6 = new Os(t, "f6m", n.F2), n.F12 = new $o(t, "ftm", n.F6), n.Gt = n.F12, Ue(n, "G1"), Ue(n, "G2"), Ue(n, "Fr"), Xo(n, "G1"), Xo(n, "G2"), ze(n, "G1"), ze(n, "G2"), ze(n, "Fr"), Qs(n), n.array2buffer = function(e, i) {
|
|
9493
9493
|
const s = new Uint8Array(i * e.length);
|
|
9494
9494
|
for (let d = 0; d < e.length; d++)
|
|
9495
9495
|
s.set(e[d], d * i);
|
|
@@ -9513,7 +9513,7 @@ function Us(o) {
|
|
|
9513
9513
|
function zs(o) {
|
|
9514
9514
|
return da(o) ? o.toString(2).length - 1 : o.toString(2).length;
|
|
9515
9515
|
}
|
|
9516
|
-
function
|
|
9516
|
+
function Te(o) {
|
|
9517
9517
|
const t = [], n = Rn(o);
|
|
9518
9518
|
return t.push(Number(n & 0xFFn)), t.push(Number(n >> 8n & 0xFFn)), t.push(Number(n >> 16n & 0xFFn)), t.push(Number(n >> 24n & 0xFFn)), t;
|
|
9519
9519
|
}
|
|
@@ -9559,7 +9559,7 @@ function _a(o) {
|
|
|
9559
9559
|
const i = 7 - e % 7, s = (1n << BigInt(i)) - 1n << BigInt(e), d = (1 << 7 - i) - 1 | 128, r = ua(t + s);
|
|
9560
9560
|
return n || (r[r.length - 1] = r[r.length - 1] & d), r;
|
|
9561
9561
|
}
|
|
9562
|
-
function
|
|
9562
|
+
function We(o) {
|
|
9563
9563
|
let t = Rn(o);
|
|
9564
9564
|
if (t > 0xFFFFFFFFn)
|
|
9565
9565
|
throw new Error("Number too big");
|
|
@@ -9718,7 +9718,7 @@ class Ds {
|
|
|
9718
9718
|
return [66, ...Rs(t)];
|
|
9719
9719
|
}
|
|
9720
9720
|
i32_const(t) {
|
|
9721
|
-
return [65, ...
|
|
9721
|
+
return [65, ...We(t)];
|
|
9722
9722
|
}
|
|
9723
9723
|
i64_eqz(t) {
|
|
9724
9724
|
return [...t, 80];
|
|
@@ -9901,7 +9901,7 @@ class Ds {
|
|
|
9901
9901
|
return [];
|
|
9902
9902
|
}
|
|
9903
9903
|
}
|
|
9904
|
-
const
|
|
9904
|
+
const Re = {
|
|
9905
9905
|
i32: 127,
|
|
9906
9906
|
i64: 126,
|
|
9907
9907
|
f32: 125,
|
|
@@ -9944,13 +9944,13 @@ class ni {
|
|
|
9944
9944
|
this.returnType = t;
|
|
9945
9945
|
}
|
|
9946
9946
|
getSignature() {
|
|
9947
|
-
const t = [...Ft(this.params.length), ...this.params.map((e) =>
|
|
9947
|
+
const t = [...Ft(this.params.length), ...this.params.map((e) => Re[e.type])], n = this.returnType ? [1, Re[this.returnType]] : [0];
|
|
9948
9948
|
return [96, ...t, ...n];
|
|
9949
9949
|
}
|
|
9950
9950
|
getBody() {
|
|
9951
9951
|
const t = this.locals.map((e) => [
|
|
9952
9952
|
...Ft(e.length),
|
|
9953
|
-
|
|
9953
|
+
Re[e.type]
|
|
9954
9954
|
]), n = [
|
|
9955
9955
|
...Ft(this.locals.length),
|
|
9956
9956
|
...[].concat(...t),
|
|
@@ -9979,8 +9979,8 @@ class ga {
|
|
|
9979
9979
|
}
|
|
9980
9980
|
build() {
|
|
9981
9981
|
return this._setSignatures(), new Uint8Array([
|
|
9982
|
-
...
|
|
9983
|
-
...
|
|
9982
|
+
...Te(1836278016),
|
|
9983
|
+
...Te(1),
|
|
9984
9984
|
...this._buildType(),
|
|
9985
9985
|
...this._buildImport(),
|
|
9986
9986
|
...this._buildFunctionDeclarations(),
|
|
@@ -10127,7 +10127,7 @@ class ga {
|
|
|
10127
10127
|
// Table (0 in MVP)
|
|
10128
10128
|
65,
|
|
10129
10129
|
// offset 0
|
|
10130
|
-
...
|
|
10130
|
+
...We(0),
|
|
10131
10131
|
11,
|
|
10132
10132
|
...Ft(this.functionsTable.length),
|
|
10133
10133
|
...t
|
|
@@ -10164,13 +10164,13 @@ class ga {
|
|
|
10164
10164
|
0,
|
|
10165
10165
|
11,
|
|
10166
10166
|
4,
|
|
10167
|
-
...
|
|
10167
|
+
...Te(this.free)
|
|
10168
10168
|
]);
|
|
10169
10169
|
for (let n = 0; n < this.datas.length; n++)
|
|
10170
10170
|
t.push([
|
|
10171
10171
|
0,
|
|
10172
10172
|
65,
|
|
10173
|
-
...
|
|
10173
|
+
...We(this.datas[n].offset),
|
|
10174
10174
|
11,
|
|
10175
10175
|
...Ft(this.datas[n].bytes.length),
|
|
10176
10176
|
...this.datas[n].bytes
|
|
@@ -10230,7 +10230,7 @@ Tt("73eda753299d7d483339d80809a1d80553bda402fffe5bfeffffffff00000001", 16);
|
|
|
10230
10230
|
Tt("21888242871839275222246405745257275088548364400416034343698204186575808495617");
|
|
10231
10231
|
Tt("1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab", 16);
|
|
10232
10232
|
Tt("21888242871839275222246405745257275088696311157297823662689037894645226208583");
|
|
10233
|
-
const
|
|
10233
|
+
const Qt = Cc, ne = Ss;
|
|
10234
10234
|
var pa = {};
|
|
10235
10235
|
async function La(o, t, n, e) {
|
|
10236
10236
|
if (n = n || 4096 * 64, typeof t != "number" && ["w+", "wx+", "r", "ax+", "a+"].indexOf(t) < 0)
|
|
@@ -10465,7 +10465,7 @@ function Gs(o) {
|
|
|
10465
10465
|
const t = new ba();
|
|
10466
10466
|
return t.o = o, t.allocSize = o.data.byteLength, t.totalSize = o.data.byteLength, t.readOnly = !0, t.pos = 0, t;
|
|
10467
10467
|
}
|
|
10468
|
-
const
|
|
10468
|
+
const Xe = new Uint8Array(4), ei = new DataView(Xe.buffer), Aa = new Uint8Array(8), oi = new DataView(Aa.buffer);
|
|
10469
10469
|
class ba {
|
|
10470
10470
|
constructor() {
|
|
10471
10471
|
this.pageSize = 16384;
|
|
@@ -10503,11 +10503,11 @@ class ba {
|
|
|
10503
10503
|
}
|
|
10504
10504
|
async writeULE32(t, n) {
|
|
10505
10505
|
const e = this;
|
|
10506
|
-
ei.setUint32(0, t, !0), await e.write(
|
|
10506
|
+
ei.setUint32(0, t, !0), await e.write(Xe, n);
|
|
10507
10507
|
}
|
|
10508
10508
|
async writeUBE32(t, n) {
|
|
10509
10509
|
const e = this;
|
|
10510
|
-
ei.setUint32(0, t, !1), await e.write(
|
|
10510
|
+
ei.setUint32(0, t, !1), await e.write(Xe, n);
|
|
10511
10511
|
}
|
|
10512
10512
|
async writeULE64(t, n) {
|
|
10513
10513
|
const e = this;
|
|
@@ -10556,7 +10556,7 @@ function Hs(o) {
|
|
|
10556
10556
|
const t = new Ia();
|
|
10557
10557
|
return t.o = o, t.totalSize = (o.data.length - 1) * kt + o.data[o.data.length - 1].byteLength, t.readOnly = !0, t.pos = 0, t;
|
|
10558
10558
|
}
|
|
10559
|
-
const
|
|
10559
|
+
const to = new Uint8Array(4), ii = new DataView(to.buffer), ya = new Uint8Array(8), ai = new DataView(ya.buffer);
|
|
10560
10560
|
class Ia {
|
|
10561
10561
|
constructor() {
|
|
10562
10562
|
this.pageSize = 16384;
|
|
@@ -10607,11 +10607,11 @@ class Ia {
|
|
|
10607
10607
|
}
|
|
10608
10608
|
async writeULE32(t, n) {
|
|
10609
10609
|
const e = this;
|
|
10610
|
-
ii.setUint32(0, t, !0), await e.write(
|
|
10610
|
+
ii.setUint32(0, t, !0), await e.write(to, n);
|
|
10611
10611
|
}
|
|
10612
10612
|
async writeUBE32(t, n) {
|
|
10613
10613
|
const e = this;
|
|
10614
|
-
ii.setUint32(0, t, !1), await e.write(
|
|
10614
|
+
ii.setUint32(0, t, !1), await e.write(to, n);
|
|
10615
10615
|
}
|
|
10616
10616
|
async writeULE64(t, n) {
|
|
10617
10617
|
const e = this;
|
|
@@ -10741,29 +10741,29 @@ async function oe(o, t) {
|
|
|
10741
10741
|
}
|
|
10742
10742
|
async function Xs(o, t, n, e) {
|
|
10743
10743
|
const i = new Uint8Array(n);
|
|
10744
|
-
|
|
10744
|
+
Qt.toRprLE(i, 0, t, n), await o.write(i, e);
|
|
10745
10745
|
}
|
|
10746
10746
|
async function Sn(o, t, n) {
|
|
10747
10747
|
const e = await o.read(t, n);
|
|
10748
|
-
return
|
|
10748
|
+
return Qt.fromRprLE(e, 0, t);
|
|
10749
10749
|
}
|
|
10750
10750
|
async function Bn(o, t, n, e, i) {
|
|
10751
10751
|
if (e = typeof e > "u" ? 0 : e, i = typeof i > "u" ? t[n][0].size - e : i, e + i > t[n][0].size)
|
|
10752
10752
|
throw new Error("Reading out of the range of the section");
|
|
10753
10753
|
let s;
|
|
10754
|
-
return i < 1 << 30 ? s = new Uint8Array(i) : s = new
|
|
10754
|
+
return i < 1 << 30 ? s = new Uint8Array(i) : s = new Mt(i), await o.readToBuffer(s, 0, i, t[n][0].p + e), s;
|
|
10755
10755
|
}
|
|
10756
|
-
|
|
10757
|
-
|
|
10758
|
-
const tl =
|
|
10756
|
+
Qt.e("73eda753299d7d483339d80809a1d80553bda402fffe5bfeffffffff00000001", 16);
|
|
10757
|
+
Qt.e("21888242871839275222246405745257275088548364400416034343698204186575808495617");
|
|
10758
|
+
const tl = Qt.e("1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab", 16), nl = Qt.e("21888242871839275222246405745257275088696311157297823662689037894645226208583");
|
|
10759
10759
|
async function Co(o, t) {
|
|
10760
10760
|
let n, e = t && t.singleThread;
|
|
10761
|
-
if (
|
|
10761
|
+
if (Qt.eq(o, nl))
|
|
10762
10762
|
n = await fa(e);
|
|
10763
|
-
else if (
|
|
10763
|
+
else if (Qt.eq(o, tl))
|
|
10764
10764
|
n = await ha(e);
|
|
10765
10765
|
else
|
|
10766
|
-
throw new Error(`Curve not supported: ${
|
|
10766
|
+
throw new Error(`Curve not supported: ${Qt.toString(o)}`);
|
|
10767
10767
|
return n;
|
|
10768
10768
|
}
|
|
10769
10769
|
async function el(o, t) {
|
|
@@ -10790,7 +10790,7 @@ function Ba(o, t) {
|
|
|
10790
10790
|
throw Error.captureStackTrace && Error.captureStackTrace(n, Ba), n;
|
|
10791
10791
|
}
|
|
10792
10792
|
}
|
|
10793
|
-
var
|
|
10793
|
+
var no = { exports: {} };
|
|
10794
10794
|
function Ea(o) {
|
|
10795
10795
|
return o.length;
|
|
10796
10796
|
}
|
|
@@ -10883,7 +10883,7 @@ function ri(o) {
|
|
|
10883
10883
|
if (o >= 97 && o <= 102)
|
|
10884
10884
|
return o - 97 + 10;
|
|
10885
10885
|
}
|
|
10886
|
-
function
|
|
10886
|
+
function eo(o) {
|
|
10887
10887
|
let t = 0;
|
|
10888
10888
|
for (let n = 0, e = o.length; n < e; n++) {
|
|
10889
10889
|
const i = o.charCodeAt(n);
|
|
@@ -10898,14 +10898,14 @@ function no(o) {
|
|
|
10898
10898
|
}
|
|
10899
10899
|
return t;
|
|
10900
10900
|
}
|
|
10901
|
-
let
|
|
10901
|
+
let oo;
|
|
10902
10902
|
if (typeof TextDecoder < "u") {
|
|
10903
10903
|
const o = new TextDecoder();
|
|
10904
|
-
|
|
10904
|
+
oo = function(n) {
|
|
10905
10905
|
return o.decode(n);
|
|
10906
10906
|
};
|
|
10907
10907
|
} else
|
|
10908
|
-
|
|
10908
|
+
oo = function(t) {
|
|
10909
10909
|
const n = t.byteLength;
|
|
10910
10910
|
let e = "", i = 0;
|
|
10911
10911
|
for (; i < n; ) {
|
|
@@ -10925,15 +10925,15 @@ if (typeof TextDecoder < "u") {
|
|
|
10925
10925
|
}
|
|
10926
10926
|
return e;
|
|
10927
10927
|
};
|
|
10928
|
-
let
|
|
10928
|
+
let io;
|
|
10929
10929
|
if (typeof TextEncoder < "u") {
|
|
10930
10930
|
const o = new TextEncoder();
|
|
10931
|
-
|
|
10931
|
+
io = function(n, e, i = 0, s = eo(e)) {
|
|
10932
10932
|
const d = Math.min(s, n.byteLength - i);
|
|
10933
10933
|
return o.encodeInto(e, n.subarray(i, i + d)), d;
|
|
10934
10934
|
};
|
|
10935
10935
|
} else
|
|
10936
|
-
|
|
10936
|
+
io = function(t, n, e = 0, i = eo(n)) {
|
|
10937
10937
|
const s = Math.min(i, t.byteLength - e);
|
|
10938
10938
|
t = t.subarray(e, e + s);
|
|
10939
10939
|
let d = 0, r = 0;
|
|
@@ -10951,9 +10951,9 @@ if (typeof TextEncoder < "u") {
|
|
|
10951
10951
|
return s;
|
|
10952
10952
|
};
|
|
10953
10953
|
var fl = {
|
|
10954
|
-
byteLength:
|
|
10955
|
-
toString:
|
|
10956
|
-
write:
|
|
10954
|
+
byteLength: eo,
|
|
10955
|
+
toString: oo,
|
|
10956
|
+
write: io
|
|
10957
10957
|
};
|
|
10958
10958
|
function Sa(o) {
|
|
10959
10959
|
return o.length * 2;
|
|
@@ -11175,7 +11175,7 @@ var Ll = {
|
|
|
11175
11175
|
/* first */
|
|
11176
11176
|
);
|
|
11177
11177
|
}
|
|
11178
|
-
function
|
|
11178
|
+
function M(c, w, I, h) {
|
|
11179
11179
|
return $(
|
|
11180
11180
|
c,
|
|
11181
11181
|
w,
|
|
@@ -11262,7 +11262,7 @@ var Ll = {
|
|
|
11262
11262
|
from: T,
|
|
11263
11263
|
includes: V,
|
|
11264
11264
|
indexOf: X,
|
|
11265
|
-
lastIndexOf:
|
|
11265
|
+
lastIndexOf: M,
|
|
11266
11266
|
swap16: v,
|
|
11267
11267
|
swap32: D,
|
|
11268
11268
|
swap64: it,
|
|
@@ -11278,11 +11278,11 @@ var Ll = {
|
|
|
11278
11278
|
readUInt32LE: a,
|
|
11279
11279
|
readInt32LE: m
|
|
11280
11280
|
};
|
|
11281
|
-
})(
|
|
11282
|
-
var
|
|
11281
|
+
})(no, no.exports);
|
|
11282
|
+
var De, di;
|
|
11283
11283
|
function Al() {
|
|
11284
11284
|
if (di)
|
|
11285
|
-
return
|
|
11285
|
+
return De;
|
|
11286
11286
|
di = 1;
|
|
11287
11287
|
var o = (s, d) => function() {
|
|
11288
11288
|
return d || (0, s[Object.keys(s)[0]])((d = { exports: {} }).exports, d), d.exports;
|
|
@@ -11301,9 +11301,9 @@ function Al() {
|
|
|
11301
11301
|
d.exports = t("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");
|
|
11302
11302
|
}
|
|
11303
11303
|
}), e = n(), i = WebAssembly.compile(e);
|
|
11304
|
-
return
|
|
11304
|
+
return De = async (s) => (await WebAssembly.instantiate(await i, s)).exports, De;
|
|
11305
11305
|
}
|
|
11306
|
-
var Xt = il, bl =
|
|
11306
|
+
var Xt = il, bl = no.exports, gn = null, ui = typeof WebAssembly < "u" && Al()().then((o) => {
|
|
11307
11307
|
gn = o;
|
|
11308
11308
|
}), un = 64, re = [];
|
|
11309
11309
|
hn.exports = $t;
|
|
@@ -11350,7 +11350,7 @@ $t.prototype.setPartialHash = function(o) {
|
|
|
11350
11350
|
};
|
|
11351
11351
|
function yl() {
|
|
11352
11352
|
}
|
|
11353
|
-
function
|
|
11353
|
+
function ye(o) {
|
|
11354
11354
|
return (o & 4294901760 ? (o &= 4294901760, 16) : 0) | (o & 4278255360 ? (o &= 4278255360, 8) : 0) | (o & 4042322160 ? (o &= 4042322160, 4) : 0) | (o & 3435973836 ? (o &= 3435973836, 2) : 0) | (o & 2863311530) !== 0;
|
|
11355
11355
|
}
|
|
11356
11356
|
const Il = 1, Cl = 2, Oa = 10, ml = 2;
|
|
@@ -11379,7 +11379,7 @@ async function Bl(o, t, n, e) {
|
|
|
11379
11379
|
const s = await o.readULE32();
|
|
11380
11380
|
i.n8q = s, i.q = await Sn(o, s);
|
|
11381
11381
|
const d = await o.readULE32();
|
|
11382
|
-
return i.n8r = d, i.r = await Sn(o, d), i.curve = await Co(i.q, e), i.nVars = await o.readULE32(), i.nPublic = await o.readULE32(), i.domainSize = await o.readULE32(), i.power =
|
|
11382
|
+
return i.n8r = d, i.r = await Sn(o, d), i.curve = await Co(i.q, e), i.nVars = await o.readULE32(), i.nPublic = await o.readULE32(), i.domainSize = await o.readULE32(), i.power = ye(i.domainSize), i.vk_alpha_1 = await tn(o, i.curve, n), i.vk_beta_1 = await tn(o, i.curve, n), i.vk_beta_2 = await $n(o, i.curve, n), i.vk_gamma_2 = await $n(o, i.curve, n), i.vk_delta_1 = await tn(o, i.curve, n), i.vk_delta_2 = await $n(o, i.curve, n), await oe(o), i;
|
|
11383
11383
|
}
|
|
11384
11384
|
async function El(o, t, n, e) {
|
|
11385
11385
|
const i = {};
|
|
@@ -11387,7 +11387,7 @@ async function El(o, t, n, e) {
|
|
|
11387
11387
|
const s = await o.readULE32();
|
|
11388
11388
|
i.n8q = s, i.q = await Sn(o, s);
|
|
11389
11389
|
const d = await o.readULE32();
|
|
11390
|
-
return i.n8r = d, i.r = await Sn(o, d), i.curve = await Co(i.q, e), i.nVars = await o.readULE32(), i.nPublic = await o.readULE32(), i.domainSize = await o.readULE32(), i.power =
|
|
11390
|
+
return i.n8r = d, i.r = await Sn(o, d), i.curve = await Co(i.q, e), i.nVars = await o.readULE32(), i.nPublic = await o.readULE32(), i.domainSize = await o.readULE32(), i.power = ye(i.domainSize), i.nAdditions = await o.readULE32(), i.nConstraints = await o.readULE32(), i.k1 = await o.read(d), i.k2 = await o.read(d), i.Qm = await tn(o, i.curve, n), i.Ql = await tn(o, i.curve, n), i.Qr = await tn(o, i.curve, n), i.Qo = await tn(o, i.curve, n), i.Qc = await tn(o, i.curve, n), i.S1 = await tn(o, i.curve, n), i.S2 = await tn(o, i.curve, n), i.S3 = await tn(o, i.curve, n), i.X_2 = await $n(o, i.curve, n), await oe(o), i;
|
|
11391
11391
|
}
|
|
11392
11392
|
async function Fl(o, t, n, e) {
|
|
11393
11393
|
const i = {};
|
|
@@ -11395,11 +11395,11 @@ async function Fl(o, t, n, e) {
|
|
|
11395
11395
|
const s = await o.readULE32();
|
|
11396
11396
|
i.n8q = s, i.q = await Sn(o, s), i.curve = await Co(i.q, e);
|
|
11397
11397
|
const d = await o.readULE32();
|
|
11398
|
-
return i.n8r = d, i.r = await Sn(o, d), i.nVars = await o.readULE32(), i.nPublic = await o.readULE32(), i.domainSize = await o.readULE32(), i.power =
|
|
11398
|
+
return i.n8r = d, i.r = await Sn(o, d), i.nVars = await o.readULE32(), i.nPublic = await o.readULE32(), i.domainSize = await o.readULE32(), i.power = ye(i.domainSize), i.nAdditions = await o.readULE32(), i.nConstraints = await o.readULE32(), i.k1 = await o.read(d), i.k2 = await o.read(d), i.w3 = await o.read(d), i.w4 = await o.read(d), i.w8 = await o.read(d), i.wr = await o.read(d), i.X_2 = await $n(o, i.curve, n), i.C0 = await tn(o, i.curve, n), await oe(o), i;
|
|
11399
11399
|
}
|
|
11400
11400
|
async function xl(o, t, n) {
|
|
11401
11401
|
await si(o, 1);
|
|
11402
|
-
const e = (Math.floor((
|
|
11402
|
+
const e = (Math.floor((Qt.bitLength(n) - 1) / 64) + 1) * 8;
|
|
11403
11403
|
if (await o.writeULE32(e), await Xs(o, n, e), t.byteLength % e != 0)
|
|
11404
11404
|
throw new Error("Invalid witness length");
|
|
11405
11405
|
await o.writeULE32(t.byteLength / e), await li(o), await si(o, 2), await o.write(t), await li(o);
|
|
@@ -11414,17 +11414,17 @@ async function va(o, t, n, e) {
|
|
|
11414
11414
|
const { fd: i, sections: s } = await ci(t, "wtns", 2), d = await Sl(i, s), { fd: r, sections: b } = await ci(o, "zkey", 2), u = await wl(r, b, void 0, e);
|
|
11415
11415
|
if (u.protocol != "groth16")
|
|
11416
11416
|
throw new Error("zkey file is not groth16");
|
|
11417
|
-
if (!
|
|
11417
|
+
if (!Qt.eq(u.r, d.q))
|
|
11418
11418
|
throw new Error("Curve of the witness does not match the curve of the proving key");
|
|
11419
11419
|
if (d.nWitness != u.nVars)
|
|
11420
11420
|
throw new Error(`Invalid witness length. Circuit: ${u.nVars}, witness: ${d.nWitness}`);
|
|
11421
|
-
const l = u.curve, C = l.Fr, B = l.G1, A = l.G2, O =
|
|
11421
|
+
const l = u.curve, C = l.Fr, B = l.G1, A = l.G2, O = ye(u.domainSize);
|
|
11422
11422
|
n && n.debug("Reading Wtns");
|
|
11423
11423
|
const P = await Bn(i, s, 2);
|
|
11424
11424
|
n && n.debug("Reading Coeffs");
|
|
11425
11425
|
const E = await Bn(r, b, 4);
|
|
11426
11426
|
n && n.debug("Building ABC");
|
|
11427
|
-
const [z, x, ot] = await Ol(l, u, P, E, n), T = O == C.s ? l.Fr.shift : l.Fr.w[O + 1], rt = await C.ifft(z, "", "", n, "IFFT_A"), F = await C.batchApplyKey(rt, C.e(1), T), f = await C.fft(F, "", "", n, "FFT_A"), L = await C.ifft(x, "", "", n, "IFFT_B"), V = await C.batchApplyKey(L, C.e(1), T), $ = await C.fft(V, "", "", n, "FFT_B"), X = await C.ifft(ot, "", "", n, "IFFT_C"),
|
|
11427
|
+
const [z, x, ot] = await Ol(l, u, P, E, n), T = O == C.s ? l.Fr.shift : l.Fr.w[O + 1], rt = await C.ifft(z, "", "", n, "IFFT_A"), F = await C.batchApplyKey(rt, C.e(1), T), f = await C.fft(F, "", "", n, "FFT_A"), L = await C.ifft(x, "", "", n, "IFFT_B"), V = await C.batchApplyKey(L, C.e(1), T), $ = await C.fft(V, "", "", n, "FFT_B"), X = await C.ifft(ot, "", "", n, "IFFT_C"), M = await C.batchApplyKey(X, C.e(1), T), y = await C.fft(M, "", "", n, "FFT_C");
|
|
11428
11428
|
n && n.debug("Join ABC");
|
|
11429
11429
|
const v = await vl(l, u, f, $, y, n);
|
|
11430
11430
|
let D = {};
|
|
@@ -11443,12 +11443,12 @@ async function va(o, t, n, e) {
|
|
|
11443
11443
|
let p = [];
|
|
11444
11444
|
for (let a = 1; a <= u.nPublic; a++) {
|
|
11445
11445
|
const m = P.slice(a * C.n8, a * C.n8 + C.n8);
|
|
11446
|
-
p.push(
|
|
11446
|
+
p.push(Qt.fromRprLE(m));
|
|
11447
11447
|
}
|
|
11448
11448
|
return D.pi_a = B.toObject(B.toAffine(D.pi_a)), D.pi_b = A.toObject(A.toAffine(D.pi_b)), D.pi_c = B.toObject(B.toAffine(D.pi_c)), D.protocol = "groth16", D.curve = l.name, await r.close(), await i.close(), D = Ai(D), p = Ai(p), { proof: D, publicSignals: p };
|
|
11449
11449
|
}
|
|
11450
11450
|
async function Ol(o, t, n, e, i) {
|
|
11451
|
-
const s = o.Fr.n8, d = 4 * 3 + t.n8r, r = (e.byteLength - 4) / d, b = new
|
|
11451
|
+
const s = o.Fr.n8, d = 4 * 3 + t.n8r, r = (e.byteLength - 4) / d, b = new Mt(t.domainSize * s), u = new Mt(t.domainSize * s), l = new Mt(t.domainSize * s), C = [b, u];
|
|
11452
11452
|
for (let B = 0; B < r; B++) {
|
|
11453
11453
|
i && B % 1e6 == 0 && i.debug(`QAP AB: ${B}/${r}`);
|
|
11454
11454
|
const A = e.slice(4 + B * d, 4 + B * d + d), O = new DataView(A.buffer), P = O.getUint32(0, !0), E = O.getUint32(4, !0), z = O.getUint32(8, !0), x = A.slice(12, 12 + s);
|
|
@@ -11489,7 +11489,7 @@ async function vl(o, t, n, e, i, s) {
|
|
|
11489
11489
|
}
|
|
11490
11490
|
const l = await Promise.all(u);
|
|
11491
11491
|
let C;
|
|
11492
|
-
n instanceof
|
|
11492
|
+
n instanceof Mt ? C = new Mt(n.byteLength) : C = new Uint8Array(n.byteLength);
|
|
11493
11493
|
let B = 0;
|
|
11494
11494
|
for (let A = 0; A < l.length; A++)
|
|
11495
11495
|
C.set(l[A][0], B), B += l[A][0].byteLength;
|
|
@@ -11531,7 +11531,7 @@ function ql(o, t) {
|
|
|
11531
11531
|
}
|
|
11532
11532
|
return n;
|
|
11533
11533
|
}
|
|
11534
|
-
async function
|
|
11534
|
+
async function Ml(o, t) {
|
|
11535
11535
|
let n, e, i;
|
|
11536
11536
|
t = t || {};
|
|
11537
11537
|
let s = 1, d = 0, r = 0, b = !1;
|
|
@@ -11581,10 +11581,10 @@ async function Ql(o, t) {
|
|
|
11581
11581
|
x[z - 1 - ot] = n.exports.readSharedRWMemory(ot);
|
|
11582
11582
|
if (s >= 2 && (d >= 1 || r >= 7)) {
|
|
11583
11583
|
E !== "" && (E += " ");
|
|
11584
|
-
const ot =
|
|
11584
|
+
const ot = Qt.fromArray(x, 4294967296).toString();
|
|
11585
11585
|
E += ot;
|
|
11586
11586
|
} else
|
|
11587
|
-
console.log(
|
|
11587
|
+
console.log(Qt.fromArray(x, 4294967296));
|
|
11588
11588
|
},
|
|
11589
11589
|
error: function(z, x, ot, T, rt, F) {
|
|
11590
11590
|
let f;
|
|
@@ -11615,7 +11615,7 @@ async function Ql(o, t) {
|
|
|
11615
11615
|
else if (s === 1) {
|
|
11616
11616
|
if (b)
|
|
11617
11617
|
throw new Error("Loading code from WebAssembly instance is not supported for circom version 1");
|
|
11618
|
-
e = new
|
|
11618
|
+
e = new Ql(i, n, u);
|
|
11619
11619
|
} else
|
|
11620
11620
|
throw new Error(`Unsupported circom version: ${s}`);
|
|
11621
11621
|
return e;
|
|
@@ -11632,13 +11632,13 @@ async function Ql(o, t) {
|
|
|
11632
11632
|
return String.fromCharCode.apply(null, O);
|
|
11633
11633
|
}
|
|
11634
11634
|
}
|
|
11635
|
-
class
|
|
11635
|
+
class Ql {
|
|
11636
11636
|
constructor(t, n, e) {
|
|
11637
11637
|
this.memory = t, this.i32 = new Uint32Array(t.buffer), this.instance = n, this.n32 = (this.instance.exports.getFrLen() >> 2) - 2;
|
|
11638
11638
|
const i = this.instance.exports.getPRawPrime(), s = new Array(this.n32);
|
|
11639
11639
|
for (let d = 0; d < this.n32; d++)
|
|
11640
11640
|
s[this.n32 - 1 - d] = this.i32[(i >> 2) + d];
|
|
11641
|
-
this.prime =
|
|
11641
|
+
this.prime = Qt.fromArray(s, 4294967296), this.Fr = new Qc(this.prime), this.mask32 = Qt.fromString("FFFFFFFF", 16), this.NVars = this.instance.exports.getNVars(), this.n64 = Math.floor((this.Fr.bitLength - 1) / 64) + 1, this.R = this.Fr.e(Qt.shiftLeft(1, this.n64 * 64)), this.RInv = this.Fr.inv(this.R), this.sanityCheck = e;
|
|
11642
11642
|
}
|
|
11643
11643
|
circom_version() {
|
|
11644
11644
|
return 1;
|
|
@@ -11695,7 +11695,7 @@ class Ml {
|
|
|
11695
11695
|
const s = new Array(n.n32);
|
|
11696
11696
|
for (let r = 0; r < n.n32; r++)
|
|
11697
11697
|
s[n.n32 - 1 - r] = n.i32[e + 2 + r];
|
|
11698
|
-
const d = n.Fr.e(
|
|
11698
|
+
const d = n.Fr.e(Qt.fromArray(s, 4294967296));
|
|
11699
11699
|
return n.i32[e + 1] & 1073741824 ? i(d) : d;
|
|
11700
11700
|
} else
|
|
11701
11701
|
return n.i32[e] & 2147483648 ? n.Fr.e(n.i32[e] - 4294967296) : n.Fr.e(n.i32[e]);
|
|
@@ -11709,11 +11709,11 @@ class Ml {
|
|
|
11709
11709
|
const i = e.Fr.neg(e.Fr.e("80000000", 16)), s = e.Fr.e("7FFFFFFF", 16);
|
|
11710
11710
|
if (e.Fr.geq(n, i) && e.Fr.leq(n, s)) {
|
|
11711
11711
|
let r;
|
|
11712
|
-
e.Fr.geq(n, e.Fr.zero) ? r =
|
|
11712
|
+
e.Fr.geq(n, e.Fr.zero) ? r = Qt.toNumber(n) : (r = Qt.toNumber(e.Fr.sub(n, i)), r = r - 2147483648, r = 4294967296 + r), e.i32[t >> 2] = r, e.i32[(t >> 2) + 1] = 0;
|
|
11713
11713
|
return;
|
|
11714
11714
|
}
|
|
11715
11715
|
e.i32[t >> 2] = 0, e.i32[(t >> 2) + 1] = 2147483648;
|
|
11716
|
-
const d =
|
|
11716
|
+
const d = Qt.toArray(n, 4294967296);
|
|
11717
11717
|
for (let r = 0; r < e.n32; r++) {
|
|
11718
11718
|
const b = d.length - 1 - r;
|
|
11719
11719
|
b >= 0 ? e.i32[(t >> 2) + 2 + r] = d[b] : e.i32[(t >> 2) + 2 + r] = 0;
|
|
@@ -11726,7 +11726,7 @@ class Ul {
|
|
|
11726
11726
|
const e = new Uint32Array(this.n32);
|
|
11727
11727
|
for (let i = 0; i < this.n32; i++)
|
|
11728
11728
|
e[this.n32 - 1 - i] = this.instance.exports.readSharedRWMemory(i);
|
|
11729
|
-
this.prime =
|
|
11729
|
+
this.prime = Qt.fromArray(e, 4294967296), this.witnessSize = this.instance.exports.getWitnessSize(), this.sanityCheck = n;
|
|
11730
11730
|
}
|
|
11731
11731
|
circom_version() {
|
|
11732
11732
|
return this.instance.exports.getVersion();
|
|
@@ -11770,7 +11770,7 @@ class Ul {
|
|
|
11770
11770
|
const s = new Uint32Array(this.n32);
|
|
11771
11771
|
for (let d = 0; d < this.n32; d++)
|
|
11772
11772
|
s[this.n32 - 1 - d] = this.instance.exports.readSharedRWMemory(d);
|
|
11773
|
-
e.push(
|
|
11773
|
+
e.push(Qt.fromArray(s, 4294967296));
|
|
11774
11774
|
}
|
|
11775
11775
|
return e;
|
|
11776
11776
|
}
|
|
@@ -11798,7 +11798,7 @@ const { unstringifyBigInts: zl } = ne;
|
|
|
11798
11798
|
async function Tl(o, t, n, e) {
|
|
11799
11799
|
const i = zl(o), s = await ma(t), d = await s.read(s.totalSize);
|
|
11800
11800
|
await s.close();
|
|
11801
|
-
const r = await
|
|
11801
|
+
const r = await Ml(d, e);
|
|
11802
11802
|
if (r.circom_version() === 1) {
|
|
11803
11803
|
const b = await r.calculateBinWitness(i), u = await Ws(n, "wtns", 2, 2);
|
|
11804
11804
|
await xl(u, b, r.prime), await u.close();
|
|
@@ -11814,14 +11814,14 @@ async function Dl(o, t, n, e, i, s) {
|
|
|
11814
11814
|
};
|
|
11815
11815
|
return await Tl(d, t, r, i), await va(n, r, e, s);
|
|
11816
11816
|
}
|
|
11817
|
-
const { unstringifyBigInts:
|
|
11817
|
+
const { unstringifyBigInts: ke } = ne;
|
|
11818
11818
|
async function kl(o, t, n, e) {
|
|
11819
|
-
const i =
|
|
11819
|
+
const i = ke(o), s = ke(n), d = ke(t), r = await el(i.curve), b = r.G1.fromObject(i.IC[0]), u = new Uint8Array(r.G1.F.n8 * 2 * d.length), l = new Uint8Array(r.Fr.n8 * d.length);
|
|
11820
11820
|
if (!Gl(r, d))
|
|
11821
11821
|
return e && e.error("Public inputs are not valid."), !1;
|
|
11822
11822
|
for (let T = 0; T < d.length; T++) {
|
|
11823
11823
|
const rt = r.G1.fromObject(i.IC[T + 1]);
|
|
11824
|
-
u.set(rt, T * r.G1.F.n8 * 2),
|
|
11824
|
+
u.set(rt, T * r.G1.F.n8 * 2), Qt.toRprLE(l, r.Fr.n8 * T, d[T], r.Fr.n8);
|
|
11825
11825
|
}
|
|
11826
11826
|
let C = await r.G1.multiExpAffine(u, l);
|
|
11827
11827
|
C = r.G1.add(C, b);
|
|
@@ -11846,7 +11846,7 @@ function Nl(o, t) {
|
|
|
11846
11846
|
}
|
|
11847
11847
|
function Gl(o, t) {
|
|
11848
11848
|
for (let n = 0; n < t.length; n++)
|
|
11849
|
-
if (!
|
|
11849
|
+
if (!Qt.lt(t[n], o.r))
|
|
11850
11850
|
return !1;
|
|
11851
11851
|
return !0;
|
|
11852
11852
|
}
|
|
@@ -11872,8 +11872,8 @@ var yi = /* @__PURE__ */ Object.freeze({
|
|
|
11872
11872
|
verify: kl,
|
|
11873
11873
|
exportSolidityCallData: Kl
|
|
11874
11874
|
});
|
|
11875
|
-
|
|
11876
|
-
|
|
11875
|
+
Qt.e("73eda753299d7d483339d80809a1d80553bda402fffe5bfeffffffff00000001", 16);
|
|
11876
|
+
Qt.e("21888242871839275222246405745257275088548364400416034343698204186575808495617");
|
|
11877
11877
|
var Hl = { exports: {} };
|
|
11878
11878
|
/**
|
|
11879
11879
|
* [js-sha3]{@link https://github.com/emn178/js-sha3}
|
|
@@ -11990,7 +11990,7 @@ var Hl = { exports: {} };
|
|
|
11990
11990
|
}, c.update = function(w, I, h, S) {
|
|
11991
11991
|
return c.create(I, h, S).update(w);
|
|
11992
11992
|
}, L(c, F, p, a);
|
|
11993
|
-
},
|
|
11993
|
+
}, M = function(p, a) {
|
|
11994
11994
|
var m = ot[p], c = f(p, a, "hex");
|
|
11995
11995
|
return c.create = function(w, I, h) {
|
|
11996
11996
|
return new Bt(p, a, I).bytepad(["KMAC", h], m).bytepad([w], m);
|
|
@@ -12002,7 +12002,7 @@ var Hl = { exports: {} };
|
|
|
12002
12002
|
{ name: "sha3", padding: A, bits: E, createMethod: V },
|
|
12003
12003
|
{ name: "shake", padding: l, bits: z, createMethod: $ },
|
|
12004
12004
|
{ name: "cshake", padding: C, bits: z, createMethod: X },
|
|
12005
|
-
{ name: "kmac", padding: C, bits: z, createMethod:
|
|
12005
|
+
{ name: "kmac", padding: C, bits: z, createMethod: M }
|
|
12006
12006
|
], v = {}, D = [], it = 0; it < y.length; ++it)
|
|
12007
12007
|
for (var nt = y[it], K = nt.bits, ct = 0; ct < K.length; ++ct) {
|
|
12008
12008
|
var J = nt.name + "_" + K[ct];
|
|
@@ -12128,9 +12128,9 @@ var Hl = { exports: {} };
|
|
|
12128
12128
|
return this.encode(this.outputBits, !0), At.prototype.finalize.call(this);
|
|
12129
12129
|
};
|
|
12130
12130
|
var pt = function(p) {
|
|
12131
|
-
var a, m, c, w, I, h, S, W, N, at, It, ut, Lt, St, gt, dt, yt, vt, Ut, Vt, Dt, jt, zt, Nt, Kt, en, Zt, G, _, g,
|
|
12131
|
+
var a, m, c, w, I, h, S, W, N, at, It, ut, Lt, St, gt, dt, yt, vt, Ut, Vt, Dt, jt, zt, Nt, Kt, en, Zt, G, _, g, Q, R, q, k, U, j, Y, Z, H, et, ft, _t, lt, bt, mt, Ot, Ct, wt, ht, qt, Ht, Wt, On, pn, Ln, vn, An, bn, Pn, ln, on, wn, ce;
|
|
12132
12132
|
for (c = 0; c < 48; c += 2)
|
|
12133
|
-
w = p[0] ^ p[10] ^ p[20] ^ p[30] ^ p[40], I = p[1] ^ p[11] ^ p[21] ^ p[31] ^ p[41], h = p[2] ^ p[12] ^ p[22] ^ p[32] ^ p[42], S = p[3] ^ p[13] ^ p[23] ^ p[33] ^ p[43], W = p[4] ^ p[14] ^ p[24] ^ p[34] ^ p[44], N = p[5] ^ p[15] ^ p[25] ^ p[35] ^ p[45], at = p[6] ^ p[16] ^ p[26] ^ p[36] ^ p[46], It = p[7] ^ p[17] ^ p[27] ^ p[37] ^ p[47], ut = p[8] ^ p[18] ^ p[28] ^ p[38] ^ p[48], Lt = p[9] ^ p[19] ^ p[29] ^ p[39] ^ p[49], a = ut ^ (h << 1 | S >>> 31), m = Lt ^ (S << 1 | h >>> 31), p[0] ^= a, p[1] ^= m, p[10] ^= a, p[11] ^= m, p[20] ^= a, p[21] ^= m, p[30] ^= a, p[31] ^= m, p[40] ^= a, p[41] ^= m, a = w ^ (W << 1 | N >>> 31), m = I ^ (N << 1 | W >>> 31), p[2] ^= a, p[3] ^= m, p[12] ^= a, p[13] ^= m, p[22] ^= a, p[23] ^= m, p[32] ^= a, p[33] ^= m, p[42] ^= a, p[43] ^= m, a = h ^ (at << 1 | It >>> 31), m = S ^ (It << 1 | at >>> 31), p[4] ^= a, p[5] ^= m, p[14] ^= a, p[15] ^= m, p[24] ^= a, p[25] ^= m, p[34] ^= a, p[35] ^= m, p[44] ^= a, p[45] ^= m, a = W ^ (ut << 1 | Lt >>> 31), m = N ^ (Lt << 1 | ut >>> 31), p[6] ^= a, p[7] ^= m, p[16] ^= a, p[17] ^= m, p[26] ^= a, p[27] ^= m, p[36] ^= a, p[37] ^= m, p[46] ^= a, p[47] ^= m, a = at ^ (w << 1 | I >>> 31), m = It ^ (I << 1 | w >>> 31), p[8] ^= a, p[9] ^= m, p[18] ^= a, p[19] ^= m, p[28] ^= a, p[29] ^= m, p[38] ^= a, p[39] ^= m, p[48] ^= a, p[49] ^= m, St = p[0], gt = p[1], Ot = p[11] << 4 | p[10] >>> 28, Ct = p[10] << 4 | p[11] >>> 28, G = p[20] << 3 | p[21] >>> 29, _ = p[21] << 3 | p[20] >>> 29, ln = p[31] << 9 | p[30] >>> 23, on = p[30] << 9 | p[31] >>> 23, _t = p[40] << 18 | p[41] >>> 14, lt = p[41] << 18 | p[40] >>> 14, k = p[2] << 1 | p[3] >>> 31, U = p[3] << 1 | p[2] >>> 31, dt = p[13] << 12 | p[12] >>> 20, yt = p[12] << 12 | p[13] >>> 20, wt = p[22] << 10 | p[23] >>> 22, ht = p[23] << 10 | p[22] >>> 22, g = p[33] << 13 | p[32] >>> 19,
|
|
12133
|
+
w = p[0] ^ p[10] ^ p[20] ^ p[30] ^ p[40], I = p[1] ^ p[11] ^ p[21] ^ p[31] ^ p[41], h = p[2] ^ p[12] ^ p[22] ^ p[32] ^ p[42], S = p[3] ^ p[13] ^ p[23] ^ p[33] ^ p[43], W = p[4] ^ p[14] ^ p[24] ^ p[34] ^ p[44], N = p[5] ^ p[15] ^ p[25] ^ p[35] ^ p[45], at = p[6] ^ p[16] ^ p[26] ^ p[36] ^ p[46], It = p[7] ^ p[17] ^ p[27] ^ p[37] ^ p[47], ut = p[8] ^ p[18] ^ p[28] ^ p[38] ^ p[48], Lt = p[9] ^ p[19] ^ p[29] ^ p[39] ^ p[49], a = ut ^ (h << 1 | S >>> 31), m = Lt ^ (S << 1 | h >>> 31), p[0] ^= a, p[1] ^= m, p[10] ^= a, p[11] ^= m, p[20] ^= a, p[21] ^= m, p[30] ^= a, p[31] ^= m, p[40] ^= a, p[41] ^= m, a = w ^ (W << 1 | N >>> 31), m = I ^ (N << 1 | W >>> 31), p[2] ^= a, p[3] ^= m, p[12] ^= a, p[13] ^= m, p[22] ^= a, p[23] ^= m, p[32] ^= a, p[33] ^= m, p[42] ^= a, p[43] ^= m, a = h ^ (at << 1 | It >>> 31), m = S ^ (It << 1 | at >>> 31), p[4] ^= a, p[5] ^= m, p[14] ^= a, p[15] ^= m, p[24] ^= a, p[25] ^= m, p[34] ^= a, p[35] ^= m, p[44] ^= a, p[45] ^= m, a = W ^ (ut << 1 | Lt >>> 31), m = N ^ (Lt << 1 | ut >>> 31), p[6] ^= a, p[7] ^= m, p[16] ^= a, p[17] ^= m, p[26] ^= a, p[27] ^= m, p[36] ^= a, p[37] ^= m, p[46] ^= a, p[47] ^= m, a = at ^ (w << 1 | I >>> 31), m = It ^ (I << 1 | w >>> 31), p[8] ^= a, p[9] ^= m, p[18] ^= a, p[19] ^= m, p[28] ^= a, p[29] ^= m, p[38] ^= a, p[39] ^= m, p[48] ^= a, p[49] ^= m, St = p[0], gt = p[1], Ot = p[11] << 4 | p[10] >>> 28, Ct = p[10] << 4 | p[11] >>> 28, G = p[20] << 3 | p[21] >>> 29, _ = p[21] << 3 | p[20] >>> 29, ln = p[31] << 9 | p[30] >>> 23, on = p[30] << 9 | p[31] >>> 23, _t = p[40] << 18 | p[41] >>> 14, lt = p[41] << 18 | p[40] >>> 14, k = p[2] << 1 | p[3] >>> 31, U = p[3] << 1 | p[2] >>> 31, dt = p[13] << 12 | p[12] >>> 20, yt = p[12] << 12 | p[13] >>> 20, wt = p[22] << 10 | p[23] >>> 22, ht = p[23] << 10 | p[22] >>> 22, g = p[33] << 13 | p[32] >>> 19, Q = p[32] << 13 | p[33] >>> 19, wn = p[42] << 2 | p[43] >>> 30, ce = p[43] << 2 | p[42] >>> 30, pn = p[5] << 30 | p[4] >>> 2, Ln = p[4] << 30 | p[5] >>> 2, j = p[14] << 6 | p[15] >>> 26, Y = p[15] << 6 | p[14] >>> 26, vt = p[25] << 11 | p[24] >>> 21, Ut = p[24] << 11 | p[25] >>> 21, qt = p[34] << 15 | p[35] >>> 17, Ht = p[35] << 15 | p[34] >>> 17, R = p[45] << 29 | p[44] >>> 3, q = p[44] << 29 | p[45] >>> 3, Nt = p[6] << 28 | p[7] >>> 4, Kt = p[7] << 28 | p[6] >>> 4, vn = p[17] << 23 | p[16] >>> 9, An = p[16] << 23 | p[17] >>> 9, Z = p[26] << 25 | p[27] >>> 7, H = p[27] << 25 | p[26] >>> 7, Vt = p[36] << 21 | p[37] >>> 11, Dt = p[37] << 21 | p[36] >>> 11, Wt = p[47] << 24 | p[46] >>> 8, On = p[46] << 24 | p[47] >>> 8, bt = p[8] << 27 | p[9] >>> 5, mt = p[9] << 27 | p[8] >>> 5, en = p[18] << 20 | p[19] >>> 12, Zt = p[19] << 20 | p[18] >>> 12, bn = p[29] << 7 | p[28] >>> 25, Pn = p[28] << 7 | p[29] >>> 25, et = p[38] << 8 | p[39] >>> 24, ft = p[39] << 8 | p[38] >>> 24, jt = p[48] << 14 | p[49] >>> 18, zt = p[49] << 14 | p[48] >>> 18, p[0] = St ^ ~dt & vt, p[1] = gt ^ ~yt & Ut, p[10] = Nt ^ ~en & G, p[11] = Kt ^ ~Zt & _, p[20] = k ^ ~j & Z, p[21] = U ^ ~Y & H, p[30] = bt ^ ~Ot & wt, p[31] = mt ^ ~Ct & ht, p[40] = pn ^ ~vn & bn, p[41] = Ln ^ ~An & Pn, p[2] = dt ^ ~vt & Vt, p[3] = yt ^ ~Ut & Dt, p[12] = en ^ ~G & g, p[13] = Zt ^ ~_ & Q, p[22] = j ^ ~Z & et, p[23] = Y ^ ~H & ft, p[32] = Ot ^ ~wt & qt, p[33] = Ct ^ ~ht & Ht, p[42] = vn ^ ~bn & ln, p[43] = An ^ ~Pn & on, p[4] = vt ^ ~Vt & jt, p[5] = Ut ^ ~Dt & zt, p[14] = G ^ ~g & R, p[15] = _ ^ ~Q & q, p[24] = Z ^ ~et & _t, p[25] = H ^ ~ft & lt, p[34] = wt ^ ~qt & Wt, p[35] = ht ^ ~Ht & On, p[44] = bn ^ ~ln & wn, p[45] = Pn ^ ~on & ce, p[6] = Vt ^ ~jt & St, p[7] = Dt ^ ~zt & gt, p[16] = g ^ ~R & Nt, p[17] = Q ^ ~q & Kt, p[26] = et ^ ~_t & k, p[27] = ft ^ ~lt & U, p[36] = qt ^ ~Wt & bt, p[37] = Ht ^ ~On & mt, p[46] = ln ^ ~wn & pn, p[47] = on ^ ~ce & Ln, p[8] = jt ^ ~St & dt, p[9] = zt ^ ~gt & yt, p[18] = R ^ ~Nt & en, p[19] = q ^ ~Kt & Zt, p[28] = _t ^ ~k & j, p[29] = lt ^ ~U & Y, p[38] = Wt ^ ~bt & Ot, p[39] = On ^ ~mt & Ct, p[48] = wn ^ ~pn & vn, p[49] = ce ^ ~Ln & An, p[0] ^= P[c], p[1] ^= P[c + 1];
|
|
12134
12134
|
};
|
|
12135
12135
|
if (r)
|
|
12136
12136
|
o.exports = v;
|
|
@@ -12139,31 +12139,31 @@ var Hl = { exports: {} };
|
|
|
12139
12139
|
i[D[it]] = v[D[it]];
|
|
12140
12140
|
})();
|
|
12141
12141
|
})(Hl);
|
|
12142
|
-
function
|
|
12142
|
+
function Ma(o, t) {
|
|
12143
12143
|
return function() {
|
|
12144
12144
|
return o.apply(t, arguments);
|
|
12145
12145
|
};
|
|
12146
12146
|
}
|
|
12147
|
-
const { toString: Vl } = Object.prototype, { getPrototypeOf: mo } = Object,
|
|
12147
|
+
const { toString: Vl } = Object.prototype, { getPrototypeOf: mo } = Object, Ie = /* @__PURE__ */ ((o) => (t) => {
|
|
12148
12148
|
const n = Vl.call(t);
|
|
12149
12149
|
return o[n] || (o[n] = n.slice(8, -1).toLowerCase());
|
|
12150
|
-
})(/* @__PURE__ */ Object.create(null)), sn = (o) => (o = o.toLowerCase(), (t) =>
|
|
12150
|
+
})(/* @__PURE__ */ Object.create(null)), sn = (o) => (o = o.toLowerCase(), (t) => Ie(t) === o), Ce = (o) => (t) => typeof t === o, { isArray: Dn } = Array, Jn = Ce("undefined");
|
|
12151
12151
|
function jl(o) {
|
|
12152
12152
|
return o !== null && !Jn(o) && o.constructor !== null && !Jn(o.constructor) && nn(o.constructor.isBuffer) && o.constructor.isBuffer(o);
|
|
12153
12153
|
}
|
|
12154
|
-
const
|
|
12154
|
+
const Qa = sn("ArrayBuffer");
|
|
12155
12155
|
function $l(o) {
|
|
12156
12156
|
let t;
|
|
12157
|
-
return typeof ArrayBuffer < "u" && ArrayBuffer.isView ? t = ArrayBuffer.isView(o) : t = o && o.buffer &&
|
|
12157
|
+
return typeof ArrayBuffer < "u" && ArrayBuffer.isView ? t = ArrayBuffer.isView(o) : t = o && o.buffer && Qa(o.buffer), t;
|
|
12158
12158
|
}
|
|
12159
|
-
const Yl =
|
|
12160
|
-
if (
|
|
12159
|
+
const Yl = Ce("string"), nn = Ce("function"), Ua = Ce("number"), me = (o) => o !== null && typeof o == "object", Zl = (o) => o === !0 || o === !1, de = (o) => {
|
|
12160
|
+
if (Ie(o) !== "object")
|
|
12161
12161
|
return !1;
|
|
12162
12162
|
const t = mo(o);
|
|
12163
12163
|
return (t === null || t === Object.prototype || Object.getPrototypeOf(t) === null) && !(Symbol.toStringTag in o) && !(Symbol.iterator in o);
|
|
12164
|
-
}, Jl = sn("Date"), Wl = sn("File"), Xl = sn("Blob"), tr = sn("FileList"), nr = (o) =>
|
|
12164
|
+
}, Jl = sn("Date"), Wl = sn("File"), Xl = sn("Blob"), tr = sn("FileList"), nr = (o) => me(o) && nn(o.pipe), er = (o) => {
|
|
12165
12165
|
let t;
|
|
12166
|
-
return o && (typeof FormData == "function" && o instanceof FormData || nn(o.append) && ((t =
|
|
12166
|
+
return o && (typeof FormData == "function" && o instanceof FormData || nn(o.append) && ((t = Ie(o)) === "formdata" || // detect form-data instance
|
|
12167
12167
|
t === "object" && nn(o.toString) && o.toString() === "[object FormData]"));
|
|
12168
12168
|
}, or = sn("URLSearchParams"), ir = (o) => o.trim ? o.trim() : o.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, "");
|
|
12169
12169
|
function ie(o, t, { allOwnKeys: n = !1 } = {}) {
|
|
@@ -12190,17 +12190,17 @@ function za(o, t) {
|
|
|
12190
12190
|
return null;
|
|
12191
12191
|
}
|
|
12192
12192
|
const Ta = typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : typeof window < "u" ? window : global, Ra = (o) => !Jn(o) && o !== Ta;
|
|
12193
|
-
function
|
|
12193
|
+
function ao() {
|
|
12194
12194
|
const { caseless: o } = Ra(this) && this || {}, t = {}, n = (e, i) => {
|
|
12195
12195
|
const s = o && za(t, i) || i;
|
|
12196
|
-
de(t[s]) && de(e) ? t[s] =
|
|
12196
|
+
de(t[s]) && de(e) ? t[s] = ao(t[s], e) : de(e) ? t[s] = ao({}, e) : Dn(e) ? t[s] = e.slice() : t[s] = e;
|
|
12197
12197
|
};
|
|
12198
12198
|
for (let e = 0, i = arguments.length; e < i; e++)
|
|
12199
12199
|
arguments[e] && ie(arguments[e], n);
|
|
12200
12200
|
return t;
|
|
12201
12201
|
}
|
|
12202
12202
|
const ar = (o, t, n, { allOwnKeys: e } = {}) => (ie(t, (i, s) => {
|
|
12203
|
-
n && nn(i) ? o[s] =
|
|
12203
|
+
n && nn(i) ? o[s] = Ma(i, n) : o[s] = i;
|
|
12204
12204
|
}, { allOwnKeys: e }), o), cr = (o) => (o.charCodeAt(0) === 65279 && (o = o.slice(1)), o), sr = (o, t, n, e) => {
|
|
12205
12205
|
o.prototype = Object.create(t.prototype, e), o.prototype.constructor = o, Object.defineProperty(o, "super", {
|
|
12206
12206
|
value: t.prototype
|
|
@@ -12279,10 +12279,10 @@ const ar = (o, t, n, { allOwnKeys: e } = {}) => (ie(t, (i, s) => {
|
|
|
12279
12279
|
};
|
|
12280
12280
|
return Dn(o) ? e(o) : e(String(o).split(t)), n;
|
|
12281
12281
|
}, br = () => {
|
|
12282
|
-
}, yr = (o, t) => (o = +o, Number.isFinite(o) ? o : t),
|
|
12282
|
+
}, yr = (o, t) => (o = +o, Number.isFinite(o) ? o : t), Ne = "abcdefghijklmnopqrstuvwxyz", Ci = "0123456789", ka = {
|
|
12283
12283
|
DIGIT: Ci,
|
|
12284
|
-
ALPHA:
|
|
12285
|
-
ALPHA_DIGIT:
|
|
12284
|
+
ALPHA: Ne,
|
|
12285
|
+
ALPHA_DIGIT: Ne + Ne.toUpperCase() + Ci
|
|
12286
12286
|
}, Ir = (o = 16, t = ka.ALPHA_DIGIT) => {
|
|
12287
12287
|
let n = "";
|
|
12288
12288
|
const { length: e } = t;
|
|
@@ -12295,7 +12295,7 @@ function Cr(o) {
|
|
|
12295
12295
|
}
|
|
12296
12296
|
const mr = (o) => {
|
|
12297
12297
|
const t = new Array(10), n = (e, i) => {
|
|
12298
|
-
if (
|
|
12298
|
+
if (me(e)) {
|
|
12299
12299
|
if (t.indexOf(e) >= 0)
|
|
12300
12300
|
return;
|
|
12301
12301
|
if (!("toJSON" in e)) {
|
|
@@ -12310,17 +12310,17 @@ const mr = (o) => {
|
|
|
12310
12310
|
return e;
|
|
12311
12311
|
};
|
|
12312
12312
|
return n(o, 0);
|
|
12313
|
-
}, wr = sn("AsyncFunction"), Br = (o) => o && (
|
|
12313
|
+
}, wr = sn("AsyncFunction"), Br = (o) => o && (me(o) || nn(o)) && nn(o.then) && nn(o.catch);
|
|
12314
12314
|
var tt = {
|
|
12315
12315
|
isArray: Dn,
|
|
12316
|
-
isArrayBuffer:
|
|
12316
|
+
isArrayBuffer: Qa,
|
|
12317
12317
|
isBuffer: jl,
|
|
12318
12318
|
isFormData: er,
|
|
12319
12319
|
isArrayBufferView: $l,
|
|
12320
12320
|
isString: Yl,
|
|
12321
12321
|
isNumber: Ua,
|
|
12322
12322
|
isBoolean: Zl,
|
|
12323
|
-
isObject:
|
|
12323
|
+
isObject: me,
|
|
12324
12324
|
isPlainObject: de,
|
|
12325
12325
|
isUndefined: Jn,
|
|
12326
12326
|
isDate: Jl,
|
|
@@ -12333,13 +12333,13 @@ var tt = {
|
|
|
12333
12333
|
isTypedArray: ur,
|
|
12334
12334
|
isFileList: tr,
|
|
12335
12335
|
forEach: ie,
|
|
12336
|
-
merge:
|
|
12336
|
+
merge: ao,
|
|
12337
12337
|
extend: ar,
|
|
12338
12338
|
trim: ir,
|
|
12339
12339
|
stripBOM: cr,
|
|
12340
12340
|
inherits: sr,
|
|
12341
12341
|
toFlatObject: lr,
|
|
12342
|
-
kindOf:
|
|
12342
|
+
kindOf: Ie,
|
|
12343
12343
|
kindOfTest: sn,
|
|
12344
12344
|
endsWith: rr,
|
|
12345
12345
|
toArray: dr,
|
|
@@ -12416,7 +12416,7 @@ Pt.from = (o, t, n, e, i, s) => {
|
|
|
12416
12416
|
}, (r) => r !== "isAxiosError"), Pt.call(d, o.message, t, n, e, i), d.cause = o, d.name = o.name, s && Object.assign(d, s), d;
|
|
12417
12417
|
};
|
|
12418
12418
|
var Er = null;
|
|
12419
|
-
function
|
|
12419
|
+
function co(o) {
|
|
12420
12420
|
return tt.isPlainObject(o) || tt.isArray(o);
|
|
12421
12421
|
}
|
|
12422
12422
|
function Ka(o) {
|
|
@@ -12428,12 +12428,12 @@ function mi(o, t, n) {
|
|
|
12428
12428
|
}).join(n ? "." : "") : t;
|
|
12429
12429
|
}
|
|
12430
12430
|
function Fr(o) {
|
|
12431
|
-
return tt.isArray(o) && !o.some(
|
|
12431
|
+
return tt.isArray(o) && !o.some(co);
|
|
12432
12432
|
}
|
|
12433
12433
|
const xr = tt.toFlatObject(tt, {}, null, function(t) {
|
|
12434
12434
|
return /^is[A-Z]/.test(t);
|
|
12435
12435
|
});
|
|
12436
|
-
function
|
|
12436
|
+
function we(o, t, n) {
|
|
12437
12437
|
if (!tt.isObject(o))
|
|
12438
12438
|
throw new TypeError("target must be an object");
|
|
12439
12439
|
t = t || new FormData(), n = tt.toFlatObject(n, {
|
|
@@ -12469,12 +12469,12 @@ function me(o, t, n) {
|
|
|
12469
12469
|
);
|
|
12470
12470
|
}), !1;
|
|
12471
12471
|
}
|
|
12472
|
-
return
|
|
12472
|
+
return co(O) ? !0 : (t.append(mi(E, P, s), u(O)), !1);
|
|
12473
12473
|
}
|
|
12474
12474
|
const C = [], B = Object.assign(xr, {
|
|
12475
12475
|
defaultVisitor: l,
|
|
12476
12476
|
convertValue: u,
|
|
12477
|
-
isVisitable:
|
|
12477
|
+
isVisitable: co
|
|
12478
12478
|
});
|
|
12479
12479
|
function A(O, P) {
|
|
12480
12480
|
if (!tt.isUndefined(O)) {
|
|
@@ -12510,7 +12510,7 @@ function wi(o) {
|
|
|
12510
12510
|
});
|
|
12511
12511
|
}
|
|
12512
12512
|
function wo(o, t) {
|
|
12513
|
-
this._pairs = [], o &&
|
|
12513
|
+
this._pairs = [], o && we(o, this, t);
|
|
12514
12514
|
}
|
|
12515
12515
|
const Ha = wo.prototype;
|
|
12516
12516
|
Ha.append = function(t, n) {
|
|
@@ -12605,19 +12605,19 @@ var ja = {
|
|
|
12605
12605
|
},
|
|
12606
12606
|
protocols: ["http", "https", "file", "blob", "url", "data"]
|
|
12607
12607
|
};
|
|
12608
|
-
const $a = typeof window < "u" && typeof document < "u",
|
|
12608
|
+
const $a = typeof window < "u" && typeof document < "u", Mr = ((o) => $a && ["ReactNative", "NativeScript", "NS"].indexOf(o) < 0)(typeof navigator < "u" && navigator.product), Qr = typeof WorkerGlobalScope < "u" && // eslint-disable-next-line no-undef
|
|
12609
12609
|
self instanceof WorkerGlobalScope && typeof self.importScripts == "function";
|
|
12610
12610
|
var Ur = /* @__PURE__ */ Object.freeze({
|
|
12611
12611
|
__proto__: null,
|
|
12612
12612
|
hasBrowserEnv: $a,
|
|
12613
|
-
hasStandardBrowserEnv:
|
|
12614
|
-
hasStandardBrowserWebWorkerEnv:
|
|
12613
|
+
hasStandardBrowserEnv: Mr,
|
|
12614
|
+
hasStandardBrowserWebWorkerEnv: Qr
|
|
12615
12615
|
}), cn = {
|
|
12616
12616
|
...Ur,
|
|
12617
12617
|
...qr
|
|
12618
12618
|
};
|
|
12619
12619
|
function zr(o, t) {
|
|
12620
|
-
return
|
|
12620
|
+
return we(o, new cn.classes.URLSearchParams(), Object.assign({
|
|
12621
12621
|
visitor: function(n, e, i, s) {
|
|
12622
12622
|
return cn.isNode && tt.isBuffer(n) ? (this.append(e, n.toString("base64")), !1) : s.defaultVisitor.apply(this, arguments);
|
|
12623
12623
|
}
|
|
@@ -12680,7 +12680,7 @@ const Bo = {
|
|
|
12680
12680
|
return zr(t, this.formSerializer).toString();
|
|
12681
12681
|
if ((r = tt.isFileList(t)) || e.indexOf("multipart/form-data") > -1) {
|
|
12682
12682
|
const b = this.env && this.env.FormData;
|
|
12683
|
-
return
|
|
12683
|
+
return we(
|
|
12684
12684
|
r ? { "files[]": t } : t,
|
|
12685
12685
|
b && new b(),
|
|
12686
12686
|
this.formSerializer
|
|
@@ -12771,7 +12771,7 @@ function Gr(o) {
|
|
|
12771
12771
|
return t;
|
|
12772
12772
|
}
|
|
12773
12773
|
const Kr = (o) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(o.trim());
|
|
12774
|
-
function
|
|
12774
|
+
function Ge(o, t, n, e, i) {
|
|
12775
12775
|
if (tt.isFunction(e))
|
|
12776
12776
|
return e.call(this, t, n);
|
|
12777
12777
|
if (i && (t = n), !!tt.isString(t)) {
|
|
@@ -12795,7 +12795,7 @@ function Vr(o, t) {
|
|
|
12795
12795
|
});
|
|
12796
12796
|
});
|
|
12797
12797
|
}
|
|
12798
|
-
class
|
|
12798
|
+
class Be {
|
|
12799
12799
|
constructor(t) {
|
|
12800
12800
|
t && this.set(t);
|
|
12801
12801
|
}
|
|
@@ -12831,7 +12831,7 @@ class we {
|
|
|
12831
12831
|
has(t, n) {
|
|
12832
12832
|
if (t = Vn(t), t) {
|
|
12833
12833
|
const e = tt.findKey(this, t);
|
|
12834
|
-
return !!(e && this[e] !== void 0 && (!n ||
|
|
12834
|
+
return !!(e && this[e] !== void 0 && (!n || Ge(this, this[e], e, n)));
|
|
12835
12835
|
}
|
|
12836
12836
|
return !1;
|
|
12837
12837
|
}
|
|
@@ -12841,7 +12841,7 @@ class we {
|
|
|
12841
12841
|
function s(d) {
|
|
12842
12842
|
if (d = Vn(d), d) {
|
|
12843
12843
|
const r = tt.findKey(e, d);
|
|
12844
|
-
r && (!n ||
|
|
12844
|
+
r && (!n || Ge(e, e[r], r, n)) && (delete e[r], i = !0);
|
|
12845
12845
|
}
|
|
12846
12846
|
}
|
|
12847
12847
|
return tt.isArray(t) ? t.forEach(s) : s(t), i;
|
|
@@ -12851,7 +12851,7 @@ class we {
|
|
|
12851
12851
|
let e = n.length, i = !1;
|
|
12852
12852
|
for (; e--; ) {
|
|
12853
12853
|
const s = n[e];
|
|
12854
|
-
(!t ||
|
|
12854
|
+
(!t || Ge(this, this[s], s, t, !0)) && (delete this[s], i = !0);
|
|
12855
12855
|
}
|
|
12856
12856
|
return i;
|
|
12857
12857
|
}
|
|
@@ -12904,8 +12904,8 @@ class we {
|
|
|
12904
12904
|
return tt.isArray(t) ? t.forEach(s) : s(t), this;
|
|
12905
12905
|
}
|
|
12906
12906
|
}
|
|
12907
|
-
|
|
12908
|
-
tt.reduceDescriptors(
|
|
12907
|
+
Be.accessor(["Content-Type", "Content-Length", "Accept", "Accept-Encoding", "User-Agent", "Authorization"]);
|
|
12908
|
+
tt.reduceDescriptors(Be.prototype, ({ value: o }, t) => {
|
|
12909
12909
|
let n = t[0].toUpperCase() + t.slice(1);
|
|
12910
12910
|
return {
|
|
12911
12911
|
get: () => o,
|
|
@@ -12914,9 +12914,9 @@ tt.reduceDescriptors(we.prototype, ({ value: o }, t) => {
|
|
|
12914
12914
|
}
|
|
12915
12915
|
};
|
|
12916
12916
|
});
|
|
12917
|
-
tt.freezeMethods(
|
|
12918
|
-
var fn =
|
|
12919
|
-
function
|
|
12917
|
+
tt.freezeMethods(Be);
|
|
12918
|
+
var fn = Be;
|
|
12919
|
+
function Ke(o, t) {
|
|
12920
12920
|
const n = this || Eo, e = t || n, i = fn.from(e.headers);
|
|
12921
12921
|
let s = e.data;
|
|
12922
12922
|
return tt.forEach(o, function(r) {
|
|
@@ -13124,11 +13124,11 @@ var nd = td && function(o) {
|
|
|
13124
13124
|
C.send(i || null);
|
|
13125
13125
|
});
|
|
13126
13126
|
};
|
|
13127
|
-
const
|
|
13127
|
+
const so = {
|
|
13128
13128
|
http: Er,
|
|
13129
13129
|
xhr: nd
|
|
13130
13130
|
};
|
|
13131
|
-
tt.forEach(
|
|
13131
|
+
tt.forEach(so, (o, t) => {
|
|
13132
13132
|
if (o) {
|
|
13133
13133
|
try {
|
|
13134
13134
|
Object.defineProperty(o, "name", { value: t });
|
|
@@ -13147,7 +13147,7 @@ var Wa = {
|
|
|
13147
13147
|
for (let s = 0; s < t; s++) {
|
|
13148
13148
|
n = o[s];
|
|
13149
13149
|
let d;
|
|
13150
|
-
if (e = n, !ed(n) && (e =
|
|
13150
|
+
if (e = n, !ed(n) && (e = so[(d = String(n)).toLowerCase()], e === void 0))
|
|
13151
13151
|
throw new Pt(`Unknown adapter '${d}'`);
|
|
13152
13152
|
if (e)
|
|
13153
13153
|
break;
|
|
@@ -13167,24 +13167,24 @@ var Wa = {
|
|
|
13167
13167
|
}
|
|
13168
13168
|
return e;
|
|
13169
13169
|
},
|
|
13170
|
-
adapters:
|
|
13170
|
+
adapters: so
|
|
13171
13171
|
};
|
|
13172
|
-
function
|
|
13172
|
+
function He(o) {
|
|
13173
13173
|
if (o.cancelToken && o.cancelToken.throwIfRequested(), o.signal && o.signal.aborted)
|
|
13174
13174
|
throw new ae(null, o);
|
|
13175
13175
|
}
|
|
13176
13176
|
function Si(o) {
|
|
13177
|
-
return
|
|
13177
|
+
return He(o), o.headers = fn.from(o.headers), o.data = Ke.call(
|
|
13178
13178
|
o,
|
|
13179
13179
|
o.transformRequest
|
|
13180
13180
|
), ["post", "put", "patch"].indexOf(o.method) !== -1 && o.headers.setContentType("application/x-www-form-urlencoded", !1), Wa.getAdapter(o.adapter || Eo.adapter)(o).then(function(e) {
|
|
13181
|
-
return
|
|
13181
|
+
return He(o), e.data = Ke.call(
|
|
13182
13182
|
o,
|
|
13183
13183
|
o.transformResponse,
|
|
13184
13184
|
e
|
|
13185
13185
|
), e.headers = fn.from(e.headers), e;
|
|
13186
13186
|
}, function(e) {
|
|
13187
|
-
return Za(e) || (
|
|
13187
|
+
return Za(e) || (He(o), e && e.response && (e.response.data = Ke.call(
|
|
13188
13188
|
o,
|
|
13189
13189
|
o.transformResponse,
|
|
13190
13190
|
e.response
|
|
@@ -13300,11 +13300,11 @@ function od(o, t, n) {
|
|
|
13300
13300
|
throw new Pt("Unknown option " + s, Pt.ERR_BAD_OPTION);
|
|
13301
13301
|
}
|
|
13302
13302
|
}
|
|
13303
|
-
var
|
|
13303
|
+
var lo = {
|
|
13304
13304
|
assertOptions: od,
|
|
13305
13305
|
validators: Fo
|
|
13306
13306
|
};
|
|
13307
|
-
const In =
|
|
13307
|
+
const In = lo.validators;
|
|
13308
13308
|
class pe {
|
|
13309
13309
|
constructor(t) {
|
|
13310
13310
|
this.defaults = t, this.interceptors = {
|
|
@@ -13337,13 +13337,13 @@ class pe {
|
|
|
13337
13337
|
_request(t, n) {
|
|
13338
13338
|
typeof t == "string" ? (n = n || {}, n.url = t) : n = t || {}, n = Tn(this.defaults, n);
|
|
13339
13339
|
const { transitional: e, paramsSerializer: i, headers: s } = n;
|
|
13340
|
-
e !== void 0 &&
|
|
13340
|
+
e !== void 0 && lo.assertOptions(e, {
|
|
13341
13341
|
silentJSONParsing: In.transitional(In.boolean),
|
|
13342
13342
|
forcedJSONParsing: In.transitional(In.boolean),
|
|
13343
13343
|
clarifyTimeoutError: In.transitional(In.boolean)
|
|
13344
13344
|
}, !1), i != null && (tt.isFunction(i) ? n.paramsSerializer = {
|
|
13345
13345
|
serialize: i
|
|
13346
|
-
} :
|
|
13346
|
+
} : lo.assertOptions(i, {
|
|
13347
13347
|
encode: In.function,
|
|
13348
13348
|
serialize: In.function
|
|
13349
13349
|
}, !0)), n.method = (n.method || this.defaults.method || "get").toLowerCase();
|
|
@@ -13501,7 +13501,7 @@ function ad(o) {
|
|
|
13501
13501
|
function cd(o) {
|
|
13502
13502
|
return tt.isObject(o) && o.isAxiosError === !0;
|
|
13503
13503
|
}
|
|
13504
|
-
const
|
|
13504
|
+
const ro = {
|
|
13505
13505
|
Continue: 100,
|
|
13506
13506
|
SwitchingProtocols: 101,
|
|
13507
13507
|
Processing: 102,
|
|
@@ -13566,12 +13566,12 @@ const lo = {
|
|
|
13566
13566
|
NotExtended: 510,
|
|
13567
13567
|
NetworkAuthenticationRequired: 511
|
|
13568
13568
|
};
|
|
13569
|
-
Object.entries(
|
|
13570
|
-
|
|
13569
|
+
Object.entries(ro).forEach(([o, t]) => {
|
|
13570
|
+
ro[t] = o;
|
|
13571
13571
|
});
|
|
13572
|
-
var sd =
|
|
13572
|
+
var sd = ro;
|
|
13573
13573
|
function tc(o) {
|
|
13574
|
-
const t = new _e(o), n =
|
|
13574
|
+
const t = new _e(o), n = Ma(_e.prototype.request, t);
|
|
13575
13575
|
return tt.extend(n, _e.prototype, t, { allOwnKeys: !0 }), tt.extend(n, t, null, { allOwnKeys: !0 }), n.create = function(i) {
|
|
13576
13576
|
return tc(Tn(o, i));
|
|
13577
13577
|
}, n;
|
|
@@ -13582,7 +13582,7 @@ Rt.CanceledError = ae;
|
|
|
13582
13582
|
Rt.CancelToken = id;
|
|
13583
13583
|
Rt.isCancel = Za;
|
|
13584
13584
|
Rt.VERSION = Xa;
|
|
13585
|
-
Rt.toFormData =
|
|
13585
|
+
Rt.toFormData = we;
|
|
13586
13586
|
Rt.AxiosError = Pt;
|
|
13587
13587
|
Rt.Cancel = Rt.CanceledError;
|
|
13588
13588
|
Rt.all = function(t) {
|
|
@@ -13596,7 +13596,7 @@ Rt.formToJSON = (o) => Ya(tt.isHTMLForm(o) ? new FormData(o) : o);
|
|
|
13596
13596
|
Rt.getAdapter = Wa.getAdapter;
|
|
13597
13597
|
Rt.HttpStatusCode = sd;
|
|
13598
13598
|
Rt.default = Rt;
|
|
13599
|
-
const
|
|
13599
|
+
const Le = new nc(), Pi = async (o) => {
|
|
13600
13600
|
const { data: t } = await Rt.get(o, { responseType: "arraybuffer" });
|
|
13601
13601
|
return new Uint8Array(t);
|
|
13602
13602
|
}, ld = async (o) => {
|
|
@@ -13610,25 +13610,24 @@ const ro = new nc(), Pi = async (o) => {
|
|
|
13610
13610
|
} = o.metadata;
|
|
13611
13611
|
let b = n, u = e, l, C;
|
|
13612
13612
|
const B = b.startsWith("https://");
|
|
13613
|
-
if (
|
|
13613
|
+
if (Fe && !B) {
|
|
13614
13614
|
Oo ? (b = `libs/hardhat/test/circuits/${n}`, u = `libs/hardhat/test/circuits/${e}`) : !Oo && d && (b = `test/circuits/${n}`, u = `test/circuits/${e}`);
|
|
13615
13615
|
const z = require("path");
|
|
13616
13616
|
b = z.resolve(b), u = z.resolve(u);
|
|
13617
13617
|
}
|
|
13618
|
-
|
|
13618
|
+
Fe && B ? (l = await Pi(b), C = await Pi(u)) : i === r.localhost && !Fe && (b = `${s}/${n}`, u = `${s}/${e}`);
|
|
13619
13619
|
const { proof: A, publicSignals: O } = await yi.fullProve(
|
|
13620
13620
|
t,
|
|
13621
13621
|
l ?? b,
|
|
13622
13622
|
C ?? u
|
|
13623
13623
|
), P = await yi.exportSolidityCallData(A, O), E = JSON.parse(`[${P}]`);
|
|
13624
|
-
|
|
13624
|
+
Le.postMessageToMainThread({ zkCallData: E, proof: A, publicSignals: O });
|
|
13625
13625
|
} catch (t) {
|
|
13626
|
-
console.error(t),
|
|
13626
|
+
console.error(t), Le.postErrorToMainThread(t);
|
|
13627
13627
|
}
|
|
13628
13628
|
};
|
|
13629
|
-
|
|
13630
|
-
|
|
13631
|
-
|
|
13632
|
-
|
|
13633
|
-
|
|
13634
|
-
};
|
|
13629
|
+
Le.attachWorkerSideOnMessage(ld);
|
|
13630
|
+
const rd = Le;
|
|
13631
|
+
addEventListener("message", (o) => {
|
|
13632
|
+
rd.onWorkerMessage(o.data);
|
|
13633
|
+
});
|