Expand description

Tools useful for interacting with fancy-garbling.

Note: all number representations in this library are little-endian.

Constants

Number of primes supported by our library.
Primes used in fancy garbling.

Traits

Extra Rng functionality, useful for fancy-garbling.

Functions

Convert x into base q.
Convert x into mixed radix form using the provided radii.
Generate a CRT modulus that support at least n-bit integers, using provided primes.
Generate the factors of a CRT modulus that support at least n-bit integers, using provided primes.
Add a base q slice ys into xs.
Compute the CRT representation of x with respect to the primes ps.
Compute the CRT representation of x with respect to the factorization of q.
Compute the value x given a list of CRT primes and residues.
Compute the value x given a composite CRT modulus provided by xs.
Determine how many mod q digits fit into a u128 (includes the color digit).
Factor using the primes in the global PRIMES array. Fancy garbling only supports composites with small prime factors.
Convert little-endian base q digits into u128.
Convert little-endian mixed radix digits into u128.
Generate deltas ahead of time for the Garbler.
Invert inp_a mod inp_b.
Raise a u16 to a power mod some value. Returns true if x is a power of 2.
Primes skipping the modulus 2, which allows certain gadgets. Generate a CRT modulus with n primes.
Generate a CRT modulus that support at least n-bit integers, using the built-in PRIMES.
Compute the output tweak for a garbled gate where i is the gate id and k is the value.
Generate the factors of a CRT modulus that support at least n-bit integers, using the built-in PRIMES.
Generate a CRT modulus that support at least n-bit integers, using the built-in PRIMES_SKIP_2 (does not include 2 as a factor). Compute the product of some u16s as a u128.
Tweak function for a single item.
Tweak function for two items.
Convert into a u128 from the “bits” as u16. Assumes each “bit” is 0 or 1.
Get the bits of a u128 encoded in 128 u16s, which is convenient for the rest of the library, which uses u16 as the base digit type in Wire.