pub struct Compiler { /* private fields */ }Expand description
A frontend compiler for Sunscreen FHE programs.
Implementations
sourceimpl Compiler
impl Compiler
sourcepub fn fhe_program<F>(self, fhe_program_fn: F) -> Selfwhere
F: FheProgramFn + Clone + 'static,
pub fn fhe_program<F>(self, fhe_program_fn: F) -> Selfwhere
F: FheProgramFn + Clone + 'static,
Add the given FHE program for compilation.
sourcepub fn find_params(self) -> Self
pub fn find_params(self) -> Self
Set the compiler to search for suitable encryption scheme parameters for the FHE program.
sourcepub fn plain_modulus_constraint(self, p: PlainModulusConstraint) -> Self
pub fn plain_modulus_constraint(self, p: PlainModulusConstraint) -> Self
Set the constraint the parameter search algorithm places on the plaintext modulus. You can either force the algorithm to use an exact value or any value that supports batching of at least n bits in length.
sourcepub fn with_params(self, params: &Params) -> Self
pub fn with_params(self, params: &Params) -> Self
Don’t use the parameter search algorithm, and instead explicitly set the scheme’s parameters. For expert use and may cause failures.
sourcepub fn security_level(self, security_level: SecurityLevel) -> Self
pub fn security_level(self, security_level: SecurityLevel) -> Self
Set the security level. If unspecified, the compiler assumes 128-bit security.
sourcepub fn additional_noise_budget(self, noise_margin: u32) -> Self
pub fn additional_noise_budget(self, noise_margin: u32) -> Self
The minimum number of bits of noise budget the search algorithm will leave for all outputs.
sourcepub fn compile(self) -> Result<Application>
pub fn compile(self) -> Result<Application>
Compile the FHE program. If successful, returns an
Application containing a compiled form of each
fhe_program argument.
Remarks
Each compiled FHE program in the returned Application
is compiled under the same Params so ciphertexts can be
used interchangeably between programs.
You must specify at least one fhe_program in the builder
before calling compile. compile returns a
Error::NoPrograms if you fail to do so.
Each specified FHE program must have a unique name,
regardless of its parent module or crate. compile returns
a Error::NameCollision if two or more FHE programs
have the same name.
Each FHE program must use the same scheme or compile
will return a Error::NameCollision error.