Crate fhe_util

Source
Expand description

Utilities for the fhe.rs library.

Functionsยง

catch_unwind
Define catch_unwind to silence the panic in unit tests.
inverse
Computes the modular multiplicative inverse of a modulo p. Returns None if a is not invertible modulo p.
is_prime
Returns whether the modulus p is prime; this function is 100% accurate.
sample_vec_cbd
Sample a vector of independent centered binomial distributions of a given variance. Returns an error if the variance is strictly larger than 16.
transcode_bidirectional
Transcodes a vector of u64 of input_nbits-bit numbers into a vector of u64 of output_nbits-bit numbers.
transcode_from_bytes
Transcodes a vector of u8 into a vector of u64 of nbits-bit numbers.
transcode_to_bytes
Transcodes a vector of u64 of nbits-bit numbers into a vector of bytes.
variance
Compute the sample variance of a list of values. Panics if the length of value is < 2.