Expand description
A module containing some utility functions useful for the runtime processing of range statements.
Functionsยง
- bit_
decomp - Convert the low
nbitsbits of the givenScalarto a vector ofChoice. The first element of the vector is the low bit. This version runs in constant time. - bit_
decomp_ vartime - Convert a
Scalarto anu128, assuming it fits in ani128and is nonnegative. Also output the number of bits of theScalar. This version assumes thatsis public, and so does not need to run in constant time. - bitrep_
scalars_ vartime - Given a
Scalarupper(strictly greater than 1), make a vector ofScalars with the property that aScalarxcan be written as a sum of zero or more (distinct) elements of this vector if and only if0 <= x < upper. - compute_
bitrep - Given a vector of
Scalars as output bybitrep_scalars_vartimeand a privateScalarx, output a vector ofChoice(of the same length as the givenbitrep_scalarsvector) such thatxis the sum of the chosen elements ofbitrep_scalars. This function should be constant time in the value ofx. Ifxis not less than theupperused bybitrep_scalars_vartimeto generatebitrep_scalars, thenxwill not (and indeed cannot) equal the sum of the chosen elements ofbitrep_scalars.