pub struct BfvEngine { /* private fields */ }Expand description
One BFV key/evaluation context using parameters selected for ~128-bit security.
Implementations§
Source§impl BfvEngine
impl BfvEngine
Sourcepub fn generate_128_bit(key_id_hash: u64) -> Result<Self, HeError>
pub fn generate_128_bit(key_id_hash: u64) -> Result<Self, HeError>
Generate a new BFV context. This is intentionally explicit and potentially
expensive; PrivacyEngine::new() never generates cryptographic keys.
pub const fn key_id_hash(&self) -> u64
pub const fn parameter_fingerprint(&self) -> u64
pub const fn serialized_context_bytes(&self) -> usize
pub fn plaintext_modulus(&self) -> u64
pub fn signed_plaintext_limit(&self) -> i64
Sourcepub fn encrypt_i64(
&self,
store_id: u64,
values: &[i64],
) -> Result<BfvCiphertext, HeError>
pub fn encrypt_i64( &self, store_id: u64, values: &[i64], ) -> Result<BfvCiphertext, HeError>
Encrypt signed packed integers with the public key.
Sourcepub fn add(
&self,
store_id: u64,
left: &BfvCiphertext,
right: &BfvCiphertext,
) -> Result<BfvCiphertext, HeError>
pub fn add( &self, store_id: u64, left: &BfvCiphertext, right: &BfvCiphertext, ) -> Result<BfvCiphertext, HeError>
Homomorphic packed addition.
Sourcepub fn multiply(
&self,
store_id: u64,
left: &BfvCiphertext,
right: &BfvCiphertext,
) -> Result<BfvCiphertext, HeError>
pub fn multiply( &self, store_id: u64, left: &BfvCiphertext, right: &BfvCiphertext, ) -> Result<BfvCiphertext, HeError>
Homomorphic packed element-wise multiplication followed by relinearization.
Sourcepub fn dot_product(
&self,
store_id: u64,
left: &BfvCiphertext,
right: &BfvCiphertext,
) -> Result<BfvCiphertext, HeError>
pub fn dot_product( &self, store_id: u64, left: &BfvCiphertext, right: &BfvCiphertext, ) -> Result<BfvCiphertext, HeError>
Homomorphic packed dot product. The result is repeated by the BFV inner-sum rotation circuit; callers read slot zero.
Sourcepub fn decrypt_i64_into(
&self,
ciphertext: &BfvCiphertext,
out: &mut [i64],
) -> Result<usize, HeError>
pub fn decrypt_i64_into( &self, ciphertext: &BfvCiphertext, out: &mut [i64], ) -> Result<usize, HeError>
Decrypt into a caller-owned buffer. Only the originally packed slots are copied.
Sourcepub fn serialize_into(
&self,
ciphertext: &BfvCiphertext,
out: &mut [u8],
) -> Result<usize, HeError>
pub fn serialize_into( &self, ciphertext: &BfvCiphertext, out: &mut [u8], ) -> Result<usize, HeError>
Serialize into a caller-owned external ciphertext store.
Sourcepub fn deserialize(
&self,
store_id: u64,
slot_count: usize,
bytes: &[u8],
) -> Result<BfvCiphertext, HeError>
pub fn deserialize( &self, store_id: u64, slot_count: usize, bytes: &[u8], ) -> Result<BfvCiphertext, HeError>
Restore a ciphertext from external storage and recompute its commitment.
Sourcepub fn deserialize_verified(
&self,
reference: HeCiphertextRef,
bytes: &[u8],
) -> Result<BfvCiphertext, HeError>
pub fn deserialize_verified( &self, reference: HeCiphertextRef, bytes: &[u8], ) -> Result<BfvCiphertext, HeError>
Restore bytes only when they match a previously issued ABI reference.
Auto Trait Implementations§
impl Freeze for BfvEngine
impl RefUnwindSafe for BfvEngine
impl Send for BfvEngine
impl Sync for BfvEngine
impl Unpin for BfvEngine
impl UnsafeUnpin for BfvEngine
impl UnwindSafe for BfvEngine
Blanket Implementations§
§impl<S, A> Aggregate<Result<S, Error>> for Awhere
A: Aggregate<S>,
impl<S, A> Aggregate<Result<S, Error>> for Awhere
A: Aggregate<S>,
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more