solutions/zokrates_prover/.zokrates/stdlib/utils/casts/field_to_u8.zok

8 lines
246 B
Plaintext
Executable File

from "field" import FIELD_SIZE_IN_BITS;
import "utils/pack/bool/unpack";
import "utils/casts/u8_from_bits";
def main(field input) -> u8 {
bool[FIELD_SIZE_IN_BITS] bits = unpack(input);
return u8_from_bits(bits[FIELD_SIZE_IN_BITS-8..]);
}