pub struct FV<T> where
T: ArithUtils<T>, {
pub n: usize,
pub t: T,
pub q: T,
pub delta: T,
pub stdev: f64,
pub qdivtwo: T,
pub flooding_stdev: f64,
/* private fields */
}Expand description
(Additive only version of) the Fan-Vercauteren homomoprhic encryption scheme.
Fields
n: usizet: Tq: Tdelta: Tstdev: f64qdivtwo: Tflooding_stdev: f64Implementations
sourceimpl<T> FV<T> where
T: ArithUtils<T> + Clone + PartialEq + Serializable + From<u32>,
RqPoly<T>: FiniteRingElt + NTT<T>,
impl<T> FV<T> where
T: ArithUtils<T> + Clone + PartialEq + Serializable + From<u32>,
RqPoly<T>: FiniteRingElt + NTT<T>,
pub fn new(n: usize, q: &T) -> Self
pub fn new_with_ptxt_mod(n: usize, t: &T, q: &T) -> Self
pub fn from_bytes(&self, bytes: &Vec<u8>) -> FVCiphertext<T>
sourceimpl FV<Scalar>
impl FV<Scalar>
sourcepub fn default_2048() -> FV<Scalar>
pub fn default_2048() -> FV<Scalar>
Construct a scheme with default parameters and plaintext modulus 256.
sourcepub fn default_2048_with_plaintext_mod(t: u32) -> FV<Scalar>
pub fn default_2048_with_plaintext_mod(t: u32) -> FV<Scalar>
Construct a scheme with provided plaintext modulus.
Trait Implementations
sourceimpl<T> AdditiveHomomorphicScheme<(RqPoly<T>, RqPoly<T>), SecretKey<T>> for FV<T> where
RqPoly<T>: FiniteRingElt,
T: Clone + ArithUtils<T> + PartialEq + From<u32>,
impl<T> AdditiveHomomorphicScheme<(RqPoly<T>, RqPoly<T>), SecretKey<T>> for FV<T> where
RqPoly<T>: FiniteRingElt,
T: Clone + ArithUtils<T> + PartialEq + From<u32>,
sourcefn add_inplace(&self, ct1: &mut FVCiphertext<T>, ct2: &FVCiphertext<T>)
fn add_inplace(&self, ct1: &mut FVCiphertext<T>, ct2: &FVCiphertext<T>)
Add a ciphertext into another.
sourcefn rerandomize(&self, ct: &mut FVCiphertext<T>, pk: &FVCiphertext<T>)
fn rerandomize(&self, ct: &mut FVCiphertext<T>, pk: &FVCiphertext<T>)
Rerandomize a ciphertext in-place. The resulting ciphertext will decrypt to the same plaintext, while being unlinkable to the input ciphertext. Read more
sourceimpl<T> CipherPlainAddition<(RqPoly<T>, RqPoly<T>), Vec<T, Global>> for FV<T> where
RqPoly<T>: FiniteRingElt,
T: Clone + ArithUtils<T> + PartialEq,
impl<T> CipherPlainAddition<(RqPoly<T>, RqPoly<T>), Vec<T, Global>> for FV<T> where
RqPoly<T>: FiniteRingElt,
T: Clone + ArithUtils<T> + PartialEq,
sourcefn add_plain_inplace(&self, ct: &mut FVCiphertext<T>, pt: &FVPlaintext<T>)
fn add_plain_inplace(&self, ct: &mut FVCiphertext<T>, pt: &FVPlaintext<T>)
Add a plaintext into a ciphertext.
sourceimpl<T> CipherPlainAddition<(RqPoly<T>, RqPoly<T>), Vec<u8, Global>> for FV<T> where
RqPoly<T>: FiniteRingElt,
T: Clone + ArithUtils<T> + PartialEq + From<u32>,
impl<T> CipherPlainAddition<(RqPoly<T>, RqPoly<T>), Vec<u8, Global>> for FV<T> where
RqPoly<T>: FiniteRingElt,
T: Clone + ArithUtils<T> + PartialEq + From<u32>,
sourcefn add_plain_inplace(&self, ct: &mut FVCiphertext<T>, pt: &DefaultFVPlaintext)
fn add_plain_inplace(&self, ct: &mut FVCiphertext<T>, pt: &DefaultFVPlaintext)
Add a plaintext into a ciphertext.
sourceimpl<T> EncryptionOfZeros<(RqPoly<T>, RqPoly<T>), SecretKey<T>> for FV<T> where
RqPoly<T>: FiniteRingElt,
T: Clone + ArithUtils<T> + PartialEq + From<u32>,
impl<T> EncryptionOfZeros<(RqPoly<T>, RqPoly<T>), SecretKey<T>> for FV<T> where
RqPoly<T>: FiniteRingElt,
T: Clone + ArithUtils<T> + PartialEq + From<u32>,
sourcefn encrypt_zero(&self, pk: &FVCiphertext<T>) -> FVCiphertext<T>
fn encrypt_zero(&self, pk: &FVCiphertext<T>) -> FVCiphertext<T>
Generate a fresh encryption of the zero plaintext
sourcefn encrypt_zero_sk(&self, sk: &SecretKey<T>) -> FVCiphertext<T>
fn encrypt_zero_sk(&self, sk: &SecretKey<T>) -> FVCiphertext<T>
Use the secret key to generate a fresh encryption of zero
sourceimpl<T> KeyGeneration<(RqPoly<T>, RqPoly<T>), SecretKey<T>> for FV<T> where
RqPoly<T>: FiniteRingElt,
T: Clone + ArithUtils<T> + PartialEq + From<u32>,
impl<T> KeyGeneration<(RqPoly<T>, RqPoly<T>), SecretKey<T>> for FV<T> where
RqPoly<T>: FiniteRingElt,
T: Clone + ArithUtils<T> + PartialEq + From<u32>,
sourcefn generate_key(&self) -> SecretKey<T>
fn generate_key(&self) -> SecretKey<T>
Generate a secret key
sourcefn generate_keypair(&self) -> (FVCiphertext<T>, SecretKey<T>)
fn generate_keypair(&self) -> (FVCiphertext<T>, SecretKey<T>)
Generate a (pk, sk) keypair
sourceimpl<T> PKEncryption<(RqPoly<T>, RqPoly<T>), Vec<T, Global>, SecretKey<T>> for FV<T> where
RqPoly<T>: FiniteRingElt,
T: Clone + ArithUtils<T> + PartialEq + From<u32>,
impl<T> PKEncryption<(RqPoly<T>, RqPoly<T>), Vec<T, Global>, SecretKey<T>> for FV<T> where
RqPoly<T>: FiniteRingElt,
T: Clone + ArithUtils<T> + PartialEq + From<u32>,
sourcefn encrypt(&self, pt: &FVPlaintext<T>, pk: &FVCiphertext<T>) -> FVCiphertext<T>
fn encrypt(&self, pt: &FVPlaintext<T>, pk: &FVCiphertext<T>) -> FVCiphertext<T>
Encrypt a given plaintext
sourceimpl<T> PKEncryption<(RqPoly<T>, RqPoly<T>), Vec<u8, Global>, SecretKey<T>> for FV<T> where
RqPoly<T>: FiniteRingElt,
T: Clone + ArithUtils<T> + PartialEq + From<u32>,
impl<T> PKEncryption<(RqPoly<T>, RqPoly<T>), Vec<u8, Global>, SecretKey<T>> for FV<T> where
RqPoly<T>: FiniteRingElt,
T: Clone + ArithUtils<T> + PartialEq + From<u32>,
sourcefn encrypt(
&self,
pt: &DefaultFVPlaintext,
pk: &FVCiphertext<T>
) -> FVCiphertext<T>
fn encrypt(
&self,
pt: &DefaultFVPlaintext,
pk: &FVCiphertext<T>
) -> FVCiphertext<T>
Encrypt a given plaintext
sourceimpl<T> SKEncryption<(RqPoly<T>, RqPoly<T>), Vec<T, Global>, SecretKey<T>> for FV<T> where
RqPoly<T>: FiniteRingElt,
T: Clone + ArithUtils<T> + PartialEq + From<u32>,
impl<T> SKEncryption<(RqPoly<T>, RqPoly<T>), Vec<T, Global>, SecretKey<T>> for FV<T> where
RqPoly<T>: FiniteRingElt,
T: Clone + ArithUtils<T> + PartialEq + From<u32>,
sourcefn encrypt_sk(&self, pt: &FVPlaintext<T>, sk: &SecretKey<T>) -> FVCiphertext<T>
fn encrypt_sk(&self, pt: &FVPlaintext<T>, sk: &SecretKey<T>) -> FVCiphertext<T>
Encrypt a given plaintext
sourcefn decrypt(&self, ct: &FVCiphertext<T>, sk: &SecretKey<T>) -> FVPlaintext<T>
fn decrypt(&self, ct: &FVCiphertext<T>, sk: &SecretKey<T>) -> FVPlaintext<T>
Decrypt a ciphertext
sourceimpl<T> SKEncryption<(RqPoly<T>, RqPoly<T>), Vec<u8, Global>, SecretKey<T>> for FV<T> where
RqPoly<T>: FiniteRingElt,
T: Clone + ArithUtils<T> + PartialEq + From<u32>,
impl<T> SKEncryption<(RqPoly<T>, RqPoly<T>), Vec<u8, Global>, SecretKey<T>> for FV<T> where
RqPoly<T>: FiniteRingElt,
T: Clone + ArithUtils<T> + PartialEq + From<u32>,
sourcefn encrypt_sk(
&self,
pt: &DefaultFVPlaintext,
sk: &SecretKey<T>
) -> FVCiphertext<T>
fn encrypt_sk(
&self,
pt: &DefaultFVPlaintext,
sk: &SecretKey<T>
) -> FVCiphertext<T>
Encrypt a given plaintext
sourcefn decrypt(&self, ct: &FVCiphertext<T>, sk: &SecretKey<T>) -> DefaultFVPlaintext
fn decrypt(&self, ct: &FVCiphertext<T>, sk: &SecretKey<T>) -> DefaultFVPlaintext
Decrypt a ciphertext
Auto Trait Implementations
impl<T> RefUnwindSafe for FV<T> where
T: RefUnwindSafe,
impl<T> Send for FV<T> where
T: Send + Sync,
impl<T> Sync for FV<T> where
T: Send + Sync,
impl<T> Unpin for FV<T> where
T: Unpin,
impl<T> UnwindSafe for FV<T> where
T: UnwindSafe + RefUnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more