diff --git a/tfhe/docs/fundamentals/compress.md b/tfhe/docs/fundamentals/compress.md index 9769beb72b..120948b7b2 100644 --- a/tfhe/docs/fundamentals/compress.md +++ b/tfhe/docs/fundamentals/compress.md @@ -16,7 +16,7 @@ This example shows how to compress a ciphertext encrypting messages over 16 bits ```rust use tfhe::prelude::*; -use tfhe::{ConfigBuilder, generate_keys, set_server_key, CompressedFheUint16}; +use tfhe::{ConfigBuilder, generate_keys, CompressedFheUint16}; fn main() { let config = ConfigBuilder::default().build(); @@ -131,7 +131,7 @@ This example shows how to compress the server keys: ```rust use tfhe::prelude::*; use tfhe::{ - generate_keys, set_server_key, ClientKey, CompressedServerKey, ConfigBuilder, FheUint8, + set_server_key, ClientKey, CompressedServerKey, ConfigBuilder, FheUint8, }; fn main() { @@ -176,7 +176,7 @@ This issue has been identified and will be addressed in future releases. ```rust use tfhe::prelude::*; -use tfhe::{ConfigBuilder, generate_keys, set_server_key, FheUint8, CompressedPublicKey}; +use tfhe::{ConfigBuilder, generate_keys, FheUint8, CompressedPublicKey}; fn main() { let config = ConfigBuilder::default().build(); @@ -204,7 +204,7 @@ This example shows how to use compressed compact public keys: ```rust use tfhe::prelude::*; use tfhe::{ - generate_keys, set_server_key, CompactCiphertextList, CompressedCompactPublicKey, + generate_keys, CompactCiphertextList, CompressedCompactPublicKey, ConfigBuilder, FheUint8, }; diff --git a/tfhe/docs/fundamentals/serialization.md b/tfhe/docs/fundamentals/serialization.md index 52ee964133..6c9f8d0563 100644 --- a/tfhe/docs/fundamentals/serialization.md +++ b/tfhe/docs/fundamentals/serialization.md @@ -29,7 +29,7 @@ use tfhe::prelude::*; fn main() -> Result<(), Box>{ let config = ConfigBuilder::default().build(); - let ( client_key, server_key) = generate_keys(config); + let (client_key, server_key) = generate_keys(config); let msg1 = 1; let msg2 = 0; @@ -96,7 +96,6 @@ Here is an example: // main.rs use tfhe::conformance::ParameterSetConformant; -use tfhe::integer::parameters::RadixCiphertextConformanceParams; use tfhe::prelude::*; use tfhe::safe_deserialization::{safe_deserialize_conformant, safe_serialize}; use tfhe::shortint::parameters::{PARAM_MESSAGE_2_CARRY_2_KS_PBS, PARAM_MESSAGE_2_CARRY_2_PBS_KS}; @@ -107,14 +106,12 @@ use tfhe::{ }; fn main() { - let config = ConfigBuilder::default().build(); - let params_1 = PARAM_MESSAGE_2_CARRY_2_KS_PBS; let params_2 = PARAM_MESSAGE_2_CARRY_2_PBS_KS; - let (client_key, server_key) = generate_keys( - ConfigBuilder::with_custom_parameters(params_1).build() - ); + let config = ConfigBuilder::with_custom_parameters(params_1).build(); + + let (client_key, server_key) = generate_keys(config); let conformance_params_1 = FheUint8ConformanceParams::from(params_1); let conformance_params_2 = FheUint8ConformanceParams::from(params_2); diff --git a/tfhe/docs/getting_started/operations.md b/tfhe/docs/getting_started/operations.md index bd03166f4d..8c396c8206 100644 --- a/tfhe/docs/getting_started/operations.md +++ b/tfhe/docs/getting_started/operations.md @@ -93,7 +93,7 @@ fn main() -> Result<(), Box> { let mut a = FheUint8::try_encrypt(clear_a, &keys)?; let mut b = FheUint8::try_encrypt(clear_b, &keys)?; - let mut c = FheUint8::try_encrypt(clear_c, &keys)?; + let c = FheUint8::try_encrypt(clear_c, &keys)?; let mut d = FheInt8::try_encrypt(clear_d, &keys)?; @@ -193,8 +193,8 @@ fn main() -> Result<(), Box> { let clear_a: i8 = -121; let clear_b: i8 = 87; - let mut a = FheInt8::try_encrypt(clear_a, &keys)?; - let mut b = FheInt8::try_encrypt(clear_b, &keys)?; + let a = FheInt8::try_encrypt(clear_a, &keys)?; + let b = FheInt8::try_encrypt(clear_b, &keys)?; let greater = a.gt(&b); let greater_or_equal = a.ge(&b); @@ -241,8 +241,8 @@ fn main() -> Result<(), Box> { let clear_a:u8 = 164; let clear_b:u8 = 212; - let mut a = FheUint8::try_encrypt(clear_a, &keys)?; - let mut b = FheUint8::try_encrypt(clear_b, &keys)?; + let a = FheUint8::try_encrypt(clear_a, &keys)?; + let b = FheUint8::try_encrypt(clear_b, &keys)?; let min = a.min(&b); let max = a.max(&b); diff --git a/tfhe/docs/guides/public_key.md b/tfhe/docs/guides/public_key.md index 798d36bf7b..991ac6f1cf 100644 --- a/tfhe/docs/guides/public_key.md +++ b/tfhe/docs/guides/public_key.md @@ -15,7 +15,7 @@ This example shows how to use classical public keys. ```rust use tfhe::prelude::*; -use tfhe::{ConfigBuilder, generate_keys, set_server_key, FheUint8, PublicKey}; +use tfhe::{ConfigBuilder, generate_keys, FheUint8, PublicKey}; fn main() { let config = ConfigBuilder::default().build(); @@ -38,7 +38,7 @@ For more information on using compact public keys to encrypt data and generate a ```rust use tfhe::prelude::*; use tfhe::{ - generate_keys, set_server_key, CompactCiphertextList, CompactPublicKey, ConfigBuilder, FheUint8, + generate_keys, CompactCiphertextList, CompactPublicKey, ConfigBuilder, FheUint8, }; diff --git a/tfhe/docs/guides/rayon_crate.md b/tfhe/docs/guides/rayon_crate.md index 605cdadfa8..9427df107b 100644 --- a/tfhe/docs/guides/rayon_crate.md +++ b/tfhe/docs/guides/rayon_crate.md @@ -11,7 +11,6 @@ This document describes how to use Rayon for parallel processing in **TFHE-rs**, The high-level API requires to call `set_server_key` on each thread where computations need to be done. So a first attempt to use Rayon with **TFHE-rs** might look like this: ```rust -use rayon::prelude::*; use tfhe::prelude::*; use tfhe::{ConfigBuilder, set_server_key, FheUint8, generate_keys}; @@ -51,7 +50,6 @@ However, due to Rayon's work-stealing mechanism and **TFHE-rs'** internals, this The correct way is to call `rayon::broadcast` as follows: ```rust -use rayon::prelude::*; use tfhe::prelude::*; use tfhe::{ConfigBuilder, set_server_key, FheUint8, generate_keys}; @@ -95,7 +93,6 @@ fn main() { For applications that need to operate concurrently on data from different clients and require each client to use multiple threads, you need to create separate Rayon thread pools: ```rust -use rayon::prelude::*; use tfhe::prelude::*; use tfhe::{ConfigBuilder, set_server_key, FheUint8, generate_keys}; diff --git a/tfhe/docs/guides/zk-pok.md b/tfhe/docs/guides/zk-pok.md index 5754ebbae4..cb173e208a 100644 --- a/tfhe/docs/guides/zk-pok.md +++ b/tfhe/docs/guides/zk-pok.md @@ -43,7 +43,7 @@ pub fn main() -> Result<(), Box> { set_server_key(server_key); // Verify the ciphertexts - let mut expander = proven_compact_list.verify_and_expand(public_zk_params, &public_key)?; + let expander = proven_compact_list.verify_and_expand(public_zk_params, &public_key)?; let a: tfhe::FheUint64 = expander.get(0).unwrap()?; let b: tfhe::FheUint64 = expander.get(1).unwrap()?; @@ -115,7 +115,7 @@ pub fn main() -> Result<(), Box> { set_server_key(server_key); // Verify the ciphertexts - let mut expander = proven_compact_list.verify_and_expand(public_zk_params, &public_key)?; + let expander = proven_compact_list.verify_and_expand(public_zk_params, &public_key)?; let a: tfhe::FheUint64 = expander.get(0).unwrap()?; let b: tfhe::FheUint64 = expander.get(1).unwrap()?; diff --git a/tfhe/docs/references/fine-grained-apis/boolean/README.md b/tfhe/docs/references/fine-grained-apis/boolean/README.md index 420d10332e..62e3ca49f3 100644 --- a/tfhe/docs/references/fine-grained-apis/boolean/README.md +++ b/tfhe/docs/references/fine-grained-apis/boolean/README.md @@ -142,8 +142,6 @@ fn main() { Once the encrypted inputs are on the **server side**, the `server_key` can be used to homomorphically execute the desired Boolean circuit: ```rust -use std::fs::File; -use std::io::{Write, Read}; use tfhe::boolean::prelude::*; fn main() { @@ -154,28 +152,28 @@ fn main() { let encoded_1: Vec = bincode::serialize(&ct_1).unwrap(); let encoded_2: Vec = bincode::serialize(&ct_2).unwrap(); -//---------------------------- ON SERVER SIDE ---------------------------- + //---------------------------- ON SERVER SIDE ---------------------------- -// We deserialize the ciphertexts: + // We deserialize the ciphertexts: let ct_1: Ciphertext = bincode::deserialize(&encoded_1[..]) .expect("failed to deserialize"); let ct_2: Ciphertext = bincode::deserialize(&encoded_2[..]) .expect("failed to deserialize"); -// We use the server key to execute the boolean circuit: -// if ((NOT ct_2) NAND (ct_1 AND ct_2)) then (NOT ct_2) else (ct_1 AND ct_2) + // We use the server key to execute the boolean circuit: + // if ((NOT ct_2) NAND (ct_1 AND ct_2)) then (NOT ct_2) else (ct_1 AND ct_2) let ct_3 = server_key.not(&ct_2); let ct_4 = server_key.and(&ct_1, &ct_2); let ct_5 = server_key.nand(&ct_3, &ct_4); let ct_6 = server_key.mux(&ct_5, &ct_3, &ct_4); -// Then we serialize the output of the circuit: + // Then we serialize the output of the circuit: let encoded_output: Vec = bincode::serialize(&ct_6) .expect("failed to serialize output"); -// ... -// And we send the output to the client -// ... + // ... + // And we send the output to the client + // ... } ``` @@ -184,8 +182,6 @@ fn main() { Once the encrypted output is on the client side, the `client_key` can be used to decrypt it: ```rust -use std::fs::File; -use std::io::{Write, Read}; use tfhe::boolean::prelude::*; fn main() { diff --git a/tfhe/docs/references/fine-grained-apis/boolean/parameters.md b/tfhe/docs/references/fine-grained-apis/boolean/parameters.md index a2559c579d..110446abaf 100644 --- a/tfhe/docs/references/fine-grained-apis/boolean/parameters.md +++ b/tfhe/docs/references/fine-grained-apis/boolean/parameters.md @@ -25,25 +25,23 @@ You can also create your own set of parameters. This is an `unsafe` operation as use tfhe::boolean::prelude::*; fn main() { -// WARNING: might be insecure and/or incorrect -// You can create your own set of parameters - let parameters = unsafe { - BooleanParameters::new( - LweDimension(586), - GlweDimension(2), - PolynomialSize(512), - DynamicDistribution::new_gaussian_from_std_dev( - StandardDev(0.00008976167396834998), - ), - DynamicDistribution::new_gaussian_from_std_dev( - StandardDev(0.00000002989040792967434), - ), - DecompositionBaseLog(8), - DecompositionLevelCount(2), - DecompositionBaseLog(2), - DecompositionLevelCount(5), - EncryptionKeyChoice::Small, - ) - }; + // WARNING: might be insecure and/or incorrect + // You can create your own set of parameters + let parameters = BooleanParameters::new( + LweDimension(586), + GlweDimension(2), + PolynomialSize(512), + DynamicDistribution::new_gaussian_from_std_dev( + StandardDev(0.00008976167396834998), + ), + DynamicDistribution::new_gaussian_from_std_dev( + StandardDev(0.00000002989040792967434), + ), + DecompositionBaseLog(8), + DecompositionLevelCount(2), + DecompositionBaseLog(2), + DecompositionLevelCount(5), + EncryptionKeyChoice::Small, + ); } ``` diff --git a/tfhe/docs/references/fine-grained-apis/integer/operations.md b/tfhe/docs/references/fine-grained-apis/integer/operations.md index ae95c51b3b..4c9cc46477 100644 --- a/tfhe/docs/references/fine-grained-apis/integer/operations.md +++ b/tfhe/docs/references/fine-grained-apis/integer/operations.md @@ -244,8 +244,8 @@ fn main() { // We use the client key to encrypt two messages: let mut ct_1 = client_key.encrypt(msg1); - let mut ct_2 = client_key.encrypt(msg2); - let mut ct_3 = client_key.encrypt(msg3); + let ct_2 = client_key.encrypt(msg2); + let ct_3 = client_key.encrypt(msg3); server_key.scalar_mul_assign_parallelized(&mut ct_1, scalar); diff --git a/tfhe/docs/references/fine-grained-apis/shortint/operations.md b/tfhe/docs/references/fine-grained-apis/shortint/operations.md index b44d3743fc..57e0249fe5 100644 --- a/tfhe/docs/references/fine-grained-apis/shortint/operations.md +++ b/tfhe/docs/references/fine-grained-apis/shortint/operations.md @@ -172,7 +172,7 @@ fn main() { // We use the client key to encrypt two messages: let mut ct_1 = client_key.encrypt(msg1); - let mut ct_2 = client_key.encrypt(msg2); + let ct_2 = client_key.encrypt(msg2); server_key.scalar_mul_assign(&mut ct_1, scalar); server_key.sub_assign(&mut ct_1, &ct_2); @@ -334,8 +334,6 @@ fn main() { let msg1 = 3; - let modulus = client_key.parameters.message_modulus().0; - // We use the private client key to encrypt a message: let ct_1 = client_key.encrypt(msg1); diff --git a/tfhe/docs/references/fine-grained-apis/shortint/parameters.md b/tfhe/docs/references/fine-grained-apis/shortint/parameters.md index 1abe976be2..70c0881f4a 100644 --- a/tfhe/docs/references/fine-grained-apis/shortint/parameters.md +++ b/tfhe/docs/references/fine-grained-apis/shortint/parameters.md @@ -55,28 +55,28 @@ use tfhe::shortint::prelude::*; use tfhe::shortint::parameters::DynamicDistribution; fn main() { - let param = unsafe { - ClassicPBSParameters::new( - LweDimension(656), - GlweDimension(2), - PolynomialSize(512), - DynamicDistribution::new_gaussian_from_std_dev( - StandardDev(0.000034119201269311964), - ), - DynamicDistribution::new_gaussian_from_std_dev( - StandardDev(0.00000004053919869756513), - ), - DecompositionBaseLog(8), - DecompositionLevelCount(2), - DecompositionBaseLog(3), - DecompositionLevelCount(4), - MessageModulus(4), - CarryModulus(1), - MaxNoiseLevel::new(2), - 2.0f64.powi(-40), - CiphertextModulus::new_native(), - EncryptionKeyChoice::Big, - ) - }; + // WARNING: might be insecure and/or incorrect + // You can create your own set of parameters + let param = ClassicPBSParameters::new( + LweDimension(656), + GlweDimension(2), + PolynomialSize(512), + DynamicDistribution::new_gaussian_from_std_dev( + StandardDev(0.000034119201269311964), + ), + DynamicDistribution::new_gaussian_from_std_dev( + StandardDev(0.00000004053919869756513), + ), + DecompositionBaseLog(8), + DecompositionLevelCount(2), + DecompositionBaseLog(3), + DecompositionLevelCount(4), + MessageModulus(4), + CarryModulus(1), + MaxNoiseLevel::new(2), + 2.0f64.powi(-40), + CiphertextModulus::new_native(), + EncryptionKeyChoice::Big, + ); } ``` diff --git a/tfhe/docs/tutorials/ascii_fhe_string.md b/tfhe/docs/tutorials/ascii_fhe_string.md index bca0f66c85..771a1f8905 100644 --- a/tfhe/docs/tutorials/ascii_fhe_string.md +++ b/tfhe/docs/tutorials/ascii_fhe_string.md @@ -35,7 +35,9 @@ The `FheAsciiString::encrypt` function performs data validation to ensure the in In FHE operations, direct branching on encrypted values is not possible. However, you can evaluate a boolean condition to obtain the desired outcome. Here is an example to check and convert the 'char' to a lowercase without using a branch: ```rust -pub const UP_LOW_DISTANCE: u8 = 32; +#![allow(dead_code)] + +const UP_LOW_DISTANCE: u8 = 32; fn to_lower(c: u8) -> u8 { if c > 64 && c < 91 { @@ -49,7 +51,9 @@ fn to_lower(c: u8) -> u8 { You can remove the branch this way: ```rust -pub const UP_LOW_DISTANCE: u8 = 32; +#![allow(dead_code)] + +const UP_LOW_DISTANCE: u8 = 32; fn to_lower(c: u8) -> u8 { c + ((c > 64) as u8 & (c < 91) as u8) * UP_LOW_DISTANCE @@ -59,10 +63,12 @@ fn to_lower(c: u8) -> u8 { This method can adapt to operations on homomorphic integers: ```rust +#![allow(dead_code)] + use tfhe::prelude::*; use tfhe::FheUint8; -pub const UP_LOW_DISTANCE: u8 = 32; +const UP_LOW_DISTANCE: u8 = 32; fn to_lower(c: &FheUint8) -> FheUint8 { c + FheUint8::cast_from(c.gt(64) & c.lt(91)) * UP_LOW_DISTANCE @@ -75,7 +81,7 @@ Full example: use tfhe::prelude::*; use tfhe::{generate_keys, set_server_key, ClientKey, ConfigBuilder, FheUint8}; -pub const UP_LOW_DISTANCE: u8 = 32; +const UP_LOW_DISTANCE: u8 = 32; struct FheAsciiString { bytes: Vec, diff --git a/tfhe/docs/tutorials/parity_bit.md b/tfhe/docs/tutorials/parity_bit.md index 6c04beb7a4..9a7b279b21 100644 --- a/tfhe/docs/tutorials/parity_bit.md +++ b/tfhe/docs/tutorials/parity_bit.md @@ -30,8 +30,8 @@ The function initializes the parity bit to `false`, then applies the `XOR` opera The validation function also adds the number of the bits set in the input to the computed parity bit and checks whether the sum is even or odd, depending on the mode. ```rust +#![allow(dead_code)] use tfhe::FheBool; -use tfhe::prelude::*; #[derive(Copy, Clone, Debug)] enum ParityMode { @@ -253,6 +253,7 @@ where The final code is as follows: ```rust +#![allow(dead_code)] use std::ops::{Not, BitXor}; #[derive(Copy, Clone, Debug)] @@ -334,7 +335,7 @@ fn check_parity_bit_validity(bits: &[bool], mode: ParityMode, parity_bit: bool) fn main() { let config = ConfigBuilder::default().build(); - let ( client_key, server_key) = generate_keys(config); + let (client_key, server_key) = generate_keys(config); set_server_key(server_key); diff --git a/tfhe/src/boolean/client_key/mod.rs b/tfhe/src/boolean/client_key/mod.rs index 46d72e9ef9..804ddeade0 100644 --- a/tfhe/src/boolean/client_key/mod.rs +++ b/tfhe/src/boolean/client_key/mod.rs @@ -138,7 +138,6 @@ impl ClientKey { /// ```rust /// use tfhe::boolean::client_key::ClientKey; /// use tfhe::boolean::parameters::PARAMETERS_ERROR_PROB_2_POW_MINUS_165; - /// use tfhe::boolean::prelude::*; /// /// // Generate the client key: /// let cks = ClientKey::new(&PARAMETERS_ERROR_PROB_2_POW_MINUS_165); @@ -154,7 +153,6 @@ impl ClientKey { /// ```rust /// use tfhe::boolean::client_key::ClientKey; /// use tfhe::boolean::parameters::PARAMETERS_ERROR_PROB_2_POW_MINUS_165; - /// use tfhe::boolean::prelude::*; /// /// // Generate the client key: /// let cks = ClientKey::new(&PARAMETERS_ERROR_PROB_2_POW_MINUS_165); @@ -187,12 +185,13 @@ impl ClientKey { /// ```rust /// use tfhe::boolean::client_key::ClientKey; /// use tfhe::boolean::parameters::PARAMETERS_ERROR_PROB_2_POW_MINUS_165; - /// use tfhe::boolean::prelude::*; /// /// // Generate the client key: /// let cks = ClientKey::new(&PARAMETERS_ERROR_PROB_2_POW_MINUS_165); /// let (lwe_secret_key, glwe_secret_key, parameters) = cks.into_raw_parts(); - /// let reconstructed_cks = ClientKey::new_from_raw_parts(lwe_secret_key, glwe_secret_key, parameters); + /// let reconstructed_cks = + /// ClientKey::new_from_raw_parts(lwe_secret_key, glwe_secret_key, parameters); + /// ``` pub fn new_from_raw_parts( lwe_secret_key: LweSecretKeyOwned, glwe_secret_key: GlweSecretKeyOwned, diff --git a/tfhe/src/boolean/mod.rs b/tfhe/src/boolean/mod.rs index 804386e991..6a511ce685 100644 --- a/tfhe/src/boolean/mod.rs +++ b/tfhe/src/boolean/mod.rs @@ -19,7 +19,7 @@ //! use tfhe::boolean::prelude::*; //! //! // We generate a set of client/server keys, using the default parameters: -//! let (mut client_key, mut server_key) = gen_keys(); +//! let (client_key, server_key) = gen_keys(); //! //! // We use the client secret key to encrypt two messages: //! let ct_1 = client_key.encrypt(true); @@ -109,7 +109,6 @@ pub(crate) fn random_integer() -> u32 { /// /// ```rust /// use tfhe::boolean::gen_keys; -/// use tfhe::boolean::prelude::*; /// // generate the client key and the server key: /// let (cks, sks) = gen_keys(); /// ``` diff --git a/tfhe/src/core_crypto/algorithms/ggsw_encryption.rs b/tfhe/src/core_crypto/algorithms/ggsw_encryption.rs index af27f6bb8f..e99dc19c17 100644 --- a/tfhe/src/core_crypto/algorithms/ggsw_encryption.rs +++ b/tfhe/src/core_crypto/algorithms/ggsw_encryption.rs @@ -462,8 +462,6 @@ pub fn encrypt_constant_seeded_ggsw_ciphertext_with_existing_generator< /// // Create the PRNG /// let mut seeder = new_seeder(); /// let seeder = seeder.as_mut(); -/// let mut encryption_generator = -/// EncryptionRandomGenerator::::new(seeder.seed(), seeder); /// let mut secret_generator = /// SecretRandomGenerator::::new(seeder.seed()); /// @@ -647,8 +645,6 @@ pub fn par_encrypt_constant_seeded_ggsw_ciphertext_with_existing_generator< /// // Create the PRNG /// let mut seeder = new_seeder(); /// let seeder = seeder.as_mut(); -/// let mut encryption_generator = -/// EncryptionRandomGenerator::::new(seeder.seed(), seeder); /// let mut secret_generator = /// SecretRandomGenerator::::new(seeder.seed()); /// diff --git a/tfhe/src/core_crypto/algorithms/glwe_encryption.rs b/tfhe/src/core_crypto/algorithms/glwe_encryption.rs index acfca372dc..5e5aeba858 100644 --- a/tfhe/src/core_crypto/algorithms/glwe_encryption.rs +++ b/tfhe/src/core_crypto/algorithms/glwe_encryption.rs @@ -1076,7 +1076,7 @@ pub fn trivially_encrypt_glwe_ciphertext( /// let plaintext_list = PlaintextList::new(encoded_msg, PlaintextCount(polynomial_size.0)); /// /// // Create a new GlweCiphertext -/// let mut glwe = allocate_and_trivially_encrypt_new_glwe_ciphertext( +/// let glwe = allocate_and_trivially_encrypt_new_glwe_ciphertext( /// glwe_size, /// &plaintext_list, /// ciphertext_modulus, @@ -1217,8 +1217,6 @@ pub fn encrypt_seeded_glwe_ciphertext_with_existing_generator< /// // Create the PRNG /// let mut seeder = new_seeder(); /// let seeder = seeder.as_mut(); -/// let mut encryption_generator = -/// EncryptionRandomGenerator::::new(seeder.seed(), seeder); /// let mut secret_generator = /// SecretRandomGenerator::::new(seeder.seed()); /// @@ -1406,8 +1404,6 @@ pub fn encrypt_seeded_glwe_ciphertext_list_with_existing_generator< /// // Create the PRNG /// let mut seeder = new_seeder(); /// let seeder = seeder.as_mut(); -/// let mut encryption_generator = -/// EncryptionRandomGenerator::::new(seeder.seed(), seeder); /// let mut secret_generator = /// SecretRandomGenerator::::new(seeder.seed()); /// diff --git a/tfhe/src/core_crypto/algorithms/glwe_sample_extraction.rs b/tfhe/src/core_crypto/algorithms/glwe_sample_extraction.rs index 397122a792..216d456575 100644 --- a/tfhe/src/core_crypto/algorithms/glwe_sample_extraction.rs +++ b/tfhe/src/core_crypto/algorithms/glwe_sample_extraction.rs @@ -206,7 +206,7 @@ pub fn extract_lwe_sample_from_glwe_ciphertext( /// // Create the plaintext /// let msg = 3u64; /// let encoded_msg = msg << 60; -/// let mut plaintext_list = PlaintextList::new(encoded_msg, PlaintextCount(polynomial_size.0)); +/// let plaintext_list = PlaintextList::new(encoded_msg, PlaintextCount(polynomial_size.0)); /// /// // Create a new GlweCiphertext /// let mut glwe = GlweCiphertext::new(0u64, glwe_size, polynomial_size, ciphertext_modulus); @@ -313,7 +313,7 @@ pub fn par_extract_lwe_sample_from_glwe_ciphertext( /// let plaintext = Plaintext(msg << 60); /// /// // Create a new LweCiphertext -/// let mut lwe = allocate_and_trivially_encrypt_new_lwe_ciphertext( +/// let lwe = allocate_and_trivially_encrypt_new_lwe_ciphertext( /// lwe_dimension.to_lwe_size(), /// plaintext, /// ciphertext_modulus, @@ -1018,8 +1018,6 @@ pub fn encrypt_lwe_ciphertext_with_public_key( /// // Create the PRNG /// let mut seeder = new_seeder(); /// let seeder = seeder.as_mut(); -/// let mut encryption_generator = -/// EncryptionRandomGenerator::::new(seeder.seed(), seeder); /// let mut secret_generator = /// SecretRandomGenerator::::new(seeder.seed()); /// @@ -1119,8 +1117,6 @@ pub fn encrypt_lwe_ciphertext_with_seeded_public_key::new(seeder.seed(), seeder); /// let mut secret_generator = /// SecretRandomGenerator::::new(seeder.seed()); /// @@ -1349,8 +1345,6 @@ pub fn encrypt_seeded_lwe_ciphertext_list_with_existing_generator< /// // Create the PRNG /// let mut seeder = new_seeder(); /// let seeder = seeder.as_mut(); -/// let mut encryption_generator = -/// EncryptionRandomGenerator::::new(seeder.seed(), seeder); /// let mut secret_generator = /// SecretRandomGenerator::::new(seeder.seed()); /// @@ -1520,8 +1514,6 @@ pub fn par_encrypt_seeded_lwe_ciphertext_list_with_existing_generator< /// // Create the PRNG /// let mut seeder = new_seeder(); /// let seeder = seeder.as_mut(); -/// let mut encryption_generator = -/// EncryptionRandomGenerator::::new(seeder.seed(), seeder); /// let mut secret_generator = /// SecretRandomGenerator::::new(seeder.seed()); /// @@ -1770,7 +1762,7 @@ pub fn encrypt_seeded_lwe_ciphertext::new(seeder.seed(), seeder); /// let mut secret_generator = /// SecretRandomGenerator::::new(seeder.seed()); /// diff --git a/tfhe/src/core_crypto/algorithms/slice_algorithms.rs b/tfhe/src/core_crypto/algorithms/slice_algorithms.rs index c5bb15849c..dcd8d6cf7b 100644 --- a/tfhe/src/core_crypto/algorithms/slice_algorithms.rs +++ b/tfhe/src/core_crypto/algorithms/slice_algorithms.rs @@ -15,7 +15,7 @@ use crate::core_crypto::entities::Polynomial; /// /// ```rust /// use tfhe::core_crypto::algorithms::slice_algorithms::*; -/// let mut first = vec![1u8, 2, 3, 4, 5, 6]; +/// let first = vec![1u8, 2, 3, 4, 5, 6]; /// let second = vec![255u8, 255, 255, 1, 2, 3]; /// let dot_product = slice_wrapping_dot_product(&first, &second); /// assert_eq!(dot_product, 26); @@ -74,7 +74,7 @@ where /// /// ```rust /// use tfhe::core_crypto::algorithms::slice_algorithms::*; -/// let mut first = vec![1u8, 2, 3, 4, 5, 6]; +/// let first = vec![1u8, 2, 3, 4, 5, 6]; /// let second = vec![255u8, 255, 255, 1, 2, 3]; /// let mut add = vec![0_u8; 6]; /// slice_wrapping_add(&mut add, &first, &second); @@ -229,7 +229,7 @@ pub fn slice_wrapping_add_scalar_mul_assign( /// /// ```rust /// use tfhe::core_crypto::algorithms::slice_algorithms::*; -/// let mut first = vec![1u8, 2, 3, 4, 5, 6]; +/// let first = vec![1u8, 2, 3, 4, 5, 6]; /// let second = vec![255u8, 255, 255, 1, 2, 3]; /// let mut add = vec![0_u8; 6]; /// slice_wrapping_sub(&mut add, &first, &second); diff --git a/tfhe/src/core_crypto/commons/math/random/generator.rs b/tfhe/src/core_crypto/commons/math/random/generator.rs index e75e71b920..70676c0715 100644 --- a/tfhe/src/core_crypto/commons/math/random/generator.rs +++ b/tfhe/src/core_crypto/commons/math/random/generator.rs @@ -120,7 +120,7 @@ impl RandomGenerator { /// use concrete_csprng::generators::SoftwareRandomGenerator; /// use concrete_csprng::seeders::Seed; /// use tfhe::core_crypto::commons::math::random::RandomGenerator; - /// let mut generator = RandomGenerator::::new(Seed(0)); + /// let generator = RandomGenerator::::new(Seed(0)); /// ``` pub fn new(seed: Seed) -> Self { Self(G::new(seed)) @@ -136,7 +136,7 @@ impl RandomGenerator { /// use tfhe::core_crypto::commons::math::random::RandomGenerator; /// let mut generator = RandomGenerator::::new(Seed(0)); /// assert_eq!(generator.remaining_bytes(), None); - /// let mut generator = generator.try_fork(1, 50).unwrap().next().unwrap(); + /// let generator = generator.try_fork(1, 50).unwrap().next().unwrap(); /// assert_eq!(generator.remaining_bytes(), Some(50)); /// ``` pub fn remaining_bytes(&self) -> Option { diff --git a/tfhe/src/core_crypto/entities/seeded_glwe_ciphertext_list.rs b/tfhe/src/core_crypto/entities/seeded_glwe_ciphertext_list.rs index 84d5677d43..99b227eb02 100644 --- a/tfhe/src/core_crypto/entities/seeded_glwe_ciphertext_list.rs +++ b/tfhe/src/core_crypto/entities/seeded_glwe_ciphertext_list.rs @@ -63,7 +63,7 @@ impl> SeededGlweCipherte /// let seeder = seeder.as_mut(); /// /// // Create a new SeededGlweCiphertextList - /// let mut seeded_glwe_list = SeededGlweCiphertextList::new( + /// let seeded_glwe_list = SeededGlweCiphertextList::new( /// 0u64, /// glwe_size, /// polynomial_size, diff --git a/tfhe/src/core_crypto/entities/seeded_lwe_ciphertext.rs b/tfhe/src/core_crypto/entities/seeded_lwe_ciphertext.rs index 16f7c1b5d6..031d2e7f0a 100644 --- a/tfhe/src/core_crypto/entities/seeded_lwe_ciphertext.rs +++ b/tfhe/src/core_crypto/entities/seeded_lwe_ciphertext.rs @@ -89,7 +89,7 @@ impl SeededLweCiphertext { /// let seeder = seeder.as_mut(); /// /// // Create a new SeededLweCiphertext - /// let mut seeded_lwe = SeededLweCiphertext::new( + /// let seeded_lwe = SeededLweCiphertext::new( /// 0u64, /// lwe_dimension.to_lwe_size(), /// seeder.seed().into(), diff --git a/tfhe/src/core_crypto/entities/seeded_lwe_ciphertext_list.rs b/tfhe/src/core_crypto/entities/seeded_lwe_ciphertext_list.rs index a2464cb0ce..90518576fc 100644 --- a/tfhe/src/core_crypto/entities/seeded_lwe_ciphertext_list.rs +++ b/tfhe/src/core_crypto/entities/seeded_lwe_ciphertext_list.rs @@ -67,7 +67,7 @@ impl> SeededLweCiphertex /// let seeder = seeder.as_mut(); /// /// // Create a new SeededLweCiphertextList - /// let mut seeded_lwe_list = SeededLweCiphertextList::new( + /// let seeded_lwe_list = SeededLweCiphertextList::new( /// 0u64, /// lwe_dimension.to_lwe_size(), /// lwe_ciphertext_count, diff --git a/tfhe/src/core_crypto/seeders.rs b/tfhe/src/core_crypto/seeders.rs index bd57267014..045703b604 100644 --- a/tfhe/src/core_crypto/seeders.rs +++ b/tfhe/src/core_crypto/seeders.rs @@ -62,10 +62,10 @@ mod wasm_seeder { /// use tfhe::core_crypto::prelude::*; /// /// let mut seeder = new_seeder(); -/// let mut seeder = seeder.as_mut(); +/// let seeder = seeder.as_mut(); /// -/// let mut first_seed = seeder.seed(); -/// let mut second_seed = seeder.seed(); +/// let first_seed = seeder.seed(); +/// let second_seed = seeder.seed(); /// assert_ne!(first_seed, second_seed); /// ``` pub fn new_seeder() -> Box { diff --git a/tfhe/src/high_level_api/global_state.rs b/tfhe/src/high_level_api/global_state.rs index 0ff11a9bc5..1593ede673 100644 --- a/tfhe/src/high_level_api/global_state.rs +++ b/tfhe/src/high_level_api/global_state.rs @@ -39,10 +39,9 @@ thread_local! { /// /// ```rust /// use std::thread; -/// use tfhe; /// use tfhe::ConfigBuilder; /// -/// let config = tfhe::ConfigBuilder::default().build(); +/// let config = ConfigBuilder::default().build(); /// let (client_key, server_key) = tfhe::generate_keys(config); /// let server_key_2 = server_key.clone(); /// diff --git a/tfhe/src/high_level_api/integers/signed/base.rs b/tfhe/src/high_level_api/integers/signed/base.rs index 4aaa908a4a..fb5818ce46 100644 --- a/tfhe/src/high_level_api/integers/signed/base.rs +++ b/tfhe/src/high_level_api/integers/signed/base.rs @@ -198,7 +198,7 @@ where /// /// ```rust /// use tfhe::prelude::*; - /// use tfhe::{generate_keys, set_server_key, ConfigBuilder, FheBool, FheInt16}; + /// use tfhe::{generate_keys, set_server_key, ConfigBuilder, FheInt16}; /// /// let (client_key, server_key) = generate_keys(ConfigBuilder::default()); /// set_server_key(server_key); @@ -231,7 +231,7 @@ where /// /// ```rust /// use tfhe::prelude::*; - /// use tfhe::{generate_keys, set_server_key, ConfigBuilder, FheBool, FheInt16}; + /// use tfhe::{generate_keys, set_server_key, ConfigBuilder, FheInt16}; /// /// let (client_key, server_key) = generate_keys(ConfigBuilder::default()); /// set_server_key(server_key); @@ -264,7 +264,7 @@ where /// /// ```rust /// use tfhe::prelude::*; - /// use tfhe::{generate_keys, set_server_key, ConfigBuilder, FheBool, FheInt16}; + /// use tfhe::{generate_keys, set_server_key, ConfigBuilder, FheInt16}; /// /// let (client_key, server_key) = generate_keys(ConfigBuilder::default()); /// set_server_key(server_key); @@ -308,7 +308,7 @@ where /// /// ```rust /// use tfhe::prelude::*; - /// use tfhe::{generate_keys, set_server_key, ConfigBuilder, FheBool, FheInt16}; + /// use tfhe::{generate_keys, set_server_key, ConfigBuilder, FheInt16}; /// /// let (client_key, server_key) = generate_keys(ConfigBuilder::default()); /// set_server_key(server_key); @@ -352,7 +352,7 @@ where /// /// ```rust /// use tfhe::prelude::*; - /// use tfhe::{generate_keys, set_server_key, ConfigBuilder, FheBool, FheInt16}; + /// use tfhe::{generate_keys, set_server_key, ConfigBuilder, FheInt16}; /// /// let (client_key, server_key) = generate_keys(ConfigBuilder::default()); /// set_server_key(server_key); @@ -396,7 +396,7 @@ where /// /// ```rust /// use tfhe::prelude::*; - /// use tfhe::{generate_keys, set_server_key, ConfigBuilder, FheBool, FheInt16}; + /// use tfhe::{generate_keys, set_server_key, ConfigBuilder, FheInt16}; /// /// let (client_key, server_key) = generate_keys(ConfigBuilder::default()); /// set_server_key(server_key); @@ -442,7 +442,7 @@ where /// /// ```rust /// use tfhe::prelude::*; - /// use tfhe::{generate_keys, set_server_key, ConfigBuilder, FheBool, FheInt16}; + /// use tfhe::{generate_keys, set_server_key, ConfigBuilder, FheInt16}; /// /// let (client_key, server_key) = generate_keys(ConfigBuilder::default()); /// set_server_key(server_key); @@ -486,7 +486,7 @@ where /// /// ```rust /// use tfhe::prelude::*; - /// use tfhe::{generate_keys, set_server_key, ConfigBuilder, FheBool, FheInt16}; + /// use tfhe::{generate_keys, set_server_key, ConfigBuilder, FheInt16}; /// /// let (client_key, server_key) = generate_keys(ConfigBuilder::default()); /// set_server_key(server_key); diff --git a/tfhe/src/high_level_api/integers/signed/ops.rs b/tfhe/src/high_level_api/integers/signed/ops.rs index d8509e8437..335d6f0063 100644 --- a/tfhe/src/high_level_api/integers/signed/ops.rs +++ b/tfhe/src/high_level_api/integers/signed/ops.rs @@ -28,7 +28,7 @@ where /// /// ```rust /// use tfhe::prelude::*; - /// use tfhe::{generate_keys, set_server_key, ConfigBuilder, FheBool, FheInt16}; + /// use tfhe::{generate_keys, set_server_key, ConfigBuilder, FheInt16}; /// /// let (client_key, server_key) = generate_keys(ConfigBuilder::default()); /// set_server_key(server_key); diff --git a/tfhe/src/high_level_api/integers/unsigned/base.rs b/tfhe/src/high_level_api/integers/unsigned/base.rs index a2e8fefe7f..4b03924ac7 100644 --- a/tfhe/src/high_level_api/integers/unsigned/base.rs +++ b/tfhe/src/high_level_api/integers/unsigned/base.rs @@ -204,7 +204,7 @@ where /// /// ```rust /// use tfhe::prelude::*; - /// use tfhe::{generate_keys, set_server_key, ConfigBuilder, FheBool, FheUint16}; + /// use tfhe::{generate_keys, set_server_key, ConfigBuilder, FheUint16}; /// /// let (client_key, server_key) = generate_keys(ConfigBuilder::default()); /// set_server_key(server_key); @@ -237,7 +237,7 @@ where /// /// ```rust /// use tfhe::prelude::*; - /// use tfhe::{generate_keys, set_server_key, ConfigBuilder, FheBool, FheUint16}; + /// use tfhe::{generate_keys, set_server_key, ConfigBuilder, FheUint16}; /// /// let (client_key, server_key) = generate_keys(ConfigBuilder::default()); /// set_server_key(server_key); @@ -332,7 +332,7 @@ where /// /// ```rust /// use tfhe::prelude::*; - /// use tfhe::{generate_keys, set_server_key, ConfigBuilder, FheBool, FheUint16}; + /// use tfhe::{generate_keys, set_server_key, ConfigBuilder, FheUint16}; /// /// let (client_key, server_key) = generate_keys(ConfigBuilder::default()); /// set_server_key(server_key); @@ -363,7 +363,7 @@ where /// /// ```rust /// use tfhe::prelude::*; - /// use tfhe::{generate_keys, set_server_key, ConfigBuilder, FheBool, FheUint16}; + /// use tfhe::{generate_keys, set_server_key, ConfigBuilder, FheUint16}; /// /// let (client_key, server_key) = generate_keys(ConfigBuilder::default()); /// set_server_key(server_key); @@ -407,7 +407,7 @@ where /// /// ```rust /// use tfhe::prelude::*; - /// use tfhe::{generate_keys, set_server_key, ConfigBuilder, FheBool, FheUint16}; + /// use tfhe::{generate_keys, set_server_key, ConfigBuilder, FheUint16}; /// /// let (client_key, server_key) = generate_keys(ConfigBuilder::default()); /// set_server_key(server_key); @@ -451,7 +451,7 @@ where /// /// ```rust /// use tfhe::prelude::*; - /// use tfhe::{generate_keys, set_server_key, ConfigBuilder, FheBool, FheUint16}; + /// use tfhe::{generate_keys, set_server_key, ConfigBuilder, FheUint16}; /// /// let (client_key, server_key) = generate_keys(ConfigBuilder::default()); /// set_server_key(server_key); @@ -495,7 +495,7 @@ where /// /// ```rust /// use tfhe::prelude::*; - /// use tfhe::{generate_keys, set_server_key, ConfigBuilder, FheBool, FheUint16}; + /// use tfhe::{generate_keys, set_server_key, ConfigBuilder, FheUint16}; /// /// let (client_key, server_key) = generate_keys(ConfigBuilder::default()); /// set_server_key(server_key); @@ -541,7 +541,7 @@ where /// /// ```rust /// use tfhe::prelude::*; - /// use tfhe::{generate_keys, set_server_key, ConfigBuilder, FheBool, FheUint16}; + /// use tfhe::{generate_keys, set_server_key, ConfigBuilder, FheUint16}; /// /// let (client_key, server_key) = generate_keys(ConfigBuilder::default()); /// set_server_key(server_key); @@ -585,7 +585,7 @@ where /// /// ```rust /// use tfhe::prelude::*; - /// use tfhe::{generate_keys, set_server_key, ConfigBuilder, FheBool, FheUint16}; + /// use tfhe::{generate_keys, set_server_key, ConfigBuilder, FheUint16}; /// /// let (client_key, server_key) = generate_keys(ConfigBuilder::default()); /// set_server_key(server_key); @@ -646,7 +646,7 @@ where /// ```rust /// use tfhe::prelude::*; /// use tfhe::{ - /// generate_keys, set_server_key, ConfigBuilder, FheBool, FheUint16, FheUint8, MatchValues, + /// generate_keys, set_server_key, ConfigBuilder, FheUint16, FheUint8, MatchValues, /// }; /// /// let (client_key, server_key) = generate_keys(ConfigBuilder::default()); @@ -715,7 +715,7 @@ where /// ```rust /// use tfhe::prelude::*; /// use tfhe::{ - /// generate_keys, set_server_key, ConfigBuilder, FheBool, FheUint16, FheUint8, MatchValues, + /// generate_keys, set_server_key, ConfigBuilder, FheUint16, FheUint8, MatchValues, /// }; /// /// let (client_key, server_key) = generate_keys(ConfigBuilder::default()); diff --git a/tfhe/src/high_level_api/integers/unsigned/ops.rs b/tfhe/src/high_level_api/integers/unsigned/ops.rs index cd0778c6f9..d777c2ec54 100644 --- a/tfhe/src/high_level_api/integers/unsigned/ops.rs +++ b/tfhe/src/high_level_api/integers/unsigned/ops.rs @@ -35,7 +35,7 @@ where /// /// ```rust /// use tfhe::prelude::*; - /// use tfhe::{generate_keys, set_server_key, ConfigBuilder, FheBool, FheUint16}; + /// use tfhe::{generate_keys, set_server_key, ConfigBuilder, FheUint16}; /// /// let (client_key, server_key) = generate_keys(ConfigBuilder::default()); /// set_server_key(server_key); @@ -107,7 +107,7 @@ where /// /// ```rust /// use tfhe::prelude::*; - /// use tfhe::{generate_keys, set_server_key, ConfigBuilder, FheBool, FheUint16}; + /// use tfhe::{generate_keys, set_server_key, ConfigBuilder, FheUint16}; /// /// let (client_key, server_key) = generate_keys(ConfigBuilder::default()); /// set_server_key(server_key); diff --git a/tfhe/src/high_level_api/prelude.rs b/tfhe/src/high_level_api/prelude.rs index 06c1fd84de..5baf64ad9f 100644 --- a/tfhe/src/high_level_api/prelude.rs +++ b/tfhe/src/high_level_api/prelude.rs @@ -3,6 +3,7 @@ //! //! It is meant to be glob imported: //! ``` +//! # #[allow(unused_imports)] //! use tfhe::prelude::*; //! ``` pub use crate::high_level_api::traits::{ diff --git a/tfhe/src/integer/ciphertext/base.rs b/tfhe/src/integer/ciphertext/base.rs index 6a0547f3b7..9d5c1a297d 100644 --- a/tfhe/src/integer/ciphertext/base.rs +++ b/tfhe/src/integer/ciphertext/base.rs @@ -169,7 +169,7 @@ impl SignedRadixCiphertext { /// # Example /// /// ```rust - /// use tfhe::integer::{gen_keys_radix, RadixCiphertext, SignedRadixCiphertext}; + /// use tfhe::integer::{gen_keys_radix, SignedRadixCiphertext}; /// use tfhe::shortint::parameters::PARAM_MESSAGE_2_CARRY_2_KS_PBS; /// /// // 8 bits diff --git a/tfhe/src/integer/ciphertext/boolean_value.rs b/tfhe/src/integer/ciphertext/boolean_value.rs index c8974ca39b..23b73da8a8 100644 --- a/tfhe/src/integer/ciphertext/boolean_value.rs +++ b/tfhe/src/integer/ciphertext/boolean_value.rs @@ -23,7 +23,7 @@ use tfhe_versionable::Versionize; /// ## Converting a [BooleanBlock] to a [RadixCiphertext] /// /// ```rust -/// use tfhe::integer::{gen_keys_radix, BooleanBlock}; +/// use tfhe::integer::gen_keys_radix; /// use tfhe::shortint::parameters::PARAM_MESSAGE_2_CARRY_2_KS_PBS; /// /// // We have 4 * 2 = 8 bits of message @@ -141,7 +141,7 @@ impl BooleanBlock { /// # Example /// /// ```rust - /// use tfhe::integer::{gen_keys_radix, RadixCiphertext, SignedRadixCiphertext}; + /// use tfhe::integer::gen_keys_radix; /// use tfhe::shortint::parameters::PARAM_MESSAGE_2_CARRY_2_KS_PBS; /// /// // 8 bits diff --git a/tfhe/src/integer/ciphertext/compact_list.rs b/tfhe/src/integer/ciphertext/compact_list.rs index 63522fc8e0..62bbeffe36 100644 --- a/tfhe/src/integer/ciphertext/compact_list.rs +++ b/tfhe/src/integer/ciphertext/compact_list.rs @@ -410,7 +410,7 @@ impl CompactCiphertextList { /// CompactCiphertextList, DataKind, IntegerCompactCiphertextListCastingMode, /// IntegerCompactCiphertextListUnpackingMode, RadixCiphertext, SignedRadixCiphertext, /// }; - /// use tfhe::integer::{ClientKey, CompactPublicKey, ServerKey}; + /// use tfhe::integer::{ClientKey, CompactPublicKey}; /// use tfhe::shortint::parameters::classic::compact_pk::PARAM_MESSAGE_2_CARRY_2_COMPACT_PK_KS_PBS; /// /// let fhe_params = PARAM_MESSAGE_2_CARRY_2_COMPACT_PK_KS_PBS; diff --git a/tfhe/src/integer/client_key/mod.rs b/tfhe/src/integer/client_key/mod.rs index 9752ab3f27..5e67966882 100644 --- a/tfhe/src/integer/client_key/mod.rs +++ b/tfhe/src/integer/client_key/mod.rs @@ -478,7 +478,6 @@ impl ClientKey { /// use tfhe::shortint::parameters::PARAM_MESSAGE_2_CARRY_2_KS_PBS; /// /// let cks = ClientKey::new(PARAM_MESSAGE_2_CARRY_2_KS_PBS); - /// let num_block = 4; /// /// let msg = 2_u64; /// @@ -496,7 +495,7 @@ impl ClientKey { /// # Example /// /// ```rust - /// use tfhe::integer::{gen_keys_radix, BooleanBlock}; + /// use tfhe::integer::gen_keys_radix; /// use tfhe::shortint::parameters::PARAM_MESSAGE_2_CARRY_2_KS_PBS; /// /// // We have 4 * 2 = 8 bits of message @@ -600,7 +599,7 @@ impl ClientKey { /// let basis: Vec = vec![2, 3, 5]; /// /// // Encryption: - /// let mut ct = cks.encrypt_crt(msg, basis); + /// let ct = cks.encrypt_crt(msg, basis); /// /// // Decryption: /// let dec = cks.decrypt_crt(&ct); @@ -677,7 +676,7 @@ impl ClientKey { /// let msg = 27_u64; /// let basis: Vec = vec![2, 3, 5]; /// // Encryption of one message: - /// let mut ct = cks.encrypt_native_crt(msg, basis); + /// let ct = cks.encrypt_native_crt(msg, basis); /// /// // Decryption: /// let dec = cks.decrypt_native_crt(&ct); diff --git a/tfhe/src/integer/mod.rs b/tfhe/src/integer/mod.rs index edad81f108..7c85fa43c8 100755 --- a/tfhe/src/integer/mod.rs +++ b/tfhe/src/integer/mod.rs @@ -23,8 +23,7 @@ //! let modulus = 1u64 << 8; //! //! // Generation of the client/server keys, using the default parameters: -//! let (mut client_key, mut server_key) = -//! gen_keys_radix(PARAM_MESSAGE_2_CARRY_2_KS_PBS, number_of_blocks); +//! let (client_key, server_key) = gen_keys_radix(PARAM_MESSAGE_2_CARRY_2_KS_PBS, number_of_blocks); //! //! let msg1 = 153u64; //! let msg2 = 125u64; diff --git a/tfhe/src/integer/server_key/crt/scalar_add_crt.rs b/tfhe/src/integer/server_key/crt/scalar_add_crt.rs index 26d724e089..7e11ad0791 100644 --- a/tfhe/src/integer/server_key/crt/scalar_add_crt.rs +++ b/tfhe/src/integer/server_key/crt/scalar_add_crt.rs @@ -67,7 +67,7 @@ impl ServerKey { /// let clear_1 = 14; /// let clear_2 = 14; /// // Encrypt two messages - /// let mut ctxt_1 = cks.encrypt(clear_1); + /// let ctxt_1 = cks.encrypt(clear_1); /// /// sks.is_crt_scalar_add_possible(&ctxt_1, clear_2).unwrap(); /// ``` @@ -107,7 +107,8 @@ impl ServerKey { /// // Encrypt two messages /// let mut ctxt_1 = cks.encrypt(clear_1); /// - /// sks.checked_crt_scalar_add_assign(&mut ctxt_1, clear_2); + /// sks.checked_crt_scalar_add_assign(&mut ctxt_1, clear_2) + /// .unwrap(); /// /// // Decrypt /// let res = cks.decrypt(&ctxt_1); diff --git a/tfhe/src/integer/server_key/crt/scalar_mul_crt.rs b/tfhe/src/integer/server_key/crt/scalar_mul_crt.rs index 281811fd30..d33a408176 100644 --- a/tfhe/src/integer/server_key/crt/scalar_mul_crt.rs +++ b/tfhe/src/integer/server_key/crt/scalar_mul_crt.rs @@ -70,7 +70,7 @@ impl ServerKey { /// let clear_1 = 14; /// let clear_2 = 2; /// // Encrypt two messages - /// let mut ctxt_1 = cks.encrypt(clear_1); + /// let ctxt_1 = cks.encrypt(clear_1); /// /// sks.is_crt_scalar_mul_possible(&ctxt_1, clear_2).unwrap(); /// ``` @@ -107,7 +107,8 @@ impl ServerKey { /// // Encrypt two messages /// let mut ctxt_1 = cks.encrypt(clear_1); /// - /// sks.checked_crt_scalar_mul_assign(&mut ctxt_1, clear_2); + /// sks.checked_crt_scalar_mul_assign(&mut ctxt_1, clear_2) + /// .unwrap(); /// /// // Decrypt /// let res = cks.decrypt(&ctxt_1); diff --git a/tfhe/src/integer/server_key/crt/scalar_sub_crt.rs b/tfhe/src/integer/server_key/crt/scalar_sub_crt.rs index 386c5e61a2..9af4016440 100644 --- a/tfhe/src/integer/server_key/crt/scalar_sub_crt.rs +++ b/tfhe/src/integer/server_key/crt/scalar_sub_crt.rs @@ -60,7 +60,7 @@ impl ServerKey { /// let clear_1 = 14; /// let clear_2 = 7; /// // Encrypt two messages - /// let mut ctxt_1 = cks.encrypt(clear_1); + /// let ctxt_1 = cks.encrypt(clear_1); /// /// sks.is_crt_scalar_sub_possible(&ctxt_1, clear_2).unwrap(); /// @@ -100,7 +100,7 @@ impl ServerKey { /// let clear_1 = 14; /// let clear_2 = 8; /// - /// let mut ctxt_1 = cks.encrypt(clear_1); + /// let ctxt_1 = cks.encrypt(clear_1); /// /// let ct_res = sks.checked_crt_scalar_sub(&ctxt_1, clear_2).unwrap(); /// diff --git a/tfhe/src/integer/server_key/crt/sub_crt.rs b/tfhe/src/integer/server_key/crt/sub_crt.rs index e764c6063d..0151fe51e7 100644 --- a/tfhe/src/integer/server_key/crt/sub_crt.rs +++ b/tfhe/src/integer/server_key/crt/sub_crt.rs @@ -22,8 +22,8 @@ impl ServerKey { /// let clear_1 = 14; /// let clear_2 = 5; /// // Encrypt two messages - /// let mut ctxt_1 = cks.encrypt(clear_1); - /// let mut ctxt_2 = cks.encrypt(clear_2); + /// let ctxt_1 = cks.encrypt(clear_1); + /// let ctxt_2 = cks.encrypt(clear_2); /// /// let ctxt = sks.unchecked_crt_sub(&ctxt_1, &ctxt_2); /// @@ -61,8 +61,8 @@ impl ServerKey { /// let clear_1 = 14; /// let clear_2 = 5; /// // Encrypt two messages - /// let mut ctxt_1 = cks.encrypt(clear_1); - /// let mut ctxt_2 = cks.encrypt(clear_2); + /// let ctxt_1 = cks.encrypt(clear_1); + /// let ctxt_2 = cks.encrypt(clear_2); /// /// let ctxt = sks.unchecked_crt_sub(&ctxt_1, &ctxt_2); /// diff --git a/tfhe/src/integer/server_key/crt_parallel/add_crt.rs b/tfhe/src/integer/server_key/crt_parallel/add_crt.rs index 6ea410a868..18122c55aa 100644 --- a/tfhe/src/integer/server_key/crt_parallel/add_crt.rs +++ b/tfhe/src/integer/server_key/crt_parallel/add_crt.rs @@ -66,7 +66,6 @@ impl ServerKey { /// ```rust /// use tfhe::integer::gen_keys_crt; /// use tfhe::shortint::parameters::PARAM_MESSAGE_3_CARRY_3_KS_PBS; - /// let size = 4; /// /// // Generate the client key and the server key: /// let basis = vec![2, 3, 5]; diff --git a/tfhe/src/integer/server_key/crt_parallel/mul_crt.rs b/tfhe/src/integer/server_key/crt_parallel/mul_crt.rs index 81d649a928..b25f0d22db 100644 --- a/tfhe/src/integer/server_key/crt_parallel/mul_crt.rs +++ b/tfhe/src/integer/server_key/crt_parallel/mul_crt.rs @@ -11,7 +11,6 @@ impl ServerKey { /// ```rust /// use tfhe::integer::gen_keys_crt; /// use tfhe::shortint::parameters::PARAM_MESSAGE_3_CARRY_3_KS_PBS; - /// let size = 3; /// /// // Generate the client key and the server key: /// let basis = vec![2, 3, 5]; diff --git a/tfhe/src/integer/server_key/crt_parallel/scalar_add_crt.rs b/tfhe/src/integer/server_key/crt_parallel/scalar_add_crt.rs index 1d91ed20c3..cd97304663 100644 --- a/tfhe/src/integer/server_key/crt_parallel/scalar_add_crt.rs +++ b/tfhe/src/integer/server_key/crt_parallel/scalar_add_crt.rs @@ -84,7 +84,8 @@ impl ServerKey { /// // Encrypt two messages /// let mut ctxt_1 = cks.encrypt(clear_1); /// - /// sks.checked_crt_scalar_add_assign_parallelized(&mut ctxt_1, clear_2); + /// sks.checked_crt_scalar_add_assign_parallelized(&mut ctxt_1, clear_2) + /// .unwrap(); /// /// // Decrypt /// let res = cks.decrypt(&ctxt_1); diff --git a/tfhe/src/integer/server_key/crt_parallel/scalar_mul_crt.rs b/tfhe/src/integer/server_key/crt_parallel/scalar_mul_crt.rs index e9c5dc83dd..c386fe60d6 100644 --- a/tfhe/src/integer/server_key/crt_parallel/scalar_mul_crt.rs +++ b/tfhe/src/integer/server_key/crt_parallel/scalar_mul_crt.rs @@ -87,7 +87,8 @@ impl ServerKey { /// // Encrypt two messages /// let mut ctxt_1 = cks.encrypt(clear_1); /// - /// sks.checked_crt_scalar_mul_assign_parallelized(&mut ctxt_1, clear_2); + /// sks.checked_crt_scalar_mul_assign_parallelized(&mut ctxt_1, clear_2) + /// .unwrap(); /// /// // Decrypt /// let res = cks.decrypt(&ctxt_1); diff --git a/tfhe/src/integer/server_key/crt_parallel/scalar_sub_crt.rs b/tfhe/src/integer/server_key/crt_parallel/scalar_sub_crt.rs index cf7f819624..daa195e7e6 100644 --- a/tfhe/src/integer/server_key/crt_parallel/scalar_sub_crt.rs +++ b/tfhe/src/integer/server_key/crt_parallel/scalar_sub_crt.rs @@ -76,7 +76,7 @@ impl ServerKey { /// let clear_1 = 14; /// let clear_2 = 8; /// - /// let mut ctxt_1 = cks.encrypt(clear_1); + /// let ctxt_1 = cks.encrypt(clear_1); /// /// let ct_res = sks /// .checked_crt_scalar_sub_parallelized(&ctxt_1, clear_2) diff --git a/tfhe/src/integer/server_key/crt_parallel/sub_crt.rs b/tfhe/src/integer/server_key/crt_parallel/sub_crt.rs index 98c3ca3204..6be177a2ea 100644 --- a/tfhe/src/integer/server_key/crt_parallel/sub_crt.rs +++ b/tfhe/src/integer/server_key/crt_parallel/sub_crt.rs @@ -21,8 +21,8 @@ impl ServerKey { /// let clear_1 = 14; /// let clear_2 = 5; /// // Encrypt two messages - /// let mut ctxt_1 = cks.encrypt(clear_1); - /// let mut ctxt_2 = cks.encrypt(clear_2); + /// let ctxt_1 = cks.encrypt(clear_1); + /// let ctxt_2 = cks.encrypt(clear_2); /// /// let ctxt = sks.unchecked_crt_sub_parallelized(&ctxt_1, &ctxt_2); /// @@ -60,8 +60,8 @@ impl ServerKey { /// let clear_1 = 14; /// let clear_2 = 5; /// // Encrypt two messages - /// let mut ctxt_1 = cks.encrypt(clear_1); - /// let mut ctxt_2 = cks.encrypt(clear_2); + /// let ctxt_1 = cks.encrypt(clear_1); + /// let ctxt_2 = cks.encrypt(clear_2); /// /// let ctxt = sks.unchecked_crt_sub_parallelized(&ctxt_1, &ctxt_2); /// diff --git a/tfhe/src/integer/server_key/mod.rs b/tfhe/src/integer/server_key/mod.rs index bfe5d8fdd4..cdc3fd4a36 100644 --- a/tfhe/src/integer/server_key/mod.rs +++ b/tfhe/src/integer/server_key/mod.rs @@ -138,8 +138,6 @@ impl ServerKey { /// use tfhe::shortint::parameters::PARAM_MESSAGE_2_CARRY_2_KS_PBS; /// use tfhe::shortint::ServerKey as ShortintServerKey; /// - /// let size = 4; - /// /// // Generate the client key: /// let cks = ClientKey::new(PARAM_MESSAGE_2_CARRY_2_KS_PBS); /// @@ -171,8 +169,6 @@ impl ServerKey { /// use tfhe::shortint::parameters::PARAM_MESSAGE_2_CARRY_2_KS_PBS; /// use tfhe::shortint::ServerKey as ShortintServerKey; /// - /// let size = 4; - /// /// // Generate the client key: /// let cks = ClientKey::new(PARAM_MESSAGE_2_CARRY_2_KS_PBS); /// diff --git a/tfhe/src/integer/server_key/radix/bitwise_op.rs b/tfhe/src/integer/server_key/radix/bitwise_op.rs index e8240dc035..19de61da52 100644 --- a/tfhe/src/integer/server_key/radix/bitwise_op.rs +++ b/tfhe/src/integer/server_key/radix/bitwise_op.rs @@ -618,7 +618,7 @@ impl ServerKey { /// /// let msg = 14u8; /// - /// let mut ct = cks.encrypt(msg); + /// let ct = cks.encrypt(msg); /// /// let ct_is_ge = sks.scalar_ge_parallelized(&ct, 10); /// let ct_is_le = sks.scalar_le_parallelized(&ct, 15); @@ -652,7 +652,7 @@ impl ServerKey { /// /// let msg = 14u8; /// - /// let mut ct = cks.encrypt(msg); + /// let ct = cks.encrypt(msg); /// /// let ct_is_ge = sks.scalar_ge_parallelized(&ct, 10); /// let ct_is_le = sks.scalar_le_parallelized(&ct, 15); @@ -686,7 +686,7 @@ impl ServerKey { /// /// let msg = 14u8; /// - /// let mut ct = cks.encrypt(msg); + /// let ct = cks.encrypt(msg); /// /// let ct_is_ge = sks.scalar_ge_parallelized(&ct, 10); /// let ct_is_le = sks.scalar_le_parallelized(&ct, 15); diff --git a/tfhe/src/integer/server_key/radix/mod.rs b/tfhe/src/integer/server_key/radix/mod.rs index 8f2ec5f38b..bdccf52d12 100644 --- a/tfhe/src/integer/server_key/radix/mod.rs +++ b/tfhe/src/integer/server_key/radix/mod.rs @@ -716,7 +716,7 @@ impl ServerKey { /// # Example /// ///```rust - /// use tfhe::integer::{gen_keys_radix, IntegerCiphertext}; + /// use tfhe::integer::gen_keys_radix; /// use tfhe::shortint::parameters::PARAM_MESSAGE_2_CARRY_2_KS_PBS; /// /// let num_blocks = 4; @@ -726,8 +726,8 @@ impl ServerKey { /// /// let msg = 10; /// - /// let mut ct1 = cks.encrypt(msg); - /// let mut ct2 = cks.encrypt(msg); + /// let ct1 = cks.encrypt(msg); + /// let ct2 = cks.encrypt(msg); /// /// // Compute homomorphically an addition: /// let mut ct_res = sks.unchecked_add(&ct1, &ct2); diff --git a/tfhe/src/integer/server_key/radix/mul.rs b/tfhe/src/integer/server_key/radix/mul.rs index f5b755a9e5..f120b044ca 100644 --- a/tfhe/src/integer/server_key/radix/mul.rs +++ b/tfhe/src/integer/server_key/radix/mul.rs @@ -198,7 +198,7 @@ impl ServerKey { /// let clear_2 = 143; /// /// // Encrypt two messages - /// let mut ctxt_1 = cks.encrypt(clear_1); + /// let ctxt_1 = cks.encrypt(clear_1); /// let ctxt_2 = cks.encrypt(clear_2); /// /// // Compute homomorphically a multiplication diff --git a/tfhe/src/integer/server_key/radix/neg.rs b/tfhe/src/integer/server_key/radix/neg.rs index 1cdd0f3702..7c8acde504 100644 --- a/tfhe/src/integer/server_key/radix/neg.rs +++ b/tfhe/src/integer/server_key/radix/neg.rs @@ -235,7 +235,7 @@ impl ServerKey { /// let mut ct = cks.encrypt(msg); /// /// // Compute homomorphically a negation: - /// sks.checked_neg_assign(&mut ct); + /// sks.checked_neg_assign(&mut ct).unwrap(); /// /// let clear_res: u64 = cks.decrypt(&ct); /// assert_eq!(clear_res, (modulus - msg)); diff --git a/tfhe/src/integer/server_key/radix/scalar_add.rs b/tfhe/src/integer/server_key/radix/scalar_add.rs index a7bdc56192..1fce939c10 100644 --- a/tfhe/src/integer/server_key/radix/scalar_add.rs +++ b/tfhe/src/integer/server_key/radix/scalar_add.rs @@ -81,7 +81,6 @@ impl ServerKey { /// /// // Encrypt two messages: /// let ct1 = cks.encrypt(msg); - /// let ct2 = cks.encrypt(msg); /// /// // Check if we can perform an addition /// sks.is_scalar_add_possible(&ct1, scalar).unwrap(); @@ -132,7 +131,7 @@ impl ServerKey { /// let msg = 4; /// let scalar = 40; /// - /// let mut ct = cks.encrypt(msg); + /// let ct = cks.encrypt(msg); /// /// // Compute homomorphically an addition: /// let ct_res = sks.checked_scalar_add(&ct, scalar).unwrap(); diff --git a/tfhe/src/integer/server_key/radix/scalar_mul.rs b/tfhe/src/integer/server_key/radix/scalar_mul.rs index ee4e4b7a87..9459a524bc 100644 --- a/tfhe/src/integer/server_key/radix/scalar_mul.rs +++ b/tfhe/src/integer/server_key/radix/scalar_mul.rs @@ -221,7 +221,8 @@ impl ServerKey { /// let mut ct = cks.encrypt(msg); /// /// // Compute homomorphically a scalar multiplication: - /// sks.checked_small_scalar_mul_assign(&mut ct, scalar); + /// sks.checked_small_scalar_mul_assign(&mut ct, scalar) + /// .unwrap(); /// /// let clear_res: u64 = cks.decrypt(&ct); /// assert_eq!(clear_res, msg * scalar); diff --git a/tfhe/src/integer/server_key/radix/shift.rs b/tfhe/src/integer/server_key/radix/shift.rs index 43073a12a8..319246bb83 100644 --- a/tfhe/src/integer/server_key/radix/shift.rs +++ b/tfhe/src/integer/server_key/radix/shift.rs @@ -23,7 +23,7 @@ impl ServerKey { /// let shift = 2; /// /// // Encrypt two messages: - /// let mut ct = cks.encrypt(msg); + /// let ct = cks.encrypt(msg); /// /// let ct_res = sks.blockshift_right(&ct, shift); /// diff --git a/tfhe/src/integer/server_key/radix_parallel/mod.rs b/tfhe/src/integer/server_key/radix_parallel/mod.rs index 4739c9e88f..a5eb777013 100644 --- a/tfhe/src/integer/server_key/radix_parallel/mod.rs +++ b/tfhe/src/integer/server_key/radix_parallel/mod.rs @@ -61,7 +61,7 @@ impl ServerKey { /// /// // Compute homomorphically an addition: /// let mut ct_res = sks.unchecked_add(&ct1, &ct2); - /// sks.propagate_parallelized(&mut ct_res, 0); + /// let carry = sks.propagate_parallelized(&mut ct_res, 0); /// /// // Decrypt one block: /// let res: u64 = cks.decrypt_one_block(&ct_res.blocks()[1]); @@ -193,8 +193,8 @@ impl ServerKey { /// /// let msg = 10u64; /// - /// let mut ct1 = cks.encrypt(msg); - /// let mut ct2 = cks.encrypt(msg); + /// let ct1 = cks.encrypt(msg); + /// let ct2 = cks.encrypt(msg); /// /// // Compute homomorphically an addition: /// let mut ct_res = sks.unchecked_add(&ct1, &ct2); diff --git a/tfhe/src/integer/server_key/radix_parallel/mul.rs b/tfhe/src/integer/server_key/radix_parallel/mul.rs index be58734743..e37ff165c1 100644 --- a/tfhe/src/integer/server_key/radix_parallel/mul.rs +++ b/tfhe/src/integer/server_key/radix_parallel/mul.rs @@ -389,7 +389,7 @@ impl ServerKey { /// let clear_2 = 143; /// /// // Encrypt two messages - /// let mut ctxt_1 = cks.encrypt(clear_1); + /// let ctxt_1 = cks.encrypt(clear_1); /// let ctxt_2 = cks.encrypt(clear_2); /// /// // Compute homomorphically a multiplication diff --git a/tfhe/src/integer/server_key/radix_parallel/neg.rs b/tfhe/src/integer/server_key/radix_parallel/neg.rs index c9dea00261..4a03e9595c 100644 --- a/tfhe/src/integer/server_key/radix_parallel/neg.rs +++ b/tfhe/src/integer/server_key/radix_parallel/neg.rs @@ -65,7 +65,7 @@ impl ServerKey { /// let msg = 1u64; /// /// // Encrypt two messages: - /// let mut ctxt = cks.encrypt(msg); + /// let ctxt = cks.encrypt(msg); /// /// // Compute homomorphically a negation /// let ct_res = sks.neg_parallelized(&ctxt); diff --git a/tfhe/src/integer/server_key/radix_parallel/reverse_bits.rs b/tfhe/src/integer/server_key/radix_parallel/reverse_bits.rs index fdc541ceca..5f45390be4 100644 --- a/tfhe/src/integer/server_key/radix_parallel/reverse_bits.rs +++ b/tfhe/src/integer/server_key/radix_parallel/reverse_bits.rs @@ -8,7 +8,7 @@ impl ServerKey { /// # Example /// ///```rust - /// use tfhe::integer::{gen_keys_radix, IntegerCiphertext}; + /// use tfhe::integer::gen_keys_radix; /// use tfhe::shortint::parameters::PARAM_MESSAGE_2_CARRY_2_KS_PBS; /// /// let num_blocks = 4; @@ -21,7 +21,7 @@ impl ServerKey { /// let ct = cks.encrypt(msg); /// /// // Compute homomorphically an addition: - /// let mut ct_res = sks.reverse_bits_parallelized(&ct); + /// let ct_res = sks.reverse_bits_parallelized(&ct); /// /// // Decrypt: /// let res: u8 = cks.decrypt(&ct_res); diff --git a/tfhe/src/integer/server_key/radix_parallel/scalar_mul.rs b/tfhe/src/integer/server_key/radix_parallel/scalar_mul.rs index 1a2ab323cb..37e268d063 100644 --- a/tfhe/src/integer/server_key/radix_parallel/scalar_mul.rs +++ b/tfhe/src/integer/server_key/radix_parallel/scalar_mul.rs @@ -159,7 +159,7 @@ impl ServerKey { /// let msg = 230; /// let scalar = 376; /// - /// let mut ct = cks.encrypt(msg); + /// let ct = cks.encrypt(msg); /// /// // Compute homomorphically a scalar multiplication: /// let ct_res = sks.scalar_mul_parallelized(&ct, scalar); diff --git a/tfhe/src/integer/wopbs/mod.rs b/tfhe/src/integer/wopbs/mod.rs index 61d806e337..2908bbf151 100644 --- a/tfhe/src/integer/wopbs/mod.rs +++ b/tfhe/src/integer/wopbs/mod.rs @@ -451,7 +451,7 @@ impl WopbsKey { /// let wopbs_key = WopbsKey::new_wopbs_key_only_for_wopbs(&cks, &sks); /// /// let clear = 42 % msg_space; // Encrypt the integers - /// let mut ct = cks.encrypt_native_crt(clear); + /// let ct = cks.encrypt_native_crt(clear); /// let lut = wopbs_key.generate_lut_native_crt(&ct, |x| x); /// let ct_res = wopbs_key.wopbs_native_crt(&ct, &lut); /// let res = cks.decrypt_native_crt(&ct_res); @@ -653,7 +653,7 @@ impl WopbsKey { /// let wopbs_key = WopbsKey::new_wopbs_key_only_for_wopbs(&cks, &sks); /// /// let clear = 42 % msg_space; // Encrypt the integers - /// let mut ct = cks.encrypt_native_crt(clear); + /// let ct = cks.encrypt_native_crt(clear); /// let lut = wopbs_key.generate_lut_native_crt(&ct, |x| x); /// let ct_res = wopbs_key.wopbs_native_crt(&ct, &lut); /// let res = cks.decrypt_native_crt(&ct_res); @@ -706,7 +706,6 @@ impl WopbsKey { /// /// let basis: Vec = vec![5, 7]; /// let msg_space: u64 = basis.iter().copied().product(); - /// let nb_block = basis.len(); /// /// //Generate the client key and the server key: /// let (cks, sks) = gen_keys_crt(PARAM_MESSAGE_3_CARRY_3_KS_PBS, basis); @@ -964,8 +963,8 @@ impl WopbsKey { /// /// let clear1 = 42 % msg_space; /// let clear2 = 24 % msg_space; - /// let mut ct1 = cks.encrypt_native_crt(clear1); - /// let mut ct2 = cks.encrypt_native_crt(clear2); + /// let ct1 = cks.encrypt_native_crt(clear1); + /// let ct2 = cks.encrypt_native_crt(clear2); /// let lut = wopbs_key.generate_lut_bivariate_native_crt(&ct1, |x, y| x * y * 2); /// let ct_res = wopbs_key.bivariate_wopbs_native_crt(&ct1, &ct2, &lut); /// let res = cks.decrypt_native_crt(&ct_res); @@ -1034,8 +1033,8 @@ impl WopbsKey { /// /// let clear1 = 42 % msg_space; /// let clear2 = 24 % msg_space; - /// let mut ct1 = cks.encrypt_native_crt(clear1); - /// let mut ct2 = cks.encrypt_native_crt(clear2); + /// let ct1 = cks.encrypt_native_crt(clear1); + /// let ct2 = cks.encrypt_native_crt(clear2); /// let lut = wopbs_key.generate_lut_bivariate_native_crt(&ct1, |x, y| x * y * 2); /// let ct_res = wopbs_key.bivariate_wopbs_native_crt(&ct1, &ct2, &lut); /// let res = cks.decrypt_native_crt(&ct_res); diff --git a/tfhe/src/shortint/ciphertext/standard.rs b/tfhe/src/shortint/ciphertext/standard.rs index c93d7a78c7..1ad53828a7 100644 --- a/tfhe/src/shortint/ciphertext/standard.rs +++ b/tfhe/src/shortint/ciphertext/standard.rs @@ -155,8 +155,8 @@ impl Ciphertext { /// # Example /// /// ```rust + /// use tfhe::shortint::gen_keys; /// use tfhe::shortint::parameters::PARAM_MESSAGE_2_CARRY_2_KS_PBS; - /// use tfhe::shortint::{gen_keys, Ciphertext}; /// /// // Generate the client key and the server key: /// let (cks, sks) = gen_keys(PARAM_MESSAGE_2_CARRY_2_KS_PBS); @@ -195,8 +195,8 @@ impl Ciphertext { /// # Example /// /// ```rust + /// use tfhe::shortint::gen_keys; /// use tfhe::shortint::parameters::PARAM_MESSAGE_2_CARRY_2_KS_PBS; - /// use tfhe::shortint::{gen_keys, Ciphertext}; /// /// // Generate the client key and the server key: /// let (cks, sks) = gen_keys(PARAM_MESSAGE_2_CARRY_2_KS_PBS); diff --git a/tfhe/src/shortint/mod.rs b/tfhe/src/shortint/mod.rs index 8ac8e5c634..9713a5d9ae 100755 --- a/tfhe/src/shortint/mod.rs +++ b/tfhe/src/shortint/mod.rs @@ -31,7 +31,7 @@ //! use tfhe::shortint::parameters::PARAM_MESSAGE_2_CARRY_2_KS_PBS; //! //! // We generate a set of client/server keys, using the default parameters: -//! let (mut client_key, mut server_key) = gen_keys(PARAM_MESSAGE_2_CARRY_2_KS_PBS); +//! let (client_key, server_key) = gen_keys(PARAM_MESSAGE_2_CARRY_2_KS_PBS); //! //! let msg1 = 1; //! let msg2 = 0; diff --git a/tfhe/src/shortint/public_key/standard.rs b/tfhe/src/shortint/public_key/standard.rs index 7ca75e99a3..fe6e999b15 100644 --- a/tfhe/src/shortint/public_key/standard.rs +++ b/tfhe/src/shortint/public_key/standard.rs @@ -101,7 +101,7 @@ impl PublicKey { /// /// ```rust /// use tfhe::shortint::parameters::PARAM_MESSAGE_2_CARRY_2_KS_PBS; - /// use tfhe::shortint::{ClientKey, PublicKey, ServerKey}; + /// use tfhe::shortint::{ClientKey, PublicKey}; /// /// // Generate the client key: /// let cks = ClientKey::new(PARAM_MESSAGE_2_CARRY_2_KS_PBS); diff --git a/tfhe/src/shortint/server_key/div_mod.rs b/tfhe/src/shortint/server_key/div_mod.rs index f1a3500ac9..d88ef418e7 100644 --- a/tfhe/src/shortint/server_key/div_mod.rs +++ b/tfhe/src/shortint/server_key/div_mod.rs @@ -320,7 +320,7 @@ impl ServerKey { /// /// // Encrypt two messages /// let mut ct_1 = cks.encrypt(clear_1); - /// let mut ct_2 = cks.encrypt(clear_2); + /// let ct_2 = cks.encrypt(clear_2); /// /// // Compute homomorphically a multiplication /// sks.unchecked_div_assign(&mut ct_1, &ct_2); @@ -333,7 +333,7 @@ impl ServerKey { /// /// // Encrypt two messages /// let mut ct_1 = cks.encrypt(clear_1); - /// let mut ct_2 = cks.encrypt(clear_2); + /// let ct_2 = cks.encrypt(clear_2); /// /// // Compute homomorphically a multiplication /// sks.unchecked_div_assign(&mut ct_1, &ct_2); diff --git a/tfhe/src/shortint/server_key/mul.rs b/tfhe/src/shortint/server_key/mul.rs index 3cae0e581d..3193012522 100644 --- a/tfhe/src/shortint/server_key/mul.rs +++ b/tfhe/src/shortint/server_key/mul.rs @@ -153,8 +153,8 @@ impl ServerKey { /// let clear_2 = 2; /// /// // Encrypt two messages - /// let mut ct_1 = cks.encrypt(clear_1); - /// let mut ct_2 = cks.encrypt(clear_2); + /// let ct_1 = cks.encrypt(clear_1); + /// let ct_2 = cks.encrypt(clear_2); /// /// // Compute homomorphically a multiplication /// let ct_res = sks.unchecked_mul_msb(&ct_1, &ct_2); @@ -174,8 +174,8 @@ impl ServerKey { /// let (cks, sks) = gen_keys(PARAM_MESSAGE_2_CARRY_2_PBS_KS); /// /// // Encrypt two messages - /// let mut ct_1 = cks.encrypt(clear_1); - /// let mut ct_2 = cks.encrypt(clear_2); + /// let ct_1 = cks.encrypt(clear_1); + /// let ct_2 = cks.encrypt(clear_2); /// /// // Compute homomorphically a multiplication /// let ct_res = sks.unchecked_mul_msb(&ct_1, &ct_2); @@ -497,8 +497,8 @@ impl ServerKey { /// let clear_2 = 1; /// /// // Encrypt two messages - /// let mut ct_1 = cks.encrypt(clear_1); - /// let mut ct_2 = cks.encrypt(clear_2); + /// let ct_1 = cks.encrypt(clear_1); + /// let ct_2 = cks.encrypt(clear_2); /// /// // Compute homomorphically a multiplication /// let ct_res = sks.unchecked_mul_lsb_small_carry(&ct_1, &ct_2); @@ -510,8 +510,8 @@ impl ServerKey { /// let (cks, sks) = gen_keys(PARAM_MESSAGE_2_CARRY_2_PBS_KS); /// /// // Encrypt two messages - /// let mut ct_1 = cks.encrypt(clear_1); - /// let mut ct_2 = cks.encrypt(clear_2); + /// let ct_1 = cks.encrypt(clear_1); + /// let ct_2 = cks.encrypt(clear_2); /// /// // Compute homomorphically a multiplication /// let ct_res = sks.unchecked_mul_lsb_small_carry(&ct_1, &ct_2); @@ -617,8 +617,8 @@ impl ServerKey { /// let msg_2 = 3; /// /// // Encrypt two messages: - /// let mut ct_1 = cks.encrypt(msg_1); - /// let mut ct_2 = cks.encrypt(msg_2); + /// let ct_1 = cks.encrypt(msg_1); + /// let ct_2 = cks.encrypt(msg_2); /// /// // Compute homomorphically a multiplication /// let ct_res = sks.checked_mul_lsb_with_small_carry(&ct_1, &ct_2).unwrap(); @@ -630,8 +630,8 @@ impl ServerKey { /// let (cks, sks) = gen_keys(PARAM_MESSAGE_2_CARRY_2_PBS_KS); /// /// // Encrypt two messages: - /// let mut ct_1 = cks.encrypt(msg_1); - /// let mut ct_2 = cks.encrypt(msg_2); + /// let ct_1 = cks.encrypt(msg_1); + /// let ct_2 = cks.encrypt(msg_2); /// /// // Compute homomorphically a multiplication /// let ct_res = sks.checked_mul_lsb_with_small_carry(&ct_1, &ct_2).unwrap(); @@ -986,7 +986,7 @@ impl ServerKey { /// let modulus = sks.message_modulus.0 as u64; /// assert_eq!(res, ((msg1 * msg2) / modulus) % modulus); /// - /// let (mut cks, mut sks) = gen_keys(PARAM_MESSAGE_2_CARRY_2_PBS_KS); + /// let (cks, sks) = gen_keys(PARAM_MESSAGE_2_CARRY_2_PBS_KS); /// /// // Encrypt two messages: /// let mut ct_1 = cks.unchecked_encrypt(msg1); @@ -1175,7 +1175,7 @@ impl ServerKey { /// let modulus = sks.message_modulus.0 as u64; /// assert_eq!(res, ((msg1 * msg2) / modulus) % modulus); /// - /// let (mut cks, mut sks) = gen_keys(PARAM_MESSAGE_2_CARRY_2_PBS_KS); + /// let (cks, sks) = gen_keys(PARAM_MESSAGE_2_CARRY_2_PBS_KS); /// /// // Encrypt two messages: /// let mut ct_1 = cks.unchecked_encrypt(msg1); diff --git a/tfhe/src/shortint/server_key/neg.rs b/tfhe/src/shortint/server_key/neg.rs index 96f002ce40..af7570af2e 100644 --- a/tfhe/src/shortint/server_key/neg.rs +++ b/tfhe/src/shortint/server_key/neg.rs @@ -33,7 +33,7 @@ impl ServerKey { /// let msg = 3; /// /// // Encrypt a message - /// let mut ct = cks.encrypt(msg); + /// let ct = cks.encrypt(msg); /// /// // Compute homomorphically a negation /// let ct_res = sks.neg(&ct); @@ -46,7 +46,7 @@ impl ServerKey { /// let (cks, sks) = gen_keys(PARAM_MESSAGE_2_CARRY_2_PBS_KS); /// /// // Encrypt a message - /// let mut ct = cks.encrypt(msg); + /// let ct = cks.encrypt(msg); /// /// // Compute homomorphically a negation /// let ct_res = sks.neg(&ct); @@ -144,7 +144,7 @@ impl ServerKey { /// let ct = cks.encrypt(msg); /// /// // Compute homomorphically a negation - /// let mut ct_res = sks.unchecked_neg(&ct); + /// let ct_res = sks.unchecked_neg(&ct); /// /// // Decrypt /// let three = cks.decrypt(&ct_res); @@ -157,7 +157,7 @@ impl ServerKey { /// let ct = cks.encrypt(msg); /// /// // Compute homomorphically a negation - /// let mut ct_res = sks.unchecked_neg(&ct); + /// let ct_res = sks.unchecked_neg(&ct); /// /// // Decrypt /// let three = cks.decrypt(&ct_res); diff --git a/tfhe/src/shortint/server_key/scalar_div_mod.rs b/tfhe/src/shortint/server_key/scalar_div_mod.rs index f6ed5f28d7..82e7f475ad 100644 --- a/tfhe/src/shortint/server_key/scalar_div_mod.rs +++ b/tfhe/src/shortint/server_key/scalar_div_mod.rs @@ -58,7 +58,7 @@ impl ServerKey { /// let clear_2 = 2; /// /// // Encrypt one message - /// let mut ct_1 = cks.encrypt(clear_1); + /// let ct_1 = cks.encrypt(clear_1); /// /// // Compute homomorphically a multiplication /// let ct_res = sks.unchecked_scalar_div(&ct_1, clear_2); @@ -70,7 +70,7 @@ impl ServerKey { /// let (cks, sks) = gen_keys(PARAM_MESSAGE_2_CARRY_2_PBS_KS); /// /// // Encrypt one message - /// let mut ct_1 = cks.encrypt(clear_1); + /// let ct_1 = cks.encrypt(clear_1); /// /// // Compute homomorphically a multiplication /// let ct_res = sks.unchecked_scalar_div(&ct_1, clear_2); @@ -148,7 +148,7 @@ impl ServerKey { /// /// let msg = 3; /// - /// let mut ct = cks.encrypt(msg); + /// let ct = cks.encrypt(msg); /// /// let modulus: u8 = 2; /// // Compute homomorphically an addition: @@ -160,7 +160,7 @@ impl ServerKey { /// /// let (cks, sks) = gen_keys(PARAM_MESSAGE_2_CARRY_2_PBS_KS); /// - /// let mut ct = cks.encrypt(msg); + /// let ct = cks.encrypt(msg); /// /// let modulus: u8 = 2; /// // Compute homomorphically an addition: diff --git a/tfhe/src/shortint/server_key/scalar_mul.rs b/tfhe/src/shortint/server_key/scalar_mul.rs index 552b6f7120..afd8a82692 100644 --- a/tfhe/src/shortint/server_key/scalar_mul.rs +++ b/tfhe/src/shortint/server_key/scalar_mul.rs @@ -31,7 +31,7 @@ impl ServerKey { /// let scalar = 3_u8; /// /// // Encrypt a message - /// let mut ct = cks.encrypt(msg); + /// let ct = cks.encrypt(msg); /// /// // Compute homomorphically a scalar multiplication: /// let ct_res = sks.scalar_mul(&ct, scalar); @@ -44,7 +44,7 @@ impl ServerKey { /// let (cks, sks) = gen_keys(PARAM_MESSAGE_2_CARRY_2_PBS_KS); /// /// // Encrypt a message - /// let mut ct = cks.encrypt(msg); + /// let ct = cks.encrypt(msg); /// /// // Compute homomorphically a scalar multiplication: /// let ct_res = sks.scalar_mul(&ct, scalar); diff --git a/tfhe/src/shortint/server_key/scalar_sub.rs b/tfhe/src/shortint/server_key/scalar_sub.rs index bbea29d824..4add02aecf 100644 --- a/tfhe/src/shortint/server_key/scalar_sub.rs +++ b/tfhe/src/shortint/server_key/scalar_sub.rs @@ -33,7 +33,7 @@ impl ServerKey { /// let scalar = 3; /// /// // Encrypt a message - /// let mut ct = cks.encrypt(msg); + /// let ct = cks.encrypt(msg); /// /// // Compute homomorphically a scalar multiplication: /// let ct_res = sks.scalar_sub(&ct, scalar); @@ -49,7 +49,7 @@ impl ServerKey { /// let (cks, sks) = gen_keys(PARAM_MESSAGE_2_CARRY_2_PBS_KS); /// /// // Encrypt a message - /// let mut ct = cks.encrypt(msg); + /// let ct = cks.encrypt(msg); /// /// // Compute homomorphically a scalar multiplication: /// let ct_res = sks.scalar_sub(&ct, scalar); diff --git a/tfhe/src/shortint/server_key/shift.rs b/tfhe/src/shortint/server_key/shift.rs index 6a542daed3..1c4b956552 100644 --- a/tfhe/src/shortint/server_key/shift.rs +++ b/tfhe/src/shortint/server_key/shift.rs @@ -47,7 +47,6 @@ impl ServerKey { /// /// // Decrypt: /// let dec = cks.decrypt(&ct_res); - /// let modulus = cks.parameters.message_modulus().0 as u64; /// assert_eq!(msg >> shift, dec); /// /// let (cks, sks) = gen_keys(PARAM_MESSAGE_2_CARRY_2_PBS_KS); @@ -69,7 +68,6 @@ impl ServerKey { /// /// // Decrypt: /// let dec = cks.decrypt(&ct_res); - /// let modulus = cks.parameters.message_modulus().0 as u64; /// assert_eq!(msg >> shift, dec); /// ``` pub fn scalar_right_shift(&self, ct: &Ciphertext, shift: u8) -> Ciphertext { @@ -117,7 +115,6 @@ impl ServerKey { /// /// // Decrypt: /// let dec = cks.decrypt(&ct); - /// let modulus = cks.parameters.message_modulus().0 as u64; /// assert_eq!(msg >> shift, dec); /// /// let (cks, sks) = gen_keys(PARAM_MESSAGE_2_CARRY_2_PBS_KS); @@ -139,7 +136,6 @@ impl ServerKey { /// /// // Decrypt: /// let dec = cks.decrypt(&ct); - /// let modulus = cks.parameters.message_modulus().0 as u64; /// assert_eq!(msg >> shift, dec); /// ``` pub fn scalar_right_shift_assign(&self, ct: &mut Ciphertext, shift: u8) { @@ -179,7 +175,6 @@ impl ServerKey { /// /// // Decrypt: /// let dec = cks.decrypt(&ct_res); - /// let modulus = cks.parameters.message_modulus().0 as u64; /// assert_eq!(msg >> shift, dec); /// /// let (cks, sks) = gen_keys(PARAM_MESSAGE_2_CARRY_2_PBS_KS); @@ -201,7 +196,6 @@ impl ServerKey { /// /// // Decrypt: /// let dec = cks.decrypt(&ct_res); - /// let modulus = cks.parameters.message_modulus().0 as u64; /// assert_eq!(msg >> shift, dec); /// ``` pub fn unchecked_scalar_right_shift(&self, ct: &Ciphertext, shift: u8) -> Ciphertext { @@ -240,7 +234,6 @@ impl ServerKey { /// /// // Decrypt: /// let dec = cks.decrypt(&ct); - /// let modulus = cks.parameters.message_modulus().0 as u64; /// assert_eq!(msg >> shift, dec); /// /// let (cks, sks) = gen_keys(PARAM_MESSAGE_2_CARRY_2_PBS_KS); @@ -262,7 +255,6 @@ impl ServerKey { /// /// // Decrypt: /// let dec = cks.decrypt(&ct); - /// let modulus = cks.parameters.message_modulus().0 as u64; /// assert_eq!(msg >> shift, dec); /// ``` pub fn unchecked_scalar_right_shift_assign(&self, ct: &mut Ciphertext, shift: u8) { @@ -296,7 +288,7 @@ impl ServerKey { /// let msg = 1; /// /// // Encrypt a message - /// let mut ct = cks.encrypt(msg); + /// let ct = cks.encrypt(msg); /// // | ct | /// // | carry | message | /// // |-------|---------| @@ -318,7 +310,7 @@ impl ServerKey { /// let (cks, sks) = gen_keys(PARAM_MESSAGE_2_CARRY_2_PBS_KS); /// /// // Encrypt a message - /// let mut ct = cks.encrypt(msg); + /// let ct = cks.encrypt(msg); /// // | ct | /// // | carry | message | /// // |-------|---------| diff --git a/tfhe/src/shortint/server_key/sub.rs b/tfhe/src/shortint/server_key/sub.rs index 699c53504a..1d565cf7c4 100644 --- a/tfhe/src/shortint/server_key/sub.rs +++ b/tfhe/src/shortint/server_key/sub.rs @@ -27,7 +27,7 @@ impl ServerKey { /// let (cks, sks) = gen_keys(PARAM_MESSAGE_2_CARRY_2_KS_PBS); /// /// // Encrypt two messages: - /// let mut ct_1 = cks.encrypt(3); + /// let ct_1 = cks.encrypt(3); /// let ct_2 = cks.encrypt(1); /// /// // Compute homomorphically a subtraction: @@ -115,7 +115,6 @@ impl ServerKey { /// let ct_res = sks.unchecked_sub(&ct_1, &ct_2); /// /// // Decrypt: - /// let modulus = cks.parameters.message_modulus().0 as u64; /// assert_eq!(cks.decrypt(&ct_res), 2 - 1); /// ``` pub fn unchecked_sub(&self, ct_left: &Ciphertext, ct_right: &Ciphertext) -> Ciphertext { diff --git a/tfhe/src/shortint/wopbs/mod.rs b/tfhe/src/shortint/wopbs/mod.rs index a976d165ad..2c7f8bb3bd 100644 --- a/tfhe/src/shortint/wopbs/mod.rs +++ b/tfhe/src/shortint/wopbs/mod.rs @@ -233,7 +233,7 @@ impl WopbsKey { /// /// // Generate the client key and the server key: /// let (cks, sks) = gen_keys(WOPBS_ONLY_8_BLOCKS_PARAM_MESSAGE_1_CARRY_1_KS_PBS); - /// let mut wopbs_key = WopbsKey::new_wopbs_key_only_for_wopbs(&cks, &sks); + /// let wopbs_key = WopbsKey::new_wopbs_key_only_for_wopbs(&cks, &sks); /// ``` pub fn new_wopbs_key_only_for_wopbs(cks: &ClientKey, sks: &ServerKey) -> Self { ShortintEngine::with_thread_local_mut(|engine| { @@ -252,7 +252,7 @@ impl WopbsKey { /// /// // Generate the client key and the server key: /// let (cks, sks) = gen_keys(PARAM_MESSAGE_1_CARRY_1_KS_PBS); - /// let mut wopbs_key = WopbsKey::new_wopbs_key(&cks, &sks, &WOPBS_PARAM_MESSAGE_1_CARRY_1_KS_PBS); + /// let wopbs_key = WopbsKey::new_wopbs_key(&cks, &sks, &WOPBS_PARAM_MESSAGE_1_CARRY_1_KS_PBS); /// ``` pub fn new_wopbs_key(cks: &ClientKey, sks: &ServerKey, parameters: &WopbsParameters) -> Self { ShortintEngine::with_thread_local_mut(|engine| engine.new_wopbs_key(cks, sks, parameters)) @@ -325,7 +325,6 @@ impl WopbsKey { /// # Example /// /// ```rust - /// use rand::Rng; /// use tfhe::shortint::gen_keys; /// use tfhe::shortint::parameters::parameters_wopbs_message_carry::WOPBS_PARAM_MESSAGE_2_CARRY_2_KS_PBS; /// use tfhe::shortint::parameters::PARAM_MESSAGE_2_CARRY_2_KS_PBS; @@ -333,10 +332,10 @@ impl WopbsKey { /// /// // Generate the client key and the server key: /// let (cks, sks) = gen_keys(PARAM_MESSAGE_2_CARRY_2_KS_PBS); - /// let mut wopbs_key = WopbsKey::new_wopbs_key(&cks, &sks, &WOPBS_PARAM_MESSAGE_2_CARRY_2_KS_PBS); + /// let wopbs_key = WopbsKey::new_wopbs_key(&cks, &sks, &WOPBS_PARAM_MESSAGE_2_CARRY_2_KS_PBS); /// let message_modulus = WOPBS_PARAM_MESSAGE_2_CARRY_2_KS_PBS.message_modulus.0 as u64; /// let m = 2; - /// let mut ct = cks.encrypt(m); + /// let ct = cks.encrypt(m); /// let lut = wopbs_key.generate_lut(&ct, |x| x * x % message_modulus); /// let ct_res = wopbs_key.programmable_bootstrapping(&sks, &ct, &lut); /// let res = cks.decrypt(&ct_res); @@ -364,14 +363,13 @@ impl WopbsKey { /// # Example /// /// ```rust - /// use rand::Rng; /// use tfhe::shortint::gen_keys; /// use tfhe::shortint::parameters::parameters_wopbs_only::WOPBS_ONLY_4_BLOCKS_PARAM_MESSAGE_2_CARRY_2_KS_PBS; /// use tfhe::shortint::wopbs::WopbsKey; /// /// // Generate the client key and the server key: /// let (cks, sks) = gen_keys(WOPBS_ONLY_4_BLOCKS_PARAM_MESSAGE_2_CARRY_2_KS_PBS); - /// let mut wopbs_key = WopbsKey::new_wopbs_key_only_for_wopbs(&cks, &sks); + /// let wopbs_key = WopbsKey::new_wopbs_key_only_for_wopbs(&cks, &sks); /// let message_modulus = WOPBS_ONLY_4_BLOCKS_PARAM_MESSAGE_2_CARRY_2_KS_PBS.message_modulus.0 as u64; /// let m = 2; /// let ct = cks.encrypt_without_padding(m); @@ -401,7 +399,6 @@ impl WopbsKey { /// # Example /// /// ```rust - /// use rand::Rng; /// use tfhe::shortint::gen_keys; /// use tfhe::shortint::parameters::parameters_wopbs_message_carry::WOPBS_PARAM_MESSAGE_3_CARRY_3_KS_PBS; /// use tfhe::shortint::wopbs::WopbsKey; @@ -454,7 +451,7 @@ impl WopbsKey { /// let mut rng = rand::thread_rng(); /// let message_modulus = WOPBS_PARAM_MESSAGE_2_CARRY_2_KS_PBS.message_modulus.0; /// let ct = cks.encrypt(rng.gen::() % message_modulus as u64); - /// let lut = vec![(1_u64 << 59); wopbs_key.param.polynomial_size.0].into(); + /// let lut = vec![1_u64 << 59; wopbs_key.param.polynomial_size.0].into(); /// let ct_res = wopbs_key.programmable_bootstrapping(&sks, &ct, &lut); /// let res = cks.decrypt_message_and_carry(&ct_res); /// assert_eq!(res, 1); @@ -490,7 +487,7 @@ impl WopbsKey { /// let mut rng = rand::thread_rng(); /// let message_modulus = WOPBS_ONLY_4_BLOCKS_PARAM_MESSAGE_2_CARRY_2_KS_PBS.message_modulus.0; /// let ct = cks.encrypt(rng.gen::() % message_modulus as u64); - /// let lut = vec![(1_u64 << 59); wopbs_key.param.polynomial_size.0].into(); + /// let lut = vec![1_u64 << 59; wopbs_key.param.polynomial_size.0].into(); /// let ct_res = wopbs_key.wopbs(&ct, &lut); /// let res = cks.decrypt_message_and_carry(&ct_res); /// assert_eq!(res, 1); @@ -531,7 +528,7 @@ impl WopbsKey { /// let wopbs_key = WopbsKey::new_wopbs_key_only_for_wopbs(&cks, &sks); /// let mut rng = rand::thread_rng(); /// let ct = cks.encrypt_without_padding(rng.gen::() % 2); - /// let lut = vec![(1_u64 << 63); wopbs_key.param.polynomial_size.0].into(); + /// let lut = vec![1_u64 << 63; wopbs_key.param.polynomial_size.0].into(); /// let ct_res = wopbs_key.programmable_bootstrapping_without_padding(&ct, &lut); /// let res = cks.decrypt_message_and_carry_without_padding(&ct_res); /// assert_eq!(res, 1);