Set up monorepo

Signed-off-by: T-Hax <>
This commit is contained in:
T-Hax 2023-05-03 20:35:27 +00:00
commit 6006120e60
No known key found for this signature in database
357 changed files with 72219 additions and 0 deletions

View file

@ -0,0 +1,22 @@
const snarkjs = require("@tornado/snarkjs");
const bigInt = snarkjs.bigInt;
module.exports = function hexBits(cir, witness, sig, nBits) {
let v = bigInt(0);
for (let i=nBits-1; i>=0; i--) {
v = v.shiftLeft(1);
const name = sig+"["+i+"]";
const idx = cir.getSignalIdx(name);
const vbit = bigInt(witness[idx].toString());
if (vbit.equals(bigInt(1))) {
v = v.add(bigInt(1));
} else if (vbit.equals(bigInt(0))) {
v;
} else {
console.log("Not Binary: "+name);
}
}
return v.toString(16);
};