DefaultParallelEngine

Struct DefaultParallelEngine 

Source
pub struct DefaultParallelEngine { /* private fields */ }

Trait Implementations§

Source§

impl AbstractEngine for DefaultParallelEngine

Source§

type EngineError = DefaultParallelError

The error associated to the engine.
Source§

type Parameters = Box<dyn Seeder>

The constructor parameters type.
Source§

fn new(parameters: Self::Parameters) -> Result<Self, Self::EngineError>

A constructor for the engine.
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.

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>>

§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

Unsafely generates a new LWE bootstrap key. Read more
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.

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>>

§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

Unsafely generates a new LWE bootstrap key. Read more
Source§

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>>

§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

Unsafely encrypts zeros in an LWE ciphertext vector. Read more
Source§

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>>

§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

Unsafely encrypts zeros in an LWE ciphertext vector. Read more
Source§

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>>

§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

Unsafely generate a new LWE CBSFPKSK. Read more
Source§

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>>

§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

Unsafely generate a new LWE CBSFPKSK. Read more
Source§

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>>

§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

Unsafely generates a new LWE public key. Read more
Source§

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>>

§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

Unsafely generates a new LWE public key. Read more
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.

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>>

§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

Unsafely generates a new seeded LWE bootstrap key. Read more
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.

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>>

§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

Unsafely generates a new seeded LWE bootstrap key. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.