This commit is contained in:
Jordi Baylina
2022-04-01 12:04:37 +02:00
parent e7eeb242df
commit 6eba608e6b
4 changed files with 19 additions and 6 deletions

12
.vscode/launch.json vendored
View File

@@ -15,6 +15,18 @@
"args": [
"${workspaceFolder}/test/bn128.js"
]
},
{
"type": "pwa-node",
"request": "launch",
"name": "Test Algebra",
"skipFiles": [
"<node_internals>/**"
],
"program": "${workspaceFolder}/node_modules/mocha/bin/_mocha",
"args": [
"${workspaceFolder}/test/algebra.js"
]
}
]
}

View File

@@ -1661,8 +1661,8 @@ class FFT {
this.G = G;
this.opMulGF = opMulGF;
let rem = F.sqrt_t;
let s = F.sqrt_s;
let rem = F.sqrt_t || F.t;
let s = F.sqrt_s || F.s;
let nqr = F.one;
while (F.eq(F.pow(nqr, F.half), F.one)) nqr = F.add(nqr, F.one);
@@ -1694,7 +1694,7 @@ class FFT {
this.roots.push(rootsi);
}
*/
this._setRoots(15);
this._setRoots(Math.min(s, 15));
}
_setRoots(n) {

View File

@@ -30,8 +30,8 @@ export default class FFT {
this.G = G;
this.opMulGF = opMulGF;
let rem = F.sqrt_t;
let s = F.sqrt_s;
let rem = F.sqrt_t || F.t;
let s = F.sqrt_s || F.s;
let nqr = F.one;
while (F.eq(F.pow(nqr, F.half), F.one)) nqr = F.add(nqr, F.one);
@@ -63,7 +63,7 @@ export default class FFT {
this.roots.push(rootsi);
}
*/
this._setRoots(15);
this._setRoots(Math.min(s, 15));
}
_setRoots(n) {

View File

@@ -16,6 +16,7 @@ describe("bn128", async function () {
let bn128;
before( async() => {
bn128 = await buildBn128();
console.log(bn128.Fr.toString(bn128.Fr.w[28]));
});
after( async() => {
bn128.terminate();