/* Copyright 2018 0kims association. This file is part of zksnark JavaScript library. zksnark JavaScript library is a free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. zksnark JavaScript library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with zksnark JavaScript library. If not, see . */ const bigInt = require("./bigint.js"); const BN128 = require("./bn128.js"); const PolField = require("./polfield.js"); const ZqField = require("./zqfield.js"); const RatField = require("./ratfield.js"); const bn128 = new BN128(); const G1 = bn128.G1; const G2 = bn128.G2; const PolF = new PolField(new ZqField(bn128.r)); const RatPolF = new PolField(new RatField(new ZqField(bn128.r))); const F = new ZqField(bn128.r); module.exports = function setup(circuit) { const setup = { vk_proof : { nVars: circuit.nVars, nPublic: circuit.nPubInputs + circuit.nOutputs }, vk_verifier: { nPublic: circuit.nPubInputs + circuit.nOutputs }, toxic: {} }; calculatePolynomials(setup, circuit); setup.toxic.t = F.random(); calculateEncriptedValuesAtT(setup, circuit); calculateHexps(setup, circuit); return setup; }; function calculatePolynomials(setup, circuit) { // Calculate the points that must cross each polynomial /* setup.toxic.aExtra = []; setup.toxic.bExtra = []; setup.toxic.cExtra = []; const aPoints = []; const bPoints = []; const cPoints = []; for (let s = 0; s