Struct tfhe::CompactFheInt
source · pub struct CompactFheInt<Id: FheIntId> { /* private fields */ }
Available on crate feature
integer
only.Expand description
Compact FheInt
Meant to save in storage space / transfer.
- A Compact type must be expanded using expand before it can be used.
- It is not possible to ‘compact’ an existing FheInt. Compacting can only be achieved at encryption time by a CompactPublicKey
§Example
use tfhe::prelude::*;
use tfhe::{generate_keys, CompactFheInt32, CompactPublicKey, ConfigBuilder, FheInt32};
let (client_key, _) = generate_keys(ConfigBuilder::default());
let compact_public_key = CompactPublicKey::try_new(&client_key).unwrap();
let compact = CompactFheInt32::encrypt(i32::MIN, &compact_public_key);
let ciphertext = compact.expand();
let decrypted: i32 = ciphertext.decrypt(&client_key);
assert_eq!(decrypted, i32::MIN);
Implementations§
source§impl<Id> CompactFheInt<Id>where
Id: FheIntId,
impl<Id> CompactFheInt<Id>where
Id: FheIntId,
sourcepub fn expand(&self) -> FheInt<Id>
pub fn expand(&self) -> FheInt<Id>
Expand to a FheInt
See CompactFheInt example.
pub fn into_raw_parts(self) -> (CompactCiphertextList, Id)
pub fn from_raw_parts(list: CompactCiphertextList, id: Id) -> Self
Trait Implementations§
source§impl<Id: Clone + FheIntId> Clone for CompactFheInt<Id>
impl<Id: Clone + FheIntId> Clone for CompactFheInt<Id>
source§fn clone(&self) -> CompactFheInt<Id>
fn clone(&self) -> CompactFheInt<Id>
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<'de, Id> Deserialize<'de> for CompactFheInt<Id>where
Id: Deserialize<'de> + FheIntId,
impl<'de, Id> Deserialize<'de> for CompactFheInt<Id>where
Id: Deserialize<'de> + FheIntId,
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<Id, T> FheTryEncrypt<T, CompactPublicKey> for CompactFheInt<Id>where
T: DecomposableInto<u64>,
Id: FheIntId,
impl<Id, T> FheTryEncrypt<T, CompactPublicKey> for CompactFheInt<Id>where
T: DecomposableInto<u64>,
Id: FheIntId,
type Error = Error
fn try_encrypt(value: T, key: &CompactPublicKey) -> Result<Self, Self::Error>
source§impl<Id: FheIntId> Named for CompactFheInt<Id>
impl<Id: FheIntId> Named for CompactFheInt<Id>
source§impl<Id: FheIntId> ParameterSetConformant for CompactFheInt<Id>
impl<Id: FheIntId> ParameterSetConformant for CompactFheInt<Id>
type ParameterSet = FheIntConformanceParams<Id>
fn is_conformant(&self, params: &FheIntConformanceParams<Id>) -> bool
Auto Trait Implementations§
impl<Id> Freeze for CompactFheInt<Id>where
Id: Freeze,
impl<Id> RefUnwindSafe for CompactFheInt<Id>where
Id: RefUnwindSafe,
impl<Id> Send for CompactFheInt<Id>where
Id: Send,
impl<Id> Sync for CompactFheInt<Id>where
Id: Sync,
impl<Id> Unpin for CompactFheInt<Id>where
Id: Unpin,
impl<Id> UnwindSafe for CompactFheInt<Id>where
Id: UnwindSafe,
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