zkutil/circuit.circom

15 lines
274 B
Plaintext
Raw Permalink Normal View History

2022-08-28 21:48:50 +03:00
template Num2Bits(n) {
signal input in;
signal output out[n];
var lc1=0;
for (var i = 0; i<n; i++) {
out[i] <-- (in >> i) & 1;
out[i] * (out[i] -1 ) === 0;
lc1 += out[i] * 2**i;
}
lc1 === in;
}
component main = Num2Bits(8);