pub struct LweCiphertextVector32(_);
Expand description

A structure representing a vector of LWE ciphertexts with 32 bits of precision.

Trait Implementations

The kind of the entity.

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Deserialize this value from the given Serde deserializer. Read more

Destroys an entity.

Unsafely destroys an entity. Read more

Description:

Implementation of LweCiphertextVectorDecryptionEngine for CoreEngine that operates on 32 bits integers.

Example:
use concrete_commons::dispersion::Variance;
use concrete_commons::parameters::{LweCiphertextCount, LweDimension, PlaintextCount};
use concrete_core::prelude::*;

// DISCLAIMER: the parameters used here are only for test purpose, and are not secure.
let lwe_dimension = LweDimension(6);
// Here a hard-set encoding is applied (shift by 20 bits)
let input = vec![3_u32 << 20; 18];
let noise = Variance(2_f64.powf(-25.));

let mut engine = CoreEngine::new()?;
let key: LweSecretKey32 = engine.create_lwe_secret_key(lwe_dimension)?;
let plaintext_vector: PlaintextVector32 = engine.create_plaintext_vector(&input)?;
let ciphertext_vector: LweCiphertextVector32 =
    engine.encrypt_lwe_ciphertext_vector(&key, &plaintext_vector, noise)?;

let decrypted_plaintext_vector =
    engine.decrypt_lwe_ciphertext_vector(&key, &ciphertext_vector)?;

assert_eq!(
    decrypted_plaintext_vector.plaintext_count(),
    PlaintextCount(18)
);

engine.destroy(key)?;
engine.destroy(plaintext_vector)?;
engine.destroy(ciphertext_vector)?;
engine.destroy(decrypted_plaintext_vector)?;

Unsafely decrypts an LWE ciphertext vector. Read more

Description:

Implementation of LweCiphertextVectorDiscardingAffineTransformationEngine for CoreEngine that operates on 32 bits integers.

Example:
use concrete_commons::dispersion::Variance;
use concrete_commons::parameters::LweDimension;
use concrete_core::prelude::*;

// DISCLAIMER: the parameters used here are only for test purpose, and are not secure.
let lwe_dimension = LweDimension(2);
// Here a hard-set encoding is applied (shift by 20 bits)
let input_vector = vec![3_u32 << 20; 8];
let weights_input = vec![2_u32; 8];
let bias_input = 8_u32 << 20;
let noise = Variance::from_variance(2_f64.powf(-25.));

let mut engine = CoreEngine::new()?;
let key: LweSecretKey32 = engine.create_lwe_secret_key(lwe_dimension)?;
let weights: CleartextVector32 = engine.create_cleartext_vector(&input_vector)?;
let bias: Plaintext32 = engine.create_plaintext(&bias_input)?;
let plaintext_vector: PlaintextVector32 = engine.create_plaintext_vector(&input_vector)?;
let ciphertext_vector = engine.encrypt_lwe_ciphertext_vector(&key, &plaintext_vector, noise)?;
let mut output_ciphertext = engine.zero_encrypt_lwe_ciphertext(&key, noise)?;

engine.discard_affine_transform_lwe_ciphertext_vector(
    &mut output_ciphertext,
    &ciphertext_vector,
    &weights,
    &bias,
)?;
assert_eq!(output_ciphertext.lwe_dimension(), lwe_dimension);

engine.destroy(key)?;
engine.destroy(weights)?;
engine.destroy(bias)?;
engine.destroy(plaintext_vector)?;
engine.destroy(ciphertext_vector)?;
engine.destroy(output_ciphertext)?;

Unsafely performs the affine transform of an LWE ciphertext vector. Read more

Description:

Implementation of LweCiphertextVectorDiscardingDecryptionEngine for CoreEngine that operates on 32 bits integers.

Example:
use concrete_commons::dispersion::Variance;
use concrete_commons::parameters::{LweCiphertextCount, LweDimension, PlaintextCount};
use concrete_core::prelude::*;

// DISCLAIMER: the parameters used here are only for test purpose, and are not secure.
let lwe_dimension = LweDimension(6);
// Here a hard-set encoding is applied (shift by 20 bits)
let input = vec![3_u32 << 20; 18];
let noise = Variance(2_f64.powf(-25.));

let mut engine = CoreEngine::new()?;
let key: LweSecretKey32 = engine.create_lwe_secret_key(lwe_dimension)?;
let mut plaintext_vector: PlaintextVector32 = engine.create_plaintext_vector(&input)?;
let ciphertext_vector: LweCiphertextVector32 =
    engine.encrypt_lwe_ciphertext_vector(&key, &plaintext_vector, noise)?;

engine.discard_decrypt_lwe_ciphertext_vector(
    &key,
    &mut plaintext_vector,
    &ciphertext_vector,
)?;
assert_eq!(plaintext_vector.plaintext_count(), PlaintextCount(18));

