pub struct DefaultParallelEngine { /* private fields */ }Trait Implementations§
Source§impl AbstractEngine for DefaultParallelEngine
impl AbstractEngine for DefaultParallelEngine
Source§type EngineError = DefaultParallelError
type EngineError = DefaultParallelError
Source§type Parameters = Box<dyn Seeder>
type Parameters = Box<dyn Seeder>
Source§fn new(parameters: Self::Parameters) -> Result<Self, Self::EngineError>
fn new(parameters: Self::Parameters) -> Result<Self, Self::EngineError>
Source§impl LweBootstrapKeyGenerationEngine<LweSecretKey32, GlweSecretKey32, LweBootstrapKey32> for DefaultParallelEngine
§Description:
Implementation of LweBootstrapKeyGenerationEngine for DefaultParallelEngine that
operates on 32 bits integers. It outputs a bootstrap key in the standard domain.
impl LweBootstrapKeyGenerationEngine<LweSecretKey32, GlweSecretKey32, LweBootstrapKey32> for DefaultParallelEngine
§Description:
Implementation of LweBootstrapKeyGenerationEngine for DefaultParallelEngine that
operates on 32 bits integers. It outputs a bootstrap key in the standard domain.
Source§fn generate_new_lwe_bootstrap_key(
&mut self,
input_key: &LweSecretKey32,
output_key: &GlweSecretKey32,
decomposition_base_log: DecompositionBaseLog,
decomposition_level_count: DecompositionLevelCount,
noise: Variance,
) -> Result<LweBootstrapKey32, LweBootstrapKeyGenerationError<Self::EngineError>>
fn generate_new_lwe_bootstrap_key( &mut self, input_key: &LweSecretKey32, output_key: &GlweSecretKey32, decomposition_base_log: DecompositionBaseLog, decomposition_level_count: DecompositionLevelCount, noise: Variance, ) -> Result<LweBootstrapKey32, LweBootstrapKeyGenerationError<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: LweBootstrapKey32 = default_parallel_engine
.generate_new_lwe_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_bootstrap_key_unchecked(
&mut self,
input_key: &LweSecretKey32,
output_key: &GlweSecretKey32,
decomposition_base_log: DecompositionBaseLog,
decomposition_level_count: DecompositionLevelCount,
noise: Variance,
) -> LweBootstrapKey32
unsafe fn generate_new_lwe_bootstrap_key_unchecked( &mut self, input_key: &LweSecretKey32, output_key: &GlweSecretKey32, decomposition_base_log: DecompositionBaseLog, decomposition_level_count: DecompositionLevelCount, noise: Variance, ) -> LweBootstrapKey32
Source§impl LweBootstrapKeyGenerationEngine<LweSecretKey64, GlweSecretKey64, LweBootstrapKey64> for DefaultParallelEngine
§Description:
Implementation of LweBootstrapKeyGenerationEngine for DefaultParallelEngine that
operates on 64 bits integers. It outputs a bootstrap key in the standard domain.
impl LweBootstrapKeyGenerationEngine<LweSecretKey64, GlweSecretKey64, LweBootstrapKey64> for DefaultParallelEngine
§Description:
Implementation of LweBootstrapKeyGenerationEngine for DefaultParallelEngine that
operates on 64 bits integers. It outputs a bootstrap key in the standard domain.
Source§fn generate_new_lwe_bootstrap_key(
&mut self,
input_key: &LweSecretKey64,
output_key: &GlweSecretKey64,
decomposition_base_log: DecompositionBaseLog,
decomposition_level_count: DecompositionLevelCount,
noise: Variance,
) -> Result<LweBootstrapKey64, LweBootstrapKeyGenerationError<Self::EngineError>>
fn generate_new_lwe_bootstrap_key( &mut self, input_key: &LweSecretKey64, output_key: &GlweSecretKey64, decomposition_base_log: DecompositionBaseLog, decomposition_level_count: DecompositionLevelCount, noise: Variance, ) -> Result<LweBootstrapKey64, LweBootstrapKeyGenerationError<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: LweSecretKey64 = default_engine.generate_new_lwe_secret_key(lwe_dim)?;
let glwe_sk: GlweSecretKey64 =
default_engine.generate_new_glwe_secret_key(glwe_dim, poly_size)?;
let bsk: LweBootstrapKey64 = default_parallel_engine
.generate_new_lwe_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_bootstrap_key_unchecked(
&mut self,
input_key: &LweSecretKey64,
output_key: &GlweSecretKey64,
decomposition_base_log: DecompositionBaseLog,
decomposition_level_count: DecompositionLevelCount,
noise: Variance,
) -> LweBootstrapKey64
unsafe fn generate_new_lwe_bootstrap_key_unchecked( &mut self, input_key: &LweSecretKey64, output_key: &GlweSecretKey64, decomposition_base_log: DecompositionBaseLog, decomposition_level_count: DecompositionLevelCount, noise: Variance, ) -> LweBootstrapKey64
Source§impl LweCiphertextVectorZeroEncryptionEngine<LweSecretKey32, LweCiphertextVector32> for DefaultParallelEngine
§Description:
Implementation of LweCiphertextVectorZeroEncryptionEngine for DefaultParallelEngine that
operates on 32 bits integers.
impl LweCiphertextVectorZeroEncryptionEngine<LweSecretKey32, LweCiphertextVector32> for DefaultParallelEngine
§Description:
Implementation of LweCiphertextVectorZeroEncryptionEngine for DefaultParallelEngine that
operates on 32 bits integers.
Source§fn zero_encrypt_lwe_ciphertext_vector(
&mut self,
key: &LweSecretKey32,
noise: Variance,
count: LweCiphertextCount,
) -> Result<LweCiphertextVector32, LweCiphertextVectorZeroEncryptionError<Self::EngineError>>
fn zero_encrypt_lwe_ciphertext_vector( &mut self, key: &LweSecretKey32, noise: Variance, count: LweCiphertextCount, ) -> Result<LweCiphertextVector32, LweCiphertextVectorZeroEncryptionError<Self::EngineError>>
§Example:
use concrete_core::prelude::{LweCiphertextCount, LweDimension, Variance, *};
// DISCLAIMER: the parameters used here are only for test purpose, and are not secure.
let lwe_dimension = LweDimension(2);
let ciphertext_count = LweCiphertextCount(3);
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 mut par_engine = DefaultParallelEngine::new(Box::new(UnixSeeder::new(UNSAFE_SECRET)))?;
let key: LweSecretKey32 = engine.generate_new_lwe_secret_key(lwe_dimension)?;
let ciphertext_vector =
par_engine.zero_encrypt_lwe_ciphertext_vector(&key, noise, ciphertext_count)?;
assert_eq!(ciphertext_vector.lwe_dimension(), lwe_dimension);
assert_eq!(ciphertext_vector.lwe_ciphertext_count(), ciphertext_count);
Source§unsafe fn zero_encrypt_lwe_ciphertext_vector_unchecked(
&mut self,
key: &LweSecretKey32,
noise: Variance,
count: LweCiphertextCount,
) -> LweCiphertextVector32
unsafe fn zero_encrypt_lwe_ciphertext_vector_unchecked( &mut self, key: &LweSecretKey32, noise: Variance, count: LweCiphertextCount, ) -> LweCiphertextVector32
Source§impl LweCiphertextVectorZeroEncryptionEngine<LweSecretKey64, LweCiphertextVector64> for DefaultParallelEngine
§Description:
Implementation of LweCiphertextVectorZeroEncryptionEngine for DefaultParallelEngine that
operates on 64 bits integers.
impl LweCiphertextVectorZeroEncryptionEngine<LweSecretKey64, LweCiphertextVector64> for DefaultParallelEngine
§Description:
Implementation of LweCiphertextVectorZeroEncryptionEngine for DefaultParallelEngine that
operates on 64 bits integers.
Source§fn zero_encrypt_lwe_ciphertext_vector(
&mut self,
key: &LweSecretKey64,
noise: Variance,
count: LweCiphertextCount,
) -> Result<LweCiphertextVector64, LweCiphertextVectorZeroEncryptionError<Self::EngineError>>
fn zero_encrypt_lwe_ciphertext_vector( &mut self, key: &LweSecretKey64, noise: Variance, count: LweCiphertextCount, ) -> Result<LweCiphertextVector64, LweCiphertextVectorZeroEncryptionError<Self::EngineError>>
§Example:
use concrete_core::prelude::{LweCiphertextCount, LweDimension, Variance, *};
// DISCLAIMER: the parameters used here are only for test purpose, and are not secure.
let lwe_dimension = LweDimension(2);
let ciphertext_count = LweCiphertextCount(3);
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 mut par_engine = DefaultParallelEngine::new(Box::new(UnixSeeder::new(UNSAFE_SECRET)))?;
let key: LweSecretKey64 = engine.generate_new_lwe_secret_key(lwe_dimension)?;
let ciphertext_vector =
par_engine.zero_encrypt_lwe_ciphertext_vector(&key, noise, ciphertext_count)?;
assert_eq!(ciphertext_vector.lwe_dimension(), lwe_dimension);
assert_eq!(ciphertext_vector.lwe_ciphertext_count(), ciphertext_count);
Source§unsafe fn zero_encrypt_lwe_ciphertext_vector_unchecked(
&mut self,
key: &LweSecretKey64,
noise: Variance,
count: LweCiphertextCount,
) -> LweCiphertextVector64
unsafe fn zero_encrypt_lwe_ciphertext_vector_unchecked( &mut self, key: &LweSecretKey64, noise: Variance, count: LweCiphertextCount, ) -> LweCiphertextVector64
Source§impl LweCircuitBootstrapPrivateFunctionalPackingKeyswitchKeysGenerationEngine<LweSecretKey32, GlweSecretKey32, LweCircuitBootstrapPrivateFunctionalPackingKeyswitchKeys32> for DefaultParallelEngine
§Description:
Implementation of LweCircuitBootstrapPrivateFunctionalPackingKeyswitchKeysGenerationEngine
for DefaultParallelEngine that operates on 32 bits integers.
impl LweCircuitBootstrapPrivateFunctionalPackingKeyswitchKeysGenerationEngine<LweSecretKey32, GlweSecretKey32, LweCircuitBootstrapPrivateFunctionalPackingKeyswitchKeys32> for DefaultParallelEngine
§Description:
Implementation of LweCircuitBootstrapPrivateFunctionalPackingKeyswitchKeysGenerationEngine
for DefaultParallelEngine that operates on 32 bits integers.
Source§fn generate_new_lwe_circuit_bootstrap_private_functional_packing_keyswitch_keys(
&mut self,
input_lwe_key: &LweSecretKey32,
output_glwe_key: &GlweSecretKey32,
decomposition_base_log: DecompositionBaseLog,
decomposition_level_count: DecompositionLevelCount,
noise: Variance,
) -> Result<LweCircuitBootstrapPrivateFunctionalPackingKeyswitchKeys32, LweCircuitBootstrapPrivateFunctionalPackingKeyswitchKeysGenerationError<Self::EngineError>>
fn generate_new_lwe_circuit_bootstrap_private_functional_packing_keyswitch_keys( &mut self, input_lwe_key: &LweSecretKey32, output_glwe_key: &GlweSecretKey32, decomposition_base_log: DecompositionBaseLog, decomposition_level_count: DecompositionLevelCount, noise: Variance, ) -> Result<LweCircuitBootstrapPrivateFunctionalPackingKeyswitchKeys32, LweCircuitBootstrapPrivateFunctionalPackingKeyswitchKeysGenerationError<Self::EngineError>>
§Example:
use concrete_core::prelude::Variance;
use concrete_core::prelude::{
DecompositionBaseLog, DecompositionLevelCount, LweDimension, GlweDimension,FunctionalPackingKeyswitchKeyCount
};
use concrete_core::prelude::*;
// DISCLAIMER: the parameters used here are only for test purpose, and are not secure.
let input_lwe_dimension = LweDimension(10);
let output_glwe_dimension = GlweDimension(3);
let polynomial_size = PolynomialSize(256);
let decomposition_base_log = DecompositionBaseLog(3);
let decomposition_level_count = DecompositionLevelCount(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 input_key: LweSecretKey32 = default_engine.generate_new_lwe_secret_key(input_lwe_dimension)?;
let output_key: GlweSecretKey32 = default_engine.generate_new_glwe_secret_key(output_glwe_dimension,
polynomial_size)?;
let cbs_private_functional_packing_keyswitch_key:
LweCircuitBootstrapPrivateFunctionalPackingKeyswitchKeys32 =
default_engine
.generate_new_lwe_circuit_bootstrap_private_functional_packing_keyswitch_keys(
&input_key,
&output_key,
decomposition_base_log,
decomposition_level_count,
noise,
)?;
assert_eq!(
assert_eq!(
assert_eq!(cbs_private_functional_packing_keyswitch_key.input_lwe_dimension(),
input_lwe_dimension);
assert_eq!(cbs_private_functional_packing_keyswitch_key.output_glwe_dimension(),
output_glwe_dimension);
assert_eq!(cbs_private_functional_packing_keyswitch_key.key_count().0,
output_glwe_dimension.to_glwe_size().0);
Source§unsafe fn generate_new_lwe_circuit_bootstrap_private_functional_packing_keyswitch_keys_unchecked(
&mut self,
input_lwe_key: &LweSecretKey32,
output_glwe_key: &GlweSecretKey32,
decomposition_base_log: DecompositionBaseLog,
decomposition_level_count: DecompositionLevelCount,
noise: Variance,
) -> LweCircuitBootstrapPrivateFunctionalPackingKeyswitchKeys32
unsafe fn generate_new_lwe_circuit_bootstrap_private_functional_packing_keyswitch_keys_unchecked( &mut self, input_lwe_key: &LweSecretKey32, output_glwe_key: &GlweSecretKey32, decomposition_base_log: DecompositionBaseLog, decomposition_level_count: DecompositionLevelCount, noise: Variance, ) -> LweCircuitBootstrapPrivateFunctionalPackingKeyswitchKeys32
Source§impl LweCircuitBootstrapPrivateFunctionalPackingKeyswitchKeysGenerationEngine<LweSecretKey64, GlweSecretKey64, LweCircuitBootstrapPrivateFunctionalPackingKeyswitchKeys64> for DefaultParallelEngine
§Description:
Implementation of LweCircuitBootstrapPrivateFunctionalPackingKeyswitchKeysGenerationEngine
for DefaultParallelEngine that operates on 64 bits integers.
impl LweCircuitBootstrapPrivateFunctionalPackingKeyswitchKeysGenerationEngine<LweSecretKey64, GlweSecretKey64, LweCircuitBootstrapPrivateFunctionalPackingKeyswitchKeys64> for DefaultParallelEngine
§Description:
Implementation of LweCircuitBootstrapPrivateFunctionalPackingKeyswitchKeysGenerationEngine
for DefaultParallelEngine that operates on 64 bits integers.
Source§fn generate_new_lwe_circuit_bootstrap_private_functional_packing_keyswitch_keys(
&mut self,
input_lwe_key: &LweSecretKey64,
output_glwe_key: &GlweSecretKey64,
decomposition_base_log: DecompositionBaseLog,
decomposition_level_count: DecompositionLevelCount,
noise: Variance,
) -> Result<LweCircuitBootstrapPrivateFunctionalPackingKeyswitchKeys64, LweCircuitBootstrapPrivateFunctionalPackingKeyswitchKeysGenerationError<Self::EngineError>>
fn generate_new_lwe_circuit_bootstrap_private_functional_packing_keyswitch_keys( &mut self, input_lwe_key: &LweSecretKey64, output_glwe_key: &GlweSecretKey64, decomposition_base_log: DecompositionBaseLog, decomposition_level_count: DecompositionLevelCount, noise: Variance, ) -> Result<LweCircuitBootstrapPrivateFunctionalPackingKeyswitchKeys64, LweCircuitBootstrapPrivateFunctionalPackingKeyswitchKeysGenerationError<Self::EngineError>>
§Example:
use concrete_core::prelude::Variance;
use concrete_core::prelude::{
DecompositionBaseLog, DecompositionLevelCount, LweDimension, GlweDimension,FunctionalPackingKeyswitchKeyCount
};
use concrete_core::prelude::*;
// DISCLAIMER: the parameters used here are only for test purpose, and are not secure.
let input_lwe_dimension = LweDimension(10);
let output_glwe_dimension = GlweDimension(3);
let polynomial_size = PolynomialSize(256);
let decomposition_base_log = DecompositionBaseLog(3);
let decomposition_level_count = DecompositionLevelCount(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 input_key: LweSecretKey64 = default_engine.generate_new_lwe_secret_key(input_lwe_dimension)?;
let output_key: GlweSecretKey64 = default_engine.generate_new_glwe_secret_key(output_glwe_dimension,
polynomial_size)?;
let cbs_private_functional_packing_keyswitch_key:
LweCircuitBootstrapPrivateFunctionalPackingKeyswitchKeys64 =
default_engine
.generate_new_lwe_circuit_bootstrap_private_functional_packing_keyswitch_keys(
&input_key,
&output_key,
decomposition_base_log,
decomposition_level_count,
noise,
)?;
assert_eq!(
assert_eq!(
assert_eq!(cbs_private_functional_packing_keyswitch_key.input_lwe_dimension(),
input_lwe_dimension);
assert_eq!(cbs_private_functional_packing_keyswitch_key.output_glwe_dimension(),
output_glwe_dimension);
assert_eq!(cbs_private_functional_packing_keyswitch_key.key_count().0,
output_glwe_dimension.to_glwe_size().0);
Source§unsafe fn generate_new_lwe_circuit_bootstrap_private_functional_packing_keyswitch_keys_unchecked(
&mut self,
input_lwe_key: &LweSecretKey64,
output_glwe_key: &GlweSecretKey64,
decomposition_base_log: DecompositionBaseLog,
decomposition_level_count: DecompositionLevelCount,
noise: Variance,
) -> LweCircuitBootstrapPrivateFunctionalPackingKeyswitchKeys64
unsafe fn generate_new_lwe_circuit_bootstrap_private_functional_packing_keyswitch_keys_unchecked( &mut self, input_lwe_key: &LweSecretKey64, output_glwe_key: &GlweSecretKey64, decomposition_base_log: DecompositionBaseLog, decomposition_level_count: DecompositionLevelCount, noise: Variance, ) -> LweCircuitBootstrapPrivateFunctionalPackingKeyswitchKeys64
Source§impl LwePublicKeyGenerationEngine<LweSecretKey32, LwePublicKey32> for DefaultParallelEngine
§Description:
Implementation of LwePublicKeyGenerationEngine for DefaultParallelEngine that operates
on 32 bits integers.
impl LwePublicKeyGenerationEngine<LweSecretKey32, LwePublicKey32> for DefaultParallelEngine
§Description:
Implementation of LwePublicKeyGenerationEngine for DefaultParallelEngine that operates
on 32 bits integers.
Source§fn generate_new_lwe_public_key(
&mut self,
lwe_secret_key: &LweSecretKey32,
noise: Variance,
lwe_public_key_zero_encryption_count: LwePublicKeyZeroEncryptionCount,
) -> Result<LwePublicKey32, LwePublicKeyGenerationError<Self::EngineError>>
fn generate_new_lwe_public_key( &mut self, lwe_secret_key: &LweSecretKey32, noise: Variance, lwe_public_key_zero_encryption_count: LwePublicKeyZeroEncryptionCount, ) -> Result<LwePublicKey32, LwePublicKeyGenerationError<Self::EngineError>>
§Example:
use concrete_core::prelude::{LweDimension, LwePublicKeyZeroEncryptionCount, *};
// DISCLAIMER: the parameters used here are only for test purpose, and are not secure.
let lwe_dimension = LweDimension(6);
let noise = Variance(2_f64.powf(-50.));
let lwe_public_key_zero_encryption_count = LwePublicKeyZeroEncryptionCount(42);
// 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 mut par_engine = DefaultParallelEngine::new(Box::new(UnixSeeder::new(UNSAFE_SECRET)))?;
let lwe_secret_key: LweSecretKey32 = engine.generate_new_lwe_secret_key(lwe_dimension)?;
let public_key: LwePublicKey32 = par_engine.generate_new_lwe_public_key(
&lwe_secret_key,
noise,
lwe_public_key_zero_encryption_count,
)?;
assert_eq!(public_key.lwe_dimension(), lwe_dimension);
assert_eq!(
public_key.lwe_zero_encryption_count(),
lwe_public_key_zero_encryption_count
);
Source§unsafe fn generate_new_lwe_public_key_unchecked(
&mut self,
lwe_secret_key: &LweSecretKey32,
noise: Variance,
lwe_public_key_zero_encryption_count: LwePublicKeyZeroEncryptionCount,
) -> LwePublicKey32
unsafe fn generate_new_lwe_public_key_unchecked( &mut self, lwe_secret_key: &LweSecretKey32, noise: Variance, lwe_public_key_zero_encryption_count: LwePublicKeyZeroEncryptionCount, ) -> LwePublicKey32
Source§impl LwePublicKeyGenerationEngine<LweSecretKey64, LwePublicKey64> for DefaultParallelEngine
§Description:
Implementation of LwePublicKeyGenerationEngine for DefaultParallelEngine that operates
on 64 bits integers.
impl LwePublicKeyGenerationEngine<LweSecretKey64, LwePublicKey64> for DefaultParallelEngine
§Description:
Implementation of LwePublicKeyGenerationEngine for DefaultParallelEngine that operates
on 64 bits integers.
Source§fn generate_new_lwe_public_key(
&mut self,
lwe_secret_key: &LweSecretKey64,
noise: Variance,
lwe_public_key_zero_encryption_count: LwePublicKeyZeroEncryptionCount,
) -> Result<LwePublicKey64, LwePublicKeyGenerationError<Self::EngineError>>
fn generate_new_lwe_public_key( &mut self, lwe_secret_key: &LweSecretKey64, noise: Variance, lwe_public_key_zero_encryption_count: LwePublicKeyZeroEncryptionCount, ) -> Result<LwePublicKey64, LwePublicKeyGenerationError<Self::EngineError>>
§Example:
use concrete_core::prelude::{LweDimension, LwePublicKeyZeroEncryptionCount, *};
// DISCLAIMER: the parameters used here are only for test purpose, and are not secure.
let lwe_dimension = LweDimension(6);
let noise = Variance(2_f64.powf(-50.));
let lwe_public_key_zero_encryption_count = LwePublicKeyZeroEncryptionCount(42);
// 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 mut par_engine = DefaultParallelEngine::new(Box::new(UnixSeeder::new(UNSAFE_SECRET)))?;
let lwe_secret_key: LweSecretKey64 = engine.generate_new_lwe_secret_key(lwe_dimension)?;
let public_key: LwePublicKey64 = par_engine.generate_new_lwe_public_key(
&lwe_secret_key,
noise,
lwe_public_key_zero_encryption_count,
)?;
assert_eq!(public_key.lwe_dimension(), lwe_dimension);
assert_eq!(
public_key.lwe_zero_encryption_count(),
lwe_public_key_zero_encryption_count
);
Source§unsafe fn generate_new_lwe_public_key_unchecked(
&mut self,
lwe_secret_key: &LweSecretKey64,
noise: Variance,
lwe_public_key_zero_encryption_count: LwePublicKeyZeroEncryptionCount,
) -> LwePublicKey64
unsafe fn generate_new_lwe_public_key_unchecked( &mut self, lwe_secret_key: &LweSecretKey64, noise: Variance, lwe_public_key_zero_encryption_count: LwePublicKeyZeroEncryptionCount, ) -> LwePublicKey64
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 LweSeededBootstrapKeyGenerationEngine<LweSecretKey64, GlweSecretKey64, LweSeededBootstrapKey64> for DefaultParallelEngine
§Description:
Implementation of LweSeededBootstrapKeyGenerationEngine for DefaultParallelEngine that
operates on 64 bits integers. It outputs a seeded bootstrap key in the standard domain.
impl LweSeededBootstrapKeyGenerationEngine<LweSecretKey64, GlweSecretKey64, LweSeededBootstrapKey64> for DefaultParallelEngine
§Description:
Implementation of LweSeededBootstrapKeyGenerationEngine for DefaultParallelEngine that
operates on 64 bits integers. It outputs a seeded bootstrap key in the standard domain.
Source§fn generate_new_lwe_seeded_bootstrap_key(
&mut self,
input_key: &LweSecretKey64,
output_key: &GlweSecretKey64,
decomposition_base_log: DecompositionBaseLog,
decomposition_level_count: DecompositionLevelCount,
noise: Variance,
) -> Result<LweSeededBootstrapKey64, LweSeededBootstrapKeyGenerationError<Self::EngineError>>
fn generate_new_lwe_seeded_bootstrap_key( &mut self, input_key: &LweSecretKey64, output_key: &GlweSecretKey64, decomposition_base_log: DecompositionBaseLog, decomposition_level_count: DecompositionLevelCount, noise: Variance, ) -> Result<LweSeededBootstrapKey64, 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: LweSecretKey64 = default_engine.generate_new_lwe_secret_key(lwe_dim)?;
let glwe_sk: GlweSecretKey64 =
default_engine.generate_new_glwe_secret_key(glwe_dim, poly_size)?;
let bsk: LweSeededBootstrapKey64 = 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: &LweSecretKey64,
output_key: &GlweSecretKey64,
decomposition_base_log: DecompositionBaseLog,
decomposition_level_count: DecompositionLevelCount,
noise: Variance,
) -> LweSeededBootstrapKey64
unsafe fn generate_new_lwe_seeded_bootstrap_key_unchecked( &mut self, input_key: &LweSecretKey64, output_key: &GlweSecretKey64, decomposition_base_log: DecompositionBaseLog, decomposition_level_count: DecompositionLevelCount, noise: Variance, ) -> LweSeededBootstrapKey64
Auto Trait Implementations§
impl Freeze for DefaultParallelEngine
impl RefUnwindSafe for DefaultParallelEngine
impl Send for DefaultParallelEngine
impl Sync for DefaultParallelEngine
impl Unpin for DefaultParallelEngine
impl UnwindSafe for DefaultParallelEngine
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> 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