mirror of
https://github.com/CryptKeeperZK/ffjavascript.git
synced 2026-01-09 16:17:56 -05:00
Fix sqrt
This commit is contained in:
12
.vscode/launch.json
vendored
12
.vscode/launch.json
vendored
@@ -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"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -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) {
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user