Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const { bigInt, bn128 } = require('snarkjs');
const F = bn128.Fr;
// const Poseidon = require('../../node_modules/circomlib/src/poseidon.js');
const { poseidon } = require('circomlib');
function hash(arr) {
const poseidonHash = poseidon.createHash(6, 8, 57);
return poseidonHash(arr);
}
function multiHash(arr) {
// TODO check bigints inside finite field
let r = bigInt(0);
for (let i = 0; i < arr.length; i += 5) {
const fiveElems = [];
for (let j = 0; j < 5; j++) {
if (i + j < arr.length) {