// Copyright (c) 2018 Jordi Baylina // License: LGPL-3.0+ // const Poseidon = require("./poseidon.js"); const Contract = require("./evmasm"); const SEED = "poseidon"; const NROUNDSF = 8; const NROUNDSP = 57; const T = 6; function toHex256(a) { let S = a.toString(16); while (S.length < 64) S="0"+S; return "0x" + S; } function createCode(t, nRoundsF, nRoundsP, seed) { if (typeof seed === "undefined") seed = SEED; if (typeof nRoundsF === "undefined") nRoundsF = NROUNDSF; if (typeof nRoundsP === "undefined") nRoundsP = NROUNDSP; if (typeof t === "undefined") t = T; const K = Poseidon.getConstants(t, seed, nRoundsP + nRoundsF); const M = Poseidon.getMatrix(t, seed, nRoundsP + nRoundsF); const C = new Contract(); function saveM() { for (let i=0; i=nRoundsP+nRoundsF/2)) { for (let j=0; j