pub struct FheEngine { /* private fields */ }Expand description
The main FHE engine
Implementations§
Source§impl FheEngine
impl FheEngine
Sourcepub fn keygen(&mut self) -> &FheKeyPair
pub fn keygen(&mut self) -> &FheKeyPair
Generate key pair
Sourcepub fn encode_integers(&self, values: &[i64]) -> Plaintext
pub fn encode_integers(&self, values: &[i64]) -> Plaintext
Encode a vector of integers as plaintext
Sourcepub fn encode_floats(&self, values: &[f64]) -> Plaintext
pub fn encode_floats(&self, values: &[f64]) -> Plaintext
Encode a vector of floats as plaintext (CKKS)
Sourcepub fn encrypt(&mut self, plaintext: &Plaintext) -> Result<Ciphertext, FheError>
pub fn encrypt(&mut self, plaintext: &Plaintext) -> Result<Ciphertext, FheError>
Encrypt a plaintext
Sourcepub fn decrypt(
&mut self,
ciphertext: &Ciphertext,
) -> Result<Plaintext, FheError>
pub fn decrypt( &mut self, ciphertext: &Ciphertext, ) -> Result<Plaintext, FheError>
Decrypt a ciphertext
Sourcepub fn add(
&mut self,
a: &Ciphertext,
b: &Ciphertext,
) -> Result<Ciphertext, FheError>
pub fn add( &mut self, a: &Ciphertext, b: &Ciphertext, ) -> Result<Ciphertext, FheError>
Homomorphic addition
Sourcepub fn sub(
&mut self,
a: &Ciphertext,
b: &Ciphertext,
) -> Result<Ciphertext, FheError>
pub fn sub( &mut self, a: &Ciphertext, b: &Ciphertext, ) -> Result<Ciphertext, FheError>
Homomorphic subtraction
Sourcepub fn multiply(
&mut self,
a: &Ciphertext,
b: &Ciphertext,
) -> Result<Ciphertext, FheError>
pub fn multiply( &mut self, a: &Ciphertext, b: &Ciphertext, ) -> Result<Ciphertext, FheError>
Homomorphic multiplication
Sourcepub fn multiply_plain(
&mut self,
ct: &Ciphertext,
pt: &Plaintext,
) -> Result<Ciphertext, FheError>
pub fn multiply_plain( &mut self, ct: &Ciphertext, pt: &Plaintext, ) -> Result<Ciphertext, FheError>
Multiply ciphertext by plaintext
Sourcepub fn add_plain(
&mut self,
ct: &Ciphertext,
pt: &Plaintext,
) -> Result<Ciphertext, FheError>
pub fn add_plain( &mut self, ct: &Ciphertext, pt: &Plaintext, ) -> Result<Ciphertext, FheError>
Add plaintext to ciphertext
Sourcepub fn rotate(
&mut self,
ct: &Ciphertext,
steps: i32,
) -> Result<Ciphertext, FheError>
pub fn rotate( &mut self, ct: &Ciphertext, steps: i32, ) -> Result<Ciphertext, FheError>
Rotate ciphertext slots
Sourcepub fn rescale(&mut self, ct: &Ciphertext) -> Result<Ciphertext, FheError>
pub fn rescale(&mut self, ct: &Ciphertext) -> Result<Ciphertext, FheError>
Rescale (for CKKS - reduce scale after multiplication)
Sourcepub fn bootstrap(&mut self, ct: &Ciphertext) -> Result<Ciphertext, FheError>
pub fn bootstrap(&mut self, ct: &Ciphertext) -> Result<Ciphertext, FheError>
Bootstrap (refresh noise budget - expensive operation)
Sourcepub fn get_params(&self) -> &FheParams
pub fn get_params(&self) -> &FheParams
Get parameters
Trait Implementations§
Auto Trait Implementations§
impl Freeze for FheEngine
impl RefUnwindSafe for FheEngine
impl Send for FheEngine
impl Sync for FheEngine
impl Unpin for FheEngine
impl UnwindSafe for FheEngine
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more