This commit is contained in:
poma 2019-12-29 21:29:59 +07:00
parent c9df6beaed
commit fba855ab74
No known key found for this signature in database
GPG Key ID: BA20CB01FE165657
8 changed files with 1572 additions and 1492 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

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

@ -2861,10 +2861,21 @@
"dev": true
},
"wasmbuilder": {
"version": "0.0.2",
"resolved": "https://registry.npmjs.org/wasmbuilder/-/wasmbuilder-0.0.2.tgz",
"integrity": "sha512-MxtqpzQ9IkiNkCWAyK8tglXazJ+4w9J4aKzY30PHi6i4kCbA4EGhzRCOX6Iq7sCNPH4z3ljPgZ3ckwEsLO7GGg==",
"dev": true
"version": "0.0.3",
"resolved": "https://registry.npmjs.org/wasmbuilder/-/wasmbuilder-0.0.3.tgz",
"integrity": "sha512-6+lhe2ong4zTG+XkqMduzXzNT1Lxiz9UpwgU4FJ+Ttx8zGeH3nOXROiyVqTRQr/l+NYw7KN5T009uAKaSOmMAQ==",
"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": {
"version": "1.3.1",

@ -47,7 +47,7 @@ async function build() {
buildF1(moduleBuilder, bn128.r, "fr", "frm");
buildCurve(moduleBuilder, "g1", "f1m");
buildMultiexp(moduleBuilder, "g1", "g1", "f1m", "fr");
buildFFT(moduleBuilder, "fft", "frm");
buildFFT(moduleBuilder, "fft", "frm", bigInt(7));
buildPol(moduleBuilder, "pol", "frm");
const pNonResidueF2 = moduleBuilder.alloc(

@ -20,7 +20,7 @@
const bigInt = require("big-integer");
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 n8 = n64*8;
@ -33,9 +33,14 @@ module.exports = function buildFFT(module, prefix, f1mPrefix) {
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);
w[maxBits] = nr.modPow(rem, q);

@ -23,7 +23,7 @@ function buildWasm() {
buildF1(moduleBuilder, r, "fr", "frm");
buildCurve(moduleBuilder, "g1", "f1m");
buildMultiexp(moduleBuilder, "g1", "g1", "f1m", "fr");
buildFFT(moduleBuilder, "fft", "frm");
buildFFT(moduleBuilder, "fft", "frm", bigInt(7));
buildPol(moduleBuilder, "pol", "frm");
const pNonResidueF2 = moduleBuilder.alloc(