Struct tfhe::CompactFheBoolList
source · pub struct CompactFheBoolList { /* private fields */ }Available on crate feature
integer only.Expand description
Compact list of FheBool
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 FheBool. Compacting can only be achieved at encryption time by a CompactPublicKey
§Example
use tfhe::prelude::*;
use tfhe::{generate_keys, CompactFheBoolList, CompactPublicKey, ConfigBuilder};
let (client_key, _) = generate_keys(ConfigBuilder::default());
let compact_public_key = CompactPublicKey::try_new(&client_key).unwrap();
let clears = vec![false, true];
let compact = CompactFheBoolList::encrypt(&clears, &compact_public_key);
assert_eq!(compact.len(), clears.len());
let ciphertexts = compact.expand();
let decrypted: Vec<bool> = ciphertexts
.into_iter()
.map(|ciphertext| ciphertext.decrypt(&client_key))
.collect();
assert_eq!(decrypted, clears);Implementations§
Trait Implementations§
source§impl Clone for CompactFheBoolList
impl Clone for CompactFheBoolList
source§fn clone(&self) -> CompactFheBoolList
fn clone(&self) -> CompactFheBoolList
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> Deserialize<'de> for CompactFheBoolList
impl<'de> Deserialize<'de> for CompactFheBoolList
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<'a> FheTryEncrypt<&'a [bool], CompactPublicKey> for CompactFheBoolList
impl<'a> FheTryEncrypt<&'a [bool], CompactPublicKey> for CompactFheBoolList
source§fn try_encrypt(
values: &'a [bool],
key: &CompactPublicKey
) -> Result<Self, Self::Error>
fn try_encrypt( values: &'a [bool], key: &CompactPublicKey ) -> Result<Self, Self::Error>
Encrypts a slice of bool
See CompactFheBoolList example.
type Error = Error
source§impl Named for CompactFheBoolList
impl Named for CompactFheBoolList
source§impl ParameterSetConformant for CompactFheBoolList
impl ParameterSetConformant for CompactFheBoolList
type ParameterSet = RadixCompactCiphertextListConformanceParams
fn is_conformant( &self, params: &RadixCompactCiphertextListConformanceParams ) -> bool
Auto Trait Implementations§
impl RefUnwindSafe for CompactFheBoolList
impl Send for CompactFheBoolList
impl Sync for CompactFheBoolList
impl Unpin for CompactFheBoolList
impl UnwindSafe for CompactFheBoolList
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