pub struct LweSeededBootstrapKey32(/* private fields */);Expand description
A structure representing a seeded LWE bootstrap key with 32 bits of precision.
Trait Implementations§
Source§impl AbstractEntity for LweSeededBootstrapKey32
impl AbstractEntity for LweSeededBootstrapKey32
Source§type Kind = LweSeededBootstrapKeyKind
type Kind = LweSeededBootstrapKeyKind
Source§impl Clone for LweSeededBootstrapKey32
impl Clone for LweSeededBootstrapKey32
Source§fn clone(&self) -> LweSeededBootstrapKey32
fn clone(&self) -> LweSeededBootstrapKey32
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for LweSeededBootstrapKey32
impl Debug for LweSeededBootstrapKey32
Source§impl EntityDeserializationEngine<&[u8], LweSeededBootstrapKey32> for DefaultSerializationEngine
§Description:
Implementation of EntityDeserializationEngine for DefaultSerializationEngine that
operates on 32 bits integers. It deserializes a seeded LWE bootstrap key entity.
impl EntityDeserializationEngine<&[u8], LweSeededBootstrapKey32> for DefaultSerializationEngine
§Description:
Implementation of EntityDeserializationEngine for DefaultSerializationEngine that
operates on 32 bits integers. It deserializes a seeded LWE bootstrap key entity.
Source§fn deserialize(
&mut self,
serialized: &[u8],
) -> Result<LweSeededBootstrapKey32, EntityDeserializationError<Self::EngineError>>
fn deserialize( &mut self, serialized: &[u8], ) -> Result<LweSeededBootstrapKey32, EntityDeserializationError<Self::EngineError>>
§Example:
use concrete_core::prelude::{
DecompositionBaseLog, DecompositionLevelCount, GlweDimension, LweDimension, PolynomialSize,
Variance, *,
};
// DISCLAIMER: the parameters used here are only for test purpose, and are not secure.
let (lwe_dim, glwe_dim, poly_size) = (LweDimension(4), GlweDimension(6), PolynomialSize(256));
let (dec_lc, dec_bl) = (DecompositionLevelCount(3), DecompositionBaseLog(5));
let noise = Variance(2_f64.powf(-25.));
// Unix seeder must be given a secret input.
// Here we just give it 0, which is totally unsafe.
const UNSAFE_SECRET: u128 = 0;
let mut engine = DefaultEngine::new(Box::new(UnixSeeder::new(UNSAFE_SECRET)))?;
let lwe_sk: LweSecretKey32 = engine.generate_new_lwe_secret_key(lwe_dim)?;
let glwe_sk: GlweSecretKey32 = engine.generate_new_glwe_secret_key(glwe_dim, poly_size)?;
let bsk: LweSeededBootstrapKey32 =
engine.generate_new_lwe_seeded_bootstrap_key(&lwe_sk, &glwe_sk, dec_bl, dec_lc, noise)?;
let mut serialization_engine = DefaultSerializationEngine::new(())?;
let serialized = serialization_engine.serialize(&bsk)?;
let recovered = serialization_engine.deserialize(serialized.as_slice())?;
assert_eq!(bsk, recovered);
Source§unsafe fn deserialize_unchecked(
&mut self,
serialized: &[u8],
) -> LweSeededBootstrapKey32
unsafe fn deserialize_unchecked( &mut self, serialized: &[u8], ) -> LweSeededBootstrapKey32
Source§impl EntitySerializationEngine<LweSeededBootstrapKey32, Vec<u8>> for DefaultSerializationEngine
§Description:
Implementation of EntitySerializationEngine for DefaultSerializationEngine that operates
on 32 bits integers. It serializes a seeded LWE bootstrap key entity.
impl EntitySerializationEngine<LweSeededBootstrapKey32, Vec<u8>> for DefaultSerializationEngine
§Description:
Implementation of EntitySerializationEngine for DefaultSerializationEngine that operates
on 32 bits integers. It serializes a seeded LWE bootstrap key entity.
Source§fn serialize(
&mut self,
entity: &LweSeededBootstrapKey32,
) -> Result<Vec<u8>, EntitySerializationError<Self::EngineError>>
fn serialize( &mut self, entity: &LweSeededBootstrapKey32, ) -> Result<Vec<u8>, EntitySerializationError<Self::EngineError>>
§Example:
use concrete_core::prelude::{
DecompositionBaseLog, DecompositionLevelCount, GlweDimension, LweDimension, PolynomialSize,
Variance, *,
};
// DISCLAIMER: the parameters used here are only for test purpose, and are not secure.
let (lwe_dim, glwe_dim, poly_size) = (LweDimension(4), GlweDimension(6), PolynomialSize(256));
let (dec_lc, dec_bl) = (DecompositionLevelCount(3), DecompositionBaseLog(5));
let noise = Variance(2_f64.powf(-25.));
// Unix seeder must be given a secret input.
// Here we just give it 0, which is totally unsafe.
const UNSAFE_SECRET: u128 = 0;
let mut engine = DefaultEngine::new(Box::new(UnixSeeder::new(UNSAFE_SECRET)))?;
let lwe_sk: LweSecretKey32 = engine.generate_new_lwe_secret_key(lwe_dim)?;
let glwe_sk: GlweSecretKey32 = engine.generate_new_glwe_secret_key(glwe_dim, poly_size)?;
let bsk: LweSeededBootstrapKey32 =
engine.generate_new_lwe_seeded_bootstrap_key(&lwe_sk, &glwe_sk, dec_bl, dec_lc, noise)?;
let mut serialization_engine = DefaultSerializationEngine::new(())?;
let serialized = serialization_engine.serialize(&bsk)?;
let recovered = serialization_engine.deserialize(serialized.as_slice())?;
assert_eq!(bsk, recovered);
Source§unsafe fn serialize_unchecked(
&mut self,
entity: &LweSeededBootstrapKey32,
) -> Vec<u8> ⓘ
unsafe fn serialize_unchecked( &mut self, entity: &LweSeededBootstrapKey32, ) -> Vec<u8> ⓘ
Source§impl LweSeededBootstrapKeyEntity for LweSeededBootstrapKey32
impl LweSeededBootstrapKeyEntity for LweSeededBootstrapKey32
Source§fn glwe_dimension(&self) -> GlweDimension
fn glwe_dimension(&self) -> GlweDimension
Source§fn polynomial_size(&self) -> PolynomialSize
fn polynomial_size(&self) -> PolynomialSize
Source§fn input_lwe_dimension(&self) -> LweDimension
fn input_lwe_dimension(&self) -> LweDimension
Source§fn decomposition_base_log(&self) -> DecompositionBaseLog
fn decomposition_base_log(&self) -> DecompositionBaseLog
Source§fn decomposition_level_count(&self) -> DecompositionLevelCount
fn decomposition_level_count(&self) -> DecompositionLevelCount
Source§fn compression_seed(&self) -> CompressionSeed
fn compression_seed(&self) -> CompressionSeed
Source§fn output_lwe_dimension(&self) -> LweDimension
fn output_lwe_dimension(&self) -> LweDimension
Source§impl LweSeededBootstrapKeyGenerationEngine<LweSecretKey32, GlweSecretKey32, LweSeededBootstrapKey32> for DefaultEngine
§Description:
Implementation of LweSeededBootstrapKeyGenerationEngine for DefaultEngine that operates
on 32 bits integers. It outputs a seeded bootstrap key in the standard domain.
impl LweSeededBootstrapKeyGenerationEngine<LweSecretKey32, GlweSecretKey32, LweSeededBootstrapKey32> for DefaultEngine
§Description:
Implementation of LweSeededBootstrapKeyGenerationEngine for DefaultEngine that operates
on 32 bits integers. It outputs a seeded bootstrap key in the standard domain.
Source§fn generate_new_lwe_seeded_bootstrap_key(
&mut self,
input_key: &LweSecretKey32,
output_key: &GlweSecretKey32,
decomposition_base_log: DecompositionBaseLog,
decomposition_level_count: DecompositionLevelCount,
noise: Variance,
) -> Result<LweSeededBootstrapKey32, LweSeededBootstrapKeyGenerationError<Self::EngineError>>
fn generate_new_lwe_seeded_bootstrap_key( &mut self, input_key: &LweSecretKey32, output_key: &GlweSecretKey32, decomposition_base_log: DecompositionBaseLog, decomposition_level_count: DecompositionLevelCount, noise: Variance, ) -> Result<LweSeededBootstrapKey32, LweSeededBootstrapKeyGenerationError<Self::EngineError>>
§Example
use concrete_core::prelude::{
DecompositionBaseLog, DecompositionLevelCount, GlweDimension, LweDimension, PolynomialSize,
Variance, *,
};
// DISCLAIMER: the parameters used here are only for test purpose, and are not secure.
let (lwe_dim, glwe_dim, poly_size) = (LweDimension(4), GlweDimension(6), PolynomialSize(256));
let (dec_lc, dec_bl) = (DecompositionLevelCount(3), DecompositionBaseLog(5));
let noise = Variance(2_f64.powf(-25.));
// Unix seeder must be given a secret input.
// Here we just give it 0, which is totally unsafe.
const UNSAFE_SECRET: u128 = 0;
let mut engine = DefaultEngine::new(Box::new(UnixSeeder::new(UNSAFE_SECRET)))?;
let lwe_sk: LweSecretKey32 = engine.generate_new_lwe_secret_key(lwe_dim)?;
let glwe_sk: GlweSecretKey32 = engine.generate_new_glwe_secret_key(glwe_dim, poly_size)?;
let bsk: LweSeededBootstrapKey32 =
engine.generate_new_lwe_seeded_bootstrap_key(&lwe_sk, &glwe_sk, dec_bl, dec_lc, noise)?;
assert_eq!(bsk.glwe_dimension(), glwe_dim);
assert_eq!(bsk.polynomial_size(), poly_size);
assert_eq!(bsk.input_lwe_dimension(), lwe_dim);
assert_eq!(bsk.decomposition_base_log(), dec_bl);
assert_eq!(bsk.decomposition_level_count(), dec_lc);
Source§unsafe fn generate_new_lwe_seeded_bootstrap_key_unchecked(
&mut self,
input_key: &LweSecretKey32,
output_key: &GlweSecretKey32,
decomposition_base_log: DecompositionBaseLog,
decomposition_level_count: DecompositionLevelCount,
noise: Variance,
) -> LweSeededBootstrapKey32
unsafe fn generate_new_lwe_seeded_bootstrap_key_unchecked( &mut self, input_key: &LweSecretKey32, output_key: &GlweSecretKey32, decomposition_base_log: DecompositionBaseLog, decomposition_level_count: DecompositionLevelCount, noise: Variance, ) -> LweSeededBootstrapKey32
Source§impl LweSeededBootstrapKeyGenerationEngine<LweSecretKey32, GlweSecretKey32, LweSeededBootstrapKey32> for DefaultParallelEngine
§Description:
Implementation of LweSeededBootstrapKeyGenerationEngine for DefaultParallelEngine that
operates on 32 bits integers. It outputs a seeded bootstrap key in the standard domain.
impl LweSeededBootstrapKeyGenerationEngine<LweSecretKey32, GlweSecretKey32, LweSeededBootstrapKey32> for DefaultParallelEngine
§Description:
Implementation of LweSeededBootstrapKeyGenerationEngine for DefaultParallelEngine that
operates on 32 bits integers. It outputs a seeded bootstrap key in the standard domain.
Source§fn generate_new_lwe_seeded_bootstrap_key(
&mut self,
input_key: &LweSecretKey32,
output_key: &GlweSecretKey32,
decomposition_base_log: DecompositionBaseLog,
decomposition_level_count: DecompositionLevelCount,
noise: Variance,
) -> Result<LweSeededBootstrapKey32, LweSeededBootstrapKeyGenerationError<Self::EngineError>>
fn generate_new_lwe_seeded_bootstrap_key( &mut self, input_key: &LweSecretKey32, output_key: &GlweSecretKey32, decomposition_base_log: DecompositionBaseLog, decomposition_level_count: DecompositionLevelCount, noise: Variance, ) -> Result<LweSeededBootstrapKey32, LweSeededBootstrapKeyGenerationError<Self::EngineError>>
§Example
use concrete_core::prelude::{
DecompositionBaseLog, DecompositionLevelCount, GlweDimension, LweDimension, PolynomialSize,
Variance, *,
};
// DISCLAIMER: the parameters used here are only for test purpose, and are not secure.
let (lwe_dim, glwe_dim, poly_size) = (LweDimension(4), GlweDimension(6), PolynomialSize(256));
let (dec_lc, dec_bl) = (DecompositionLevelCount(3), DecompositionBaseLog(5));
let noise = Variance(2_f64.powf(-25.));
// Unix seeder must be given a secret input.
// Here we just give it 0, which is totally unsafe.
const UNSAFE_SECRET: u128 = 0;
let mut default_engine = DefaultEngine::new(Box::new(UnixSeeder::new(UNSAFE_SECRET)))?;
let mut default_parallel_engine =
DefaultParallelEngine::new(Box::new(UnixSeeder::new(UNSAFE_SECRET)))?;
let lwe_sk: LweSecretKey32 = default_engine.generate_new_lwe_secret_key(lwe_dim)?;
let glwe_sk: GlweSecretKey32 =
default_engine.generate_new_glwe_secret_key(glwe_dim, poly_size)?;
let bsk: LweSeededBootstrapKey32 = default_parallel_engine
.generate_new_lwe_seeded_bootstrap_key(&lwe_sk, &glwe_sk, dec_bl, dec_lc, noise)?;
assert_eq!(bsk.glwe_dimension(), glwe_dim);
assert_eq!(bsk.polynomial_size(), poly_size);
assert_eq!(bsk.input_lwe_dimension(), lwe_dim);
assert_eq!(bsk.decomposition_base_log(), dec_bl);
assert_eq!(bsk.decomposition_level_count(), dec_lc);
Source§unsafe fn generate_new_lwe_seeded_bootstrap_key_unchecked(
&mut self,
input_key: &LweSecretKey32,
output_key: &GlweSecretKey32,
decomposition_base_log: DecompositionBaseLog,
decomposition_level_count: DecompositionLevelCount,
noise: Variance,
) -> LweSeededBootstrapKey32
unsafe fn generate_new_lwe_seeded_bootstrap_key_unchecked( &mut self, input_key: &LweSecretKey32, output_key: &GlweSecretKey32, decomposition_base_log: DecompositionBaseLog, decomposition_level_count: DecompositionLevelCount, noise: Variance, ) -> LweSeededBootstrapKey32
Source§impl LweSeededBootstrapKeyToLweBootstrapKeyTransformationEngine<LweSeededBootstrapKey32, LweBootstrapKey32> for DefaultEngine
§Description:
Implementation of LweSeededBootstrapKeyToLweBootstrapKeyTransformationEngine for
DefaultEngine that operates on 32 bits integers. It outputs a bootstrap key in the
standard domain.
impl LweSeededBootstrapKeyToLweBootstrapKeyTransformationEngine<LweSeededBootstrapKey32, LweBootstrapKey32> for DefaultEngine
§Description:
Implementation of LweSeededBootstrapKeyToLweBootstrapKeyTransformationEngine for
DefaultEngine that operates on 32 bits integers. It outputs a bootstrap key in the
standard domain.
Source§fn transform_lwe_seeded_bootstrap_key_to_lwe_bootstrap_key(
&mut self,
lwe_seeded_bootstrap_key: LweSeededBootstrapKey32,
) -> Result<LweBootstrapKey32, LweSeededBootstrapKeyToLweBootstrapKeyTransformationError<Self::EngineError>>
fn transform_lwe_seeded_bootstrap_key_to_lwe_bootstrap_key( &mut self, lwe_seeded_bootstrap_key: LweSeededBootstrapKey32, ) -> Result<LweBootstrapKey32, LweSeededBootstrapKeyToLweBootstrapKeyTransformationError<Self::EngineError>>
§Example
use concrete_core::prelude::{
DecompositionBaseLog, DecompositionLevelCount, GlweDimension, LweDimension, PolynomialSize,
Variance, *,
};
// DISCLAIMER: the parameters used here are only for test purpose, and are not secure.
let (lwe_dim, glwe_dim, poly_size) = (LweDimension(4), GlweDimension(6), PolynomialSize(256));
let (dec_lc, dec_bl) = (DecompositionLevelCount(3), DecompositionBaseLog(5));
let noise = Variance(2_f64.powf(-25.));
// Unix seeder must be given a secret input.
// Here we just give it 0, which is totally unsafe.
const UNSAFE_SECRET: u128 = 0;
let mut engine = DefaultEngine::new(Box::new(UnixSeeder::new(UNSAFE_SECRET)))?;
let lwe_sk: LweSecretKey32 = engine.generate_new_lwe_secret_key(lwe_dim)?;
let glwe_sk: GlweSecretKey32 = engine.generate_new_glwe_secret_key(glwe_dim, poly_size)?;
let seeded_bsk: LweSeededBootstrapKey32 =
engine.generate_new_lwe_seeded_bootstrap_key(&lwe_sk, &glwe_sk, dec_bl, dec_lc, noise)?;
let bsk = engine.transform_lwe_seeded_bootstrap_key_to_lwe_bootstrap_key(seeded_bsk)?;
assert_eq!(bsk.glwe_dimension(), glwe_dim);
assert_eq!(bsk.polynomial_size(), poly_size);
assert_eq!(bsk.input_lwe_dimension(), lwe_dim);
assert_eq!(bsk.decomposition_base_log(), dec_bl);
assert_eq!(bsk.decomposition_level_count(), dec_lc);
Source§unsafe fn transform_lwe_seeded_bootstrap_key_to_lwe_bootstrap_key_unchecked(
&mut self,
lwe_seeded_bootstrap_key: LweSeededBootstrapKey32,
) -> LweBootstrapKey32
unsafe fn transform_lwe_seeded_bootstrap_key_to_lwe_bootstrap_key_unchecked( &mut self, lwe_seeded_bootstrap_key: LweSeededBootstrapKey32, ) -> LweBootstrapKey32
Source§impl PartialEq for LweSeededBootstrapKey32
impl PartialEq for LweSeededBootstrapKey32
impl Eq for LweSeededBootstrapKey32
impl StructuralPartialEq for LweSeededBootstrapKey32
Auto Trait Implementations§
impl Freeze for LweSeededBootstrapKey32
impl RefUnwindSafe for LweSeededBootstrapKey32
impl Send for LweSeededBootstrapKey32
impl Sync for LweSeededBootstrapKey32
impl Unpin for LweSeededBootstrapKey32
impl UnwindSafe for LweSeededBootstrapKey32
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
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>
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>
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