pub struct RadixClientKey { /* private fields */ }
Expand description
Client key “specialized” for radix decomposition.
This key is a simple wrapper of the ClientKey, that only encrypt and decrypt in radix decomposition.
§Example
use concrete_integer::RadixClientKey;
use concrete_shortint::parameters::PARAM_MESSAGE_2_CARRY_2;
// 2 * 4 = 8 bits of message
let num_block = 4;
let cks = RadixClientKey::new(PARAM_MESSAGE_2_CARRY_2, num_block);
let msg = 167_u64;
let ct = cks.encrypt(msg);
// Decryption
let dec = cks.decrypt(&ct);
assert_eq!(msg, dec);
Implementations§
Source§impl RadixClientKey
impl RadixClientKey
pub fn new(parameters: Parameters, num_blocks: usize) -> Self
pub fn encrypt(&self, message: u64) -> RadixCiphertext
pub fn decrypt(&self, ciphertext: &RadixCiphertext) -> u64
Sourcepub fn parameters(&self) -> Parameters
pub fn parameters(&self) -> Parameters
Returns the parameters used by the client key.
pub fn encrypt_one_block(&self, message: u64) -> Ciphertext
pub fn decrypt_one_block(&self, ct: &Ciphertext) -> u64
Trait Implementations§
Source§impl AsRef<ClientKey> for RadixClientKey
impl AsRef<ClientKey> for RadixClientKey
Source§impl Clone for RadixClientKey
impl Clone for RadixClientKey
Source§fn clone(&self) -> RadixClientKey
fn clone(&self) -> RadixClientKey
Returns a duplicate 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 RadixClientKey
impl Debug for RadixClientKey
Source§impl<'de> Deserialize<'de> for RadixClientKey
impl<'de> Deserialize<'de> for RadixClientKey
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 PartialEq for RadixClientKey
impl PartialEq for RadixClientKey
Source§impl Serialize for RadixClientKey
impl Serialize for RadixClientKey
impl StructuralPartialEq for RadixClientKey
Auto Trait Implementations§
impl Freeze for RadixClientKey
impl RefUnwindSafe for RadixClientKey
impl Send for RadixClientKey
impl Sync for RadixClientKey
impl Unpin for RadixClientKey
impl UnwindSafe for RadixClientKey
Blanket Implementations§
Source§impl<'short, T, Target> AsGeneralizedRef<'short, &'short Target> for T
impl<'short, T, Target> AsGeneralizedRef<'short, &'short Target> for T
fn as_generalized_ref(&'short self) -> &'short Target
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
Converts
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>
Converts
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