Struct libpaillier::EncryptionKey
source · pub struct EncryptionKey { /* private fields */ }
Expand description
A Paillier encryption key
Implementations§
source§impl EncryptionKey
impl EncryptionKey
sourcepub fn encrypt<M>(&self, x: M, r: Option<Nonce>) -> Option<(Ciphertext, Nonce)>
pub fn encrypt<M>(&self, x: M, r: Option<Nonce>) -> Option<(Ciphertext, Nonce)>
Encrypt a given message with the encryption key and optionally use a random value x must be less than N
sourcepub fn add(&self, c1: &Ciphertext, c2: &Ciphertext) -> Option<Ciphertext>
pub fn add(&self, c1: &Ciphertext, c2: &Ciphertext) -> Option<Ciphertext>
Combines two Paillier ciphertexts commonly denoted in text as c1 \bigoplus c2
sourcepub fn mul(&self, c: &Ciphertext, a: &BigNumber) -> Option<Ciphertext>
pub fn mul(&self, c: &Ciphertext, a: &BigNumber) -> Option<Ciphertext>
Equivalent to adding two Paillier exponents
Trait Implementations§
source§impl Clone for EncryptionKey
impl Clone for EncryptionKey
source§fn clone(&self) -> EncryptionKey
fn clone(&self) -> EncryptionKey
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for EncryptionKey
impl Debug for EncryptionKey
source§impl<'de> Deserialize<'de> for EncryptionKey
impl<'de> Deserialize<'de> for EncryptionKey
source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl From<&DecryptionKey> for EncryptionKey
impl From<&DecryptionKey> for EncryptionKey
source§fn from(sk: &DecryptionKey) -> EncryptionKey
fn from(sk: &DecryptionKey) -> EncryptionKey
Converts to this type from the input type.
source§impl Serialize for EncryptionKey
impl Serialize for EncryptionKey
Auto Trait Implementations§
impl RefUnwindSafe for EncryptionKey
impl Send for EncryptionKey
impl Sync for EncryptionKey
impl Unpin for EncryptionKey
impl UnwindSafe for EncryptionKey
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