const bigInt = require("big-integer"); const ZnField = require("./znfield.js"); const PolField = require("./polfield.js"); const G1Curve = require("./g1curve"); const G2Curve = require("./g2curve"); const F = new ZnField(bigInt("21888242871839275222246405745257275088548364400416034343698204186575808495617")); const PolF = new PolField(F); const G1 = new G1Curve(); const G2 = new G2Curve(); module.exports = function setup(circuit) { const setup = { vk_proof : { nSignals: circuit.nSignals, nPublic: circuit.nPublic }, vk_verifier: { nPublic: circuit.nPublic }, toxic: {} }; calculatePolinomials(setup, circuit); setup.toxic.t = F.random(); calculateEncriptedValuesAtT(setup, circuit); calculateHexps(setup, circuit); }; function calculatePolinomials(setup, circuit) { // Calculate the points that must cross each polinomial const aPoints = []; const bPoints = []; const cPoints = []; for (let s = 0; circuit.nSignals; s++) { aPoints[s] = []; bPoints[s] = []; cPoints[s] = []; for (let c=0; c