pub struct BooleanEngine { /* private fields */ }
Available on crate feature
boolean
only.Implementations§
Source§impl BooleanEngine
impl BooleanEngine
pub fn create_client_key(&mut self, parameters: BooleanParameters) -> ClientKey
pub fn create_server_key(&mut self, cks: &ClientKey) -> ServerKey
pub fn create_compressed_server_key( &mut self, cks: &ClientKey, ) -> CompressedServerKey
pub fn create_public_key(&mut self, client_key: &ClientKey) -> PublicKey
pub fn create_compressed_public_key( &mut self, client_key: &ClientKey, ) -> CompressedPublicKey
pub fn trivial_encrypt(&self, message: bool) -> Ciphertext
pub fn encrypt(&mut self, message: bool, cks: &ClientKey) -> Ciphertext
pub fn encrypt_compressed( &mut self, message: bool, cks: &ClientKey, ) -> CompressedCiphertext
pub fn encrypt_with_public_key( &mut self, message: bool, pks: &PublicKey, ) -> Ciphertext
pub fn encrypt_with_compressed_public_key( &mut self, message: bool, compressed_pk: &CompressedPublicKey, ) -> Ciphertext
pub fn decrypt(&self, ct: &Ciphertext, cks: &ClientKey) -> bool
pub fn not(&self, ct: &Ciphertext) -> Ciphertext
pub fn not_assign(&self, ct: &mut Ciphertext)
Source§impl BooleanEngine
impl BooleanEngine
Sourcepub fn replace_thread_local(new_engine: Self)
pub fn replace_thread_local(new_engine: Self)
Replace the thread_local BooleanEngine
new_engine
will replace the already_existing
thread_local
engine.
§Example
use tfhe::boolean::engine::BooleanEngine;
use tfhe::core_crypto::commons::generators::DeterministicSeeder;
use tfhe::core_crypto::commons::math::random::Seed;
use tfhe::core_crypto::prelude::DefaultRandomGenerator;
// WARNING: Using a deterministic seed is not recommended
// as it renders the random generation insecure
let deterministic_seed = Seed(0);
let mut seeder = DeterministicSeeder::<DefaultRandomGenerator>::new(deterministic_seed);
let boolean_engine = BooleanEngine::new_from_seeder(&mut seeder);
BooleanEngine::replace_thread_local(boolean_engine);
// This uses the engine create earlier
let (cks, sks) = tfhe::boolean::gen_keys();
pub fn new() -> Self
pub fn new_from_seeder(root_seeder: &mut dyn Seeder) -> Self
pub fn mux( &mut self, ct_condition: &Ciphertext, ct_then: &Ciphertext, ct_else: &Ciphertext, server_key: &ServerKey, ) -> Ciphertext
Trait Implementations§
Auto Trait Implementations§
impl Freeze for BooleanEngine
impl RefUnwindSafe for BooleanEngine
impl Send for BooleanEngine
impl Sync for BooleanEngine
impl Unpin for BooleanEngine
impl UnwindSafe for BooleanEngine
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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