lattice_bits
stdlib/lattice/lattice_bits.nbv
lattice_bits(v)
The field_bit_width! little-endian bits of the canonical value of a witness scalar, constrained to be bits, to recompose to the value and to be below the field characteristic (see lattice_assert_canonical). This is the decomposition the lattice sponge absorbs through; use lattice_bits_static for compile time values.
- Calls
calloc,bits/from_bits,lattice/lattice_assert_canonical,valloc- Precompiles
assert_eq!,clone!,constrain_eq!,constrain_mul!,field_bit_width!,len!,to_bits_unconstrained!- Used by
dilithium/lattice/lattice_permutation,lattice/lattice_bits_vec,slip/slip_r1cs_arg_verify
Source
# The `field_bit_width!` little-endian bits of the canonical value of a witness scalar,
# constrained to be bits, to recompose to the value and to be below the field characteristic
# (see lattice_assert_canonical). This is the decomposition the lattice sponge absorbs
# through; use lattice_bits_static for compile time values.
(v)
assert_eq! 1, len! v
static e = field_bit_width!
let bits = to_bits_unconstrained! v
assert_eq! e, len! bits
constrain_mul! (clone! bits), valloc(e, 1) - (clone! bits), calloc(e)
constrain_eq! v, from_bits(clone! bits)
let _ = lattice_assert_canonical(clone! bits)
bits