Comparing version 0.1.11 to 0.1.12
@@ -34,3 +34,7 @@ /* | ||
exports.stringifyBigInts = require("./src/stringifybigint.js").stringifyBigInts; | ||
exports.unstringifyBigInts = require("./src/stringifybigint.js").unstringifyBigInts; | ||
const Bn128 = require("./src/bn128.js"); | ||
exports.bn128 = new Bn128(); |
{ | ||
"name": "snarkjs", | ||
"version": "0.1.11", | ||
"version": "0.1.12", | ||
"description": "zkSNARKs implementation in JavaScript", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -33,3 +33,3 @@ /* | ||
this.r = bigInt("21888242871839275222246405745257275088548364400416034343698204186575808495617"); | ||
this.g1 = [ bigInt(1), bigInt(2) ]; | ||
this.g1 = [ bigInt(1), bigInt(2), bigInt(1)]; | ||
this.g2 = [ | ||
@@ -43,2 +43,6 @@ [ | ||
bigInt("4082367875863433681332203403145435568316851327593401208105741076214120093531") | ||
], | ||
[ | ||
bigInt("1"), | ||
bigInt("0") | ||
] | ||
@@ -224,3 +228,3 @@ ]; | ||
if (this.loopCountNef) | ||
if (this.loopCountNeg) | ||
{ | ||
@@ -227,0 +231,0 @@ f = this.F12.inverse(f); |
@@ -67,4 +67,4 @@ /* | ||
} | ||
// return ctx.witness.slice(0, circuit.nVars); | ||
return ctx.witness; | ||
return ctx.witness.slice(0, circuit.nVars); | ||
// return ctx.witness; | ||
} | ||
@@ -71,0 +71,0 @@ |
@@ -72,6 +72,4 @@ /* | ||
const h = calculateH(vk_proof, witness, PolF.F.zero, PolF.F.zero, PolF.F.zero); | ||
const h = calculateH(vk_proof, witness); | ||
// console.log(h.length + "/" + vk_proof.hExps.length); | ||
for (let i = 0; i < h.length; i++) { | ||
@@ -96,6 +94,7 @@ proof.pi_c = G1.add( proof.pi_c, G1.mulScalar( vk_proof.hExps[i], h[i])); | ||
return {proof, publicSignals}; | ||
}; | ||
function calculateH(vk_proof, witness, d1, d2, d3) { | ||
function calculateH(vk_proof, witness) { | ||
@@ -129,37 +128,5 @@ const F = PolF.F; | ||
const polZ_S = new Array(m+1).fill(F.zero); | ||
polZ_S[m] = F.one; | ||
polZ_S[0] = F.neg(F.one); | ||
const H_S = polABC_S.slice(m); | ||
let H_S = PolF.div(polABC_S, polZ_S); | ||
/* | ||
const H2S = PolF.mul(H_S, polZ_S); | ||
if (PolF.equals(H2S, polABC_S)) { | ||
console.log("Is Divisible!"); | ||
} else { | ||
console.log("ERROR: Not divisible!"); | ||
} | ||
*/ | ||
/* add coefficients of the polynomial (d2*A + d1*B - d3) + d1*d2*Z */ | ||
H_S = PolF.extend(H_S, m+1); | ||
for (let i=0; i<m; i++) { | ||
const d2A = PolF.F.mul(d2, polA_S[i]); | ||
const d1B = PolF.F.mul(d1, polB_S[i]); | ||
H_S[i] = PolF.F.add(H_S[i], PolF.F.add(d2A, d1B)); | ||
} | ||
H_S[0] = PolF.F.sub(H_S[0], d3); | ||
// Z = x^m -1 | ||
const d1d2 = PolF.F.mul(d1, d2); | ||
H_S[m] = PolF.F.add(H_S[m], d1d2); | ||
H_S[0] = PolF.F.sub(H_S[0], d1d2); | ||
H_S = PolF.reduce(PolF.affine(H_S)); | ||
return H_S; | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
264088
6355