engine.destroy(key)?;
engine.destroy(plaintext_vector)?;
engine.destroy(ciphertext_vector)?;

Unsafely decrypts an LWE ciphertext vector. Read more

Description:

Implementation of LweCiphertextVectorDiscardingEncryptionEngine for CoreEngine that operates on 32 bits integers.

Example:
use concrete_commons::dispersion::Variance;
use concrete_commons::parameters::{LweCiphertextCount, LweDimension};
use concrete_core::prelude::*;

// DISCLAIMER: the parameters used here are only for test purpose, and are not secure.
let lwe_dimension = LweDimension(6);
// Here a hard-set encoding is applied (shift by 20 bits)
let input = vec![3_u32 << 20; 3];
let noise = Variance(2_f64.powf(-25.));

let mut engine = CoreEngine::new()?;
let key: LweSecretKey32 = engine.create_lwe_secret_key(lwe_dimension)?;
let plaintext_vector: PlaintextVector32 = engine.create_plaintext_vector(&input)?;
let mut ciphertext_vector: LweCiphertextVector32 =
    engine.zero_encrypt_lwe_ciphertext_vector(&key, noise, LweCiphertextCount(3))?;

engine.discard_encrypt_lwe_ciphertext_vector(
    &key,
    &mut ciphertext_vector,
    &plaintext_vector,
    noise,
)?;
assert_eq!(ciphertext_vector.lwe_dimension(), lwe_dimension);
assert_eq!(

engine.destroy(key)?;
engine.destroy(plaintext_vector)?;
engine.destroy(ciphertext_vector)?;

Unsafely encryprs an LWE ciphertext vector. Read more

Description:

Implementation of LweCiphertextVectorEncryptionEngine for CoreEngine that operates on 32 bits integers.

Example:
use concrete_commons::dispersion::Variance;
use concrete_commons::parameters::{LweCiphertextCount, LweDimension};
use concrete_core::prelude::*;

// DISCLAIMER: the parameters used here are only for test purpose, and are not secure.
let lwe_dimension = LweDimension(6);
// Here a hard-set encoding is applied (shift by 20 bits)
let input = vec![3_u32 << 20; 3];
let noise = Variance(2_f64.powf(-25.));

let mut engine = CoreEngine::new()?;
let key: LweSecretKey32 = engine.create_lwe_secret_key(lwe_dimension)?;
let plaintext_vector: PlaintextVector32 = engine.create_plaintext_vector(&input)?;

let mut ciphertext_vector: LweCiphertextVector32 =
    engine.encrypt_lwe_ciphertext_vector(&key, &plaintext_vector, noise)?;
assert_eq!(ciphertext_vector.lwe_dimension(), lwe_dimension);
assert_eq!(

engine.destroy(key)?;
engine.destroy(plaintext_vector)?;
engine.destroy(ciphertext_vector)?;

Unsafely encrypts an LWE ciphertext vector. Read more

The distribution of key the ciphertext was encrypted with.

Returns the LWE dimension of the ciphertexts.

Returns the number of ciphertexts contained in the vector.

Example:

use concrete_commons::dispersion::Variance;
use concrete_commons::parameters::LweSize;
use concrete_core::prelude::*;

// DISCLAIMER: the parameters used here are only for test purpose, and are not secure.
let lwe_size = LweSize(10);
let input = vec![3_u32 << 20; 3];

let mut engine = CoreEngine::new()?;
let plaintext_vector: PlaintextVector32 = engine.create_plaintext_vector(&input)?;
let ciphertext_vector: LweCiphertextVector32 =
    engine.trivially_encrypt_lwe_ciphertext_vector(lwe_size, &plaintext_vector)?;

assert_eq!(ciphertext_vector.lwe_dimension().to_lwe_size(), lwe_size);
assert_eq!(
    ciphertext_vector.lwe_ciphertext_count().0,
    plaintext_vector.plaintext_count().0
);

engine.destroy(plaintext_vector)?;
engine.destroy(ciphertext_vector)?;

Unsafely creates the trivial LWE encryption of the plaintext vector. Read more

Description:

Implementation of LweCiphertextVectorZeroEncryptionEngine for CoreEngine that operates on 32 bits integers.

Example:
use concrete_commons::dispersion::Variance;
use concrete_commons::parameters::{LweCiphertextCount, LweDimension};
use concrete_core::prelude::*;

// 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.));

let mut engine = CoreEngine::new()?;
let key: LweSecretKey32 = engine.create_lwe_secret_key(lwe_dimension)?;

let ciphertext_vector =
    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);

engine.destroy(key)?;
engine.destroy(ciphertext_vector)?;

Unsafely encrypts zeros in an LWE ciphertext vector. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

Should always be Self

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.