solutions/zokrates_prover/.zokrates/stdlib/utils/multiplexer/lookup2bit.zok

7 lines
315 B
Plaintext
Raw Permalink Normal View History

2023-12-05 06:06:28 +00:00
// Two-bit window lookup table using one constraint
// Maps the bits `b` to a list of field elements `c`
def main(bool[2] b, field[4] c) -> field {
field alpha = c[1] - c[0] + (b[1] ? (c[3] - c[2] - c[1] + c[0]) : 0);
field out = (b[0] ? alpha : 0) + c[0] - (b[1] ? (0 - c[2] + c[0]) : 0);
return out;
}