pub struct FheBool { /* private fields */ }
Available on crate feature
booleans
only.Expand description
The FHE boolean data type.
To be able to use this type, the cargo feature booleans
must be enabled,
and your config should also enable the type with either default parameters or custom ones.
Example
use concrete::prelude::*;
#[cfg(feature = "booleans")]
use concrete::{generate_keys, set_server_key, ConfigBuilder, FheBool};
// Enable booleans in the config
let config = ConfigBuilder::all_disabled().enable_default_bool().build();
// With the booleans enabled in the config, the needed keys and details
// can be taken care of.
let (client_key, server_key) = generate_keys(config);
let ttrue = FheBool::encrypt(true, &client_key);
let ffalse = FheBool::encrypt(false, &client_key);
// Do not forget to set the server key before doing any computation
set_server_key(server_key);
let fhe_result = ttrue & ffalse;
let clear_result = fhe_result.decrypt(&client_key);
assert_eq!(clear_result, false);
Implementations
Trait Implementations
sourceimpl<'de> Deserialize<'de> for FheBool
impl<'de> Deserialize<'de> for FheBool
sourcefn 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
sourceimpl From<Ciphertext> for FheBool
impl From<Ciphertext> for FheBool
sourcefn from(ciphertext: Ciphertext) -> Self
fn from(ciphertext: Ciphertext) -> Self
Converts to this type from the input type.
Auto Trait Implementations
impl RefUnwindSafe for FheBool
impl Send for FheBool
impl Sync for FheBool
impl Unpin for FheBool
impl UnwindSafe for FheBool
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more