solutions/zokrates_prover/.zokrates/stdlib/utils/pack/bool/pack.zok

9 lines
181 B
Plaintext
Executable File

def main<N>(bool[N] bits) -> field {
field mut out = 0;
for u32 j in 0..N {
u32 i = N - (j + 1);
out = out + (bits[i] ? 2 ** j : 0);
}
return out;
}