mirror of
https://github.com/tornadocash/websnark.git
synced 2025-01-15 15:38:28 +01:00
phase2
This commit is contained in:
parent
c9df6beaed
commit
fba855ab74
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
2900
example/main.js
2900
example/main.js
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
19
package-lock.json
generated
19
package-lock.json
generated
@ -2861,10 +2861,21 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"wasmbuilder": {
|
"wasmbuilder": {
|
||||||
"version": "0.0.2",
|
"version": "0.0.3",
|
||||||
"resolved": "https://registry.npmjs.org/wasmbuilder/-/wasmbuilder-0.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/wasmbuilder/-/wasmbuilder-0.0.3.tgz",
|
||||||
"integrity": "sha512-MxtqpzQ9IkiNkCWAyK8tglXazJ+4w9J4aKzY30PHi6i4kCbA4EGhzRCOX6Iq7sCNPH4z3ljPgZ3ckwEsLO7GGg==",
|
"integrity": "sha512-6+lhe2ong4zTG+XkqMduzXzNT1Lxiz9UpwgU4FJ+Ttx8zGeH3nOXROiyVqTRQr/l+NYw7KN5T009uAKaSOmMAQ==",
|
||||||
"dev": true
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"big-integer": "^1.6.43"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"big-integer": {
|
||||||
|
"version": "1.6.48",
|
||||||
|
"resolved": "https://registry.npmjs.org/big-integer/-/big-integer-1.6.48.tgz",
|
||||||
|
"integrity": "sha512-j51egjPa7/i+RdiRuJbPdJ2FIUYYPhvYLjzoYbcMMm62ooO6F94fETG4MTs46zPAF9Brs04OajboA/qTGuz78w==",
|
||||||
|
"dev": true
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"which": {
|
"which": {
|
||||||
"version": "1.3.1",
|
"version": "1.3.1",
|
||||||
|
@ -47,7 +47,7 @@ async function build() {
|
|||||||
buildF1(moduleBuilder, bn128.r, "fr", "frm");
|
buildF1(moduleBuilder, bn128.r, "fr", "frm");
|
||||||
buildCurve(moduleBuilder, "g1", "f1m");
|
buildCurve(moduleBuilder, "g1", "f1m");
|
||||||
buildMultiexp(moduleBuilder, "g1", "g1", "f1m", "fr");
|
buildMultiexp(moduleBuilder, "g1", "g1", "f1m", "fr");
|
||||||
buildFFT(moduleBuilder, "fft", "frm");
|
buildFFT(moduleBuilder, "fft", "frm", bigInt(7));
|
||||||
buildPol(moduleBuilder, "pol", "frm");
|
buildPol(moduleBuilder, "pol", "frm");
|
||||||
|
|
||||||
const pNonResidueF2 = moduleBuilder.alloc(
|
const pNonResidueF2 = moduleBuilder.alloc(
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
const bigInt = require("big-integer");
|
const bigInt = require("big-integer");
|
||||||
const utils = require("./utils.js");
|
const utils = require("./utils.js");
|
||||||
|
|
||||||
module.exports = function buildFFT(module, prefix, f1mPrefix) {
|
module.exports = function buildFFT(module, prefix, f1mPrefix, overrideNr) {
|
||||||
|
|
||||||
const n64 = module.modules[f1mPrefix].n64;
|
const n64 = module.modules[f1mPrefix].n64;
|
||||||
const n8 = n64*8;
|
const n8 = n64*8;
|
||||||
@ -33,9 +33,14 @@ module.exports = function buildFFT(module, prefix, f1mPrefix) {
|
|||||||
rem = rem.shiftRight(1);
|
rem = rem.shiftRight(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
let nr = bigInt(2);
|
let nr;
|
||||||
|
|
||||||
while ( nr.modPow(q.shiftRight(1), q).equals(1) ) nr = nr.add(1);
|
if (overrideNr) {
|
||||||
|
nr = bigInt(overrideNr);
|
||||||
|
} else {
|
||||||
|
nr = bigInt(2);
|
||||||
|
while ( nr.modPow(q.shiftRight(1), q).equals(1) ) nr = nr.add(1);
|
||||||
|
}
|
||||||
|
|
||||||
const w = new Array(maxBits+1);
|
const w = new Array(maxBits+1);
|
||||||
w[maxBits] = nr.modPow(rem, q);
|
w[maxBits] = nr.modPow(rem, q);
|
||||||
|
@ -23,7 +23,7 @@ function buildWasm() {
|
|||||||
buildF1(moduleBuilder, r, "fr", "frm");
|
buildF1(moduleBuilder, r, "fr", "frm");
|
||||||
buildCurve(moduleBuilder, "g1", "f1m");
|
buildCurve(moduleBuilder, "g1", "f1m");
|
||||||
buildMultiexp(moduleBuilder, "g1", "g1", "f1m", "fr");
|
buildMultiexp(moduleBuilder, "g1", "g1", "f1m", "fr");
|
||||||
buildFFT(moduleBuilder, "fft", "frm");
|
buildFFT(moduleBuilder, "fft", "frm", bigInt(7));
|
||||||
buildPol(moduleBuilder, "pol", "frm");
|
buildPol(moduleBuilder, "pol", "frm");
|
||||||
|
|
||||||
const pNonResidueF2 = moduleBuilder.alloc(
|
const pNonResidueF2 = moduleBuilder.alloc(
|
||||||
|
Loading…
Reference in New Issue
Block a user