From 412463ed277c13fd2bdbe17fe2e0e42ba6cc6817 Mon Sep 17 00:00:00 2001 From: tmontaigu Date: Thu, 6 Apr 2023 16:12:39 +0200 Subject: [PATCH] chore(shortint): remove the Default impl for Parameters The rationale behind this is that, `shortint::Parameters::default()` does not convey the information about how much bit of message and carry this parameter provides, and so might lead to errors/confusions. Instead user will be forced to use the param name like `PARAM_MESSAGE_2_CARRY_2` which is less ambiguous. This is obviously a breaking change. --- README.md | 5 +-- tfhe/docs/getting_started/quick_start.md | 5 +-- tfhe/docs/shortint/serialization.md | 2 +- tfhe/docs/shortint/tutorial.md | 16 +++++----- tfhe/src/integer/server_key/crt/mod.rs | 4 +-- .../integer/server_key/crt_parallel/mod.rs | 4 +-- tfhe/src/integer/server_key/radix/mod.rs | 4 +-- tfhe/src/shortint/client_key/mod.rs | 31 ++++++++++--------- tfhe/src/shortint/mod.rs | 5 +-- tfhe/src/shortint/parameters/mod.rs | 11 +------ .../parameters_wopbs_message_carry.rs | 4 +-- tfhe/src/shortint/prelude.rs | 13 ++++---- tfhe/src/shortint/public_key/compressed.rs | 24 +++++++------- tfhe/src/shortint/public_key/standard.rs | 22 +++++++------ tfhe/src/shortint/server_key/compressed.rs | 4 +-- 15 files changed, 77 insertions(+), 77 deletions(-) diff --git a/README.md b/README.md index ab6d2ef4b..adac1e0cd 100644 --- a/README.md +++ b/README.md @@ -99,8 +99,9 @@ Another example of how the library can be used with shortints: use tfhe::shortint::prelude::*; fn main() { - // Generate a set of client/server keys, using the default parameters: - let (client_key, server_key) = gen_keys(Parameters::default()); + // Generate a set of client/server keys + // with 2 bits of message and 2 bits of carry + let (client_key, server_key) = gen_keys(PARAM_MESSAGE_2_CARRY_2); let msg1 = 3; let msg2 = 2; diff --git a/tfhe/docs/getting_started/quick_start.md b/tfhe/docs/getting_started/quick_start.md index 8941f36fb..9205917cb 100644 --- a/tfhe/docs/getting_started/quick_start.md +++ b/tfhe/docs/getting_started/quick_start.md @@ -115,8 +115,9 @@ Use the `--release` flag to run this example (eg: `cargo run --release`) use tfhe::shortint::prelude::*; fn main() { - // We generate a set of client/server keys, using the default parameters: - let (client_key, server_key) = gen_keys(Parameters::default()); + // We generate a set of client/server keys + // using parameters with 2 bits of message and 2 bits of carry + let (client_key, server_key) = gen_keys(PARAM_MESSAGE_2_CARRY_2); let msg1 = 1; let msg2 = 0; diff --git a/tfhe/docs/shortint/serialization.md b/tfhe/docs/shortint/serialization.md index fc6112499..495431e6b 100644 --- a/tfhe/docs/shortint/serialization.md +++ b/tfhe/docs/shortint/serialization.md @@ -23,7 +23,7 @@ use tfhe::shortint::prelude::*; fn main() -> Result<(), Box> { - let (client_key, server_key) = gen_keys(Parameters::default()); + let (client_key, server_key) = gen_keys(PARAM_MESSAGE_2_CARRY_2); let msg1 = 1; let msg2 = 0; diff --git a/tfhe/docs/shortint/tutorial.md b/tfhe/docs/shortint/tutorial.md index 544c95252..c64f8a68d 100644 --- a/tfhe/docs/shortint/tutorial.md +++ b/tfhe/docs/shortint/tutorial.md @@ -19,8 +19,8 @@ To reflect that, computation/operation methods are tied to the `ServerKey` type. use tfhe::shortint::prelude::*; fn main() { - // We generate a set of client/server keys, using the default parameters: - let (client_key, server_key) = gen_keys(Parameters::default()); + // We generate a set of client/server keys + let (client_key, server_key) = gen_keys(PARAM_MESSAGE_2_CARRY_2); } ``` @@ -32,8 +32,8 @@ Once the keys have been generated, the client key is used to encrypt data: use tfhe::shortint::prelude::*; fn main() { - // We generate a set of client/server keys, using the default parameters: - let (client_key, server_key) = gen_keys(Parameters::default()); + // We generate a set of client/server keys + let (client_key, server_key) = gen_keys(PARAM_MESSAGE_2_CARRY_2); let msg1 = 1; let msg2 = 0; @@ -52,8 +52,8 @@ Once the keys have been generated, the client key is used to encrypt data: use tfhe::shortint::prelude::*; fn main() { - // We generate a set of client/server keys, using the default parameters: - let (client_key, _) = gen_keys(Parameters::default()); + // We generate a set of client/server keys + let (client_key, _) = gen_keys(PARAM_MESSAGE_2_CARRY_2); let public_key = PublicKeyBig::new(&client_key); let msg1 = 1; @@ -73,8 +73,8 @@ With our `server_key` and encrypted values, we can now do an addition and then d use tfhe::shortint::prelude::*; fn main() { - // We generate a set of client/server keys, using the default parameters: - let (client_key, server_key) = gen_keys(Parameters::default()); + // We generate a set of client/server keys + let (client_key, server_key) = gen_keys(PARAM_MESSAGE_2_CARRY_2); let msg1 = 1; let msg2 = 0; diff --git a/tfhe/src/integer/server_key/crt/mod.rs b/tfhe/src/integer/server_key/crt/mod.rs index 1e41c76aa..e8f6e58ad 100644 --- a/tfhe/src/integer/server_key/crt/mod.rs +++ b/tfhe/src/integer/server_key/crt/mod.rs @@ -57,11 +57,11 @@ impl ServerKey { /// /// ```rust /// use tfhe::integer::gen_keys_crt; - /// use tfhe::shortint::parameters::DEFAULT_PARAMETERS; + /// use tfhe::shortint::parameters::PARAM_MESSAGE_2_CARRY_2; /// /// // Generate the client key and the server key: /// let basis = vec![2, 3, 5]; - /// let (cks, sks) = gen_keys_crt(&DEFAULT_PARAMETERS, basis); + /// let (cks, sks) = gen_keys_crt(&PARAM_MESSAGE_2_CARRY_2, basis); /// /// let clear_1 = 28; /// diff --git a/tfhe/src/integer/server_key/crt_parallel/mod.rs b/tfhe/src/integer/server_key/crt_parallel/mod.rs index 75e8f023f..cf6630c4d 100644 --- a/tfhe/src/integer/server_key/crt_parallel/mod.rs +++ b/tfhe/src/integer/server_key/crt_parallel/mod.rs @@ -56,11 +56,11 @@ impl ServerKey { /// /// ```rust /// use tfhe::integer::gen_keys_crt; - /// use tfhe::shortint::parameters::DEFAULT_PARAMETERS; + /// use tfhe::shortint::parameters::PARAM_MESSAGE_2_CARRY_2; /// /// // Generate the client key and the server key: /// let basis = vec![2, 3, 5]; - /// let (cks, sks) = gen_keys_crt(&DEFAULT_PARAMETERS, basis); + /// let (cks, sks) = gen_keys_crt(&PARAM_MESSAGE_2_CARRY_2, basis); /// /// let clear_1 = 28; /// diff --git a/tfhe/src/integer/server_key/radix/mod.rs b/tfhe/src/integer/server_key/radix/mod.rs index 648d8fb88..078c696ff 100644 --- a/tfhe/src/integer/server_key/radix/mod.rs +++ b/tfhe/src/integer/server_key/radix/mod.rs @@ -24,12 +24,12 @@ impl ServerKey { /// /// ```rust /// use tfhe::integer::{gen_keys_radix, RadixCiphertextBig}; - /// use tfhe::shortint::parameters::DEFAULT_PARAMETERS; + /// use tfhe::shortint::parameters::PARAM_MESSAGE_2_CARRY_2; /// /// let num_blocks = 4; /// /// // Generate the client key and the server key: - /// let (cks, sks) = gen_keys_radix(&DEFAULT_PARAMETERS, num_blocks); + /// let (cks, sks) = gen_keys_radix(&PARAM_MESSAGE_2_CARRY_2, num_blocks); /// /// let ctxt: RadixCiphertextBig = sks.create_trivial_zero_radix(num_blocks); /// diff --git a/tfhe/src/shortint/client_key/mod.rs b/tfhe/src/shortint/client_key/mod.rs index ac78b068e..211cd897d 100644 --- a/tfhe/src/shortint/client_key/mod.rs +++ b/tfhe/src/shortint/client_key/mod.rs @@ -35,10 +35,10 @@ impl ClientKey { /// /// ```rust /// use tfhe::shortint::client_key::ClientKey; - /// use tfhe::shortint::parameters::Parameters; + /// use tfhe::shortint::parameters::PARAM_MESSAGE_2_CARRY_2; /// /// // Generate the client key: - /// let cks = ClientKey::new(Parameters::default()); + /// let cks = ClientKey::new(PARAM_MESSAGE_2_CARRY_2); /// ``` pub fn new(parameters: Parameters) -> ClientKey { ShortintEngine::with_thread_local_mut(|engine| engine.new_client_key(parameters).unwrap()) @@ -185,11 +185,11 @@ impl ClientKey { /// # Example /// /// ```rust - /// use tfhe::shortint::parameters::MessageModulus; - /// use tfhe::shortint::{ClientKey, Parameters}; + /// use tfhe::shortint::parameters::{MessageModulus, PARAM_MESSAGE_2_CARRY_2}; + /// use tfhe::shortint::ClientKey; /// /// // Generate the client key - /// let cks = ClientKey::new(Parameters::default()); + /// let cks = ClientKey::new(PARAM_MESSAGE_2_CARRY_2); /// /// let msg = 3; /// @@ -250,11 +250,11 @@ impl ClientKey { /// # Example /// /// ```rust - /// use tfhe::shortint::parameters::MessageModulus; - /// use tfhe::shortint::{ClientKey, Parameters}; + /// use tfhe::shortint::parameters::{MessageModulus, PARAM_MESSAGE_2_CARRY_2}; + /// use tfhe::shortint::ClientKey; /// /// // Generate the client key - /// let cks = ClientKey::new(Parameters::default()); + /// let cks = ClientKey::new(PARAM_MESSAGE_2_CARRY_2); /// /// let msg = 3; /// @@ -319,10 +319,11 @@ impl ClientKey { /// # Example /// /// ```rust - /// use tfhe::shortint::{ClientKey, Parameters}; + /// use tfhe::shortint::parameters::PARAM_MESSAGE_2_CARRY_2; + /// use tfhe::shortint::ClientKey; /// /// // Generate the client key - /// let cks = ClientKey::new(Parameters::default()); + /// let cks = ClientKey::new(PARAM_MESSAGE_2_CARRY_2); /// /// let msg = 7; /// let ct = cks.unchecked_encrypt(msg); @@ -639,10 +640,11 @@ impl ClientKey { /// # Example /// /// ```rust - /// use tfhe::shortint::{ClientKey, Parameters}; + /// use tfhe::shortint::parameters::PARAM_MESSAGE_2_CARRY_2; + /// use tfhe::shortint::ClientKey; /// /// // Generate the client key - /// let cks = ClientKey::new(Parameters::default()); + /// let cks = ClientKey::new(PARAM_MESSAGE_2_CARRY_2); /// /// let msg = 2; /// let modulus = 3; @@ -701,10 +703,11 @@ impl ClientKey { /// # Example /// /// ```rust - /// use tfhe::shortint::{ClientKey, Parameters}; + /// use tfhe::shortint::parameters::PARAM_MESSAGE_2_CARRY_2; + /// use tfhe::shortint::ClientKey; /// /// // Generate the client key - /// let cks = ClientKey::new(Parameters::default()); + /// let cks = ClientKey::new(PARAM_MESSAGE_2_CARRY_2); /// /// let msg = 2; /// let modulus = 3; diff --git a/tfhe/src/shortint/mod.rs b/tfhe/src/shortint/mod.rs index fae521eda..dcf256c01 100755 --- a/tfhe/src/shortint/mod.rs +++ b/tfhe/src/shortint/mod.rs @@ -30,7 +30,7 @@ //! use tfhe::shortint::{gen_keys, Parameters}; //! //! // We generate a set of client/server keys, using the default parameters: -//! let (mut client_key, mut server_key) = gen_keys(Parameters::default()); +//! let (mut client_key, mut server_key) = gen_keys(PARAM_MESSAGE_2_CARRY_2); //! //! let msg1 = 1; //! let msg2 = 0; @@ -78,9 +78,10 @@ pub use server_key::{CheckError, CompressedServerKey, ServerKey}; /// /// ```rust /// use tfhe::shortint::gen_keys; +/// use tfhe::shortint::parameters::PARAM_MESSAGE_2_CARRY_2; /// /// // generate the client key and the server key: -/// let (cks, sks) = gen_keys(Default::default()); +/// let (cks, sks) = gen_keys(PARAM_MESSAGE_2_CARRY_2); /// ``` pub fn gen_keys(parameters_set: Parameters) -> (ClientKey, ServerKey) { let cks = ClientKey::new(parameters_set); diff --git a/tfhe/src/shortint/parameters/mod.rs b/tfhe/src/shortint/parameters/mod.rs index 16dce0409..58fbc26db 100644 --- a/tfhe/src/shortint/parameters/mod.rs +++ b/tfhe/src/shortint/parameters/mod.rs @@ -93,12 +93,6 @@ impl Parameters { } } -impl Default for Parameters { - fn default() -> Self { - DEFAULT_PARAMETERS - } -} - /// Vector containing all parameter sets pub const ALL_PARAMETER_VEC: [Parameters; 28] = WITH_CARRY_PARAMETERS_VEC; @@ -154,9 +148,6 @@ pub const BIVARIATE_PBS_COMPLIANT_PARAMETER_SET_VEC: [Parameters; 16] = [ PARAM_MESSAGE_4_CARRY_4, ]; -/// Default parameter set -pub const DEFAULT_PARAMETERS: Parameters = PARAM_MESSAGE_2_CARRY_2; - /// Nomenclature: PARAM_MESSAGE_X_CARRY_Y: the message (respectively carry) modulus is /// encoded over X (reps. Y) bits, i.e., message_modulus = 2^{X} (resp. carry_modulus = 2^{Y}). /// All parameter sets guarantee 128-bits of security and an error probability smaller than @@ -900,7 +891,7 @@ pub const PARAM_SMALL_MESSAGE_4_CARRY_4: Parameters = Parameters { /// assert_eq!(param, PARAM_MESSAGE_3_CARRY_1); /// ``` pub fn get_parameters_from_message_and_carry(msg_space: usize, carry_space: usize) -> Parameters { - let mut out = Parameters::default(); + let mut out = PARAM_MESSAGE_2_CARRY_2; let mut flag: bool = false; let mut rescaled_message_space = f64::ceil(f64::log2(msg_space as f64)) as usize; rescaled_message_space = 1 << rescaled_message_space; diff --git a/tfhe/src/shortint/parameters/parameters_wopbs_message_carry.rs b/tfhe/src/shortint/parameters/parameters_wopbs_message_carry.rs index bf2d1aaaa..48bd41785 100644 --- a/tfhe/src/shortint/parameters/parameters_wopbs_message_carry.rs +++ b/tfhe/src/shortint/parameters/parameters_wopbs_message_carry.rs @@ -6,7 +6,7 @@ pub use crate::core_crypto::commons::parameters::{ }; use crate::shortint::parameters::parameters_wopbs::*; use crate::shortint::parameters::parameters_wopbs_prime_moduli::*; -use crate::shortint::parameters::{CarryModulus, MessageModulus}; +use crate::shortint::parameters::{CarryModulus, MessageModulus, PARAM_MESSAGE_2_CARRY_2}; use crate::shortint::Parameters; pub const ALL_PARAMETER_VEC_WOPBS: [Parameters; 116] = [ @@ -943,7 +943,7 @@ pub fn get_parameters_from_message_and_carry_wopbs( msg_space: usize, carry_space: usize, ) -> Parameters { - let mut out = Parameters::default(); + let mut out = PARAM_MESSAGE_2_CARRY_2; let mut flag: bool = false; let mut rescaled_message_space = f64::ceil(f64::log2(msg_space as f64)) as usize; rescaled_message_space = 1 << rescaled_message_space; diff --git a/tfhe/src/shortint/prelude.rs b/tfhe/src/shortint/prelude.rs index f4153045a..5f4541951 100644 --- a/tfhe/src/shortint/prelude.rs +++ b/tfhe/src/shortint/prelude.rs @@ -11,13 +11,12 @@ pub use super::client_key::ClientKey; pub use super::gen_keys; pub use super::parameters::{ CarryModulus, DecompositionBaseLog, DecompositionLevelCount, GlweDimension, LweDimension, - MessageModulus, Parameters, PolynomialSize, StandardDev, DEFAULT_PARAMETERS, - PARAM_MESSAGE_1_CARRY_1, PARAM_MESSAGE_1_CARRY_2, PARAM_MESSAGE_1_CARRY_3, - PARAM_MESSAGE_1_CARRY_4, PARAM_MESSAGE_1_CARRY_5, PARAM_MESSAGE_1_CARRY_6, - PARAM_MESSAGE_1_CARRY_7, PARAM_MESSAGE_2_CARRY_2, PARAM_MESSAGE_2_CARRY_3, - PARAM_MESSAGE_2_CARRY_4, PARAM_MESSAGE_2_CARRY_5, PARAM_MESSAGE_2_CARRY_6, - PARAM_MESSAGE_3_CARRY_3, PARAM_MESSAGE_3_CARRY_4, PARAM_MESSAGE_3_CARRY_5, - PARAM_MESSAGE_4_CARRY_4, + MessageModulus, Parameters, PolynomialSize, StandardDev, PARAM_MESSAGE_1_CARRY_1, + PARAM_MESSAGE_1_CARRY_2, PARAM_MESSAGE_1_CARRY_3, PARAM_MESSAGE_1_CARRY_4, + PARAM_MESSAGE_1_CARRY_5, PARAM_MESSAGE_1_CARRY_6, PARAM_MESSAGE_1_CARRY_7, + PARAM_MESSAGE_2_CARRY_2, PARAM_MESSAGE_2_CARRY_3, PARAM_MESSAGE_2_CARRY_4, + PARAM_MESSAGE_2_CARRY_5, PARAM_MESSAGE_2_CARRY_6, PARAM_MESSAGE_3_CARRY_3, + PARAM_MESSAGE_3_CARRY_4, PARAM_MESSAGE_3_CARRY_5, PARAM_MESSAGE_4_CARRY_4, }; pub use super::public_key::{PublicKeyBase, PublicKeyBig, PublicKeySmall}; pub use super::server_key::ServerKey; diff --git a/tfhe/src/shortint/public_key/compressed.rs b/tfhe/src/shortint/public_key/compressed.rs index f2f65c06c..1485586f6 100644 --- a/tfhe/src/shortint/public_key/compressed.rs +++ b/tfhe/src/shortint/public_key/compressed.rs @@ -27,11 +27,11 @@ impl CompressedPublicKeyBig { /// /// ```rust /// use tfhe::shortint::client_key::ClientKey; - /// use tfhe::shortint::parameters::Parameters; + /// use tfhe::shortint::parameters::PARAM_MESSAGE_2_CARRY_2; /// use tfhe::shortint::public_key::CompressedPublicKeyBig; /// /// // Generate the client key: - /// let cks = ClientKey::new(Parameters::default()); + /// let cks = ClientKey::new(PARAM_MESSAGE_2_CARRY_2); /// /// let pk = CompressedPublicKeyBig::new(&cks); /// ``` @@ -49,11 +49,11 @@ impl CompressedPublicKeySmall { /// /// ```rust /// use tfhe::shortint::client_key::ClientKey; - /// use tfhe::shortint::parameters::Parameters; + /// use tfhe::shortint::parameters::PARAM_MESSAGE_2_CARRY_2; /// use tfhe::shortint::public_key::CompressedPublicKeySmall; /// /// // Generate the client key: - /// let cks = ClientKey::new(Parameters::default()); + /// let cks = ClientKey::new(PARAM_MESSAGE_2_CARRY_2); /// /// let pk = CompressedPublicKeySmall::new(&cks); /// ``` @@ -125,11 +125,11 @@ impl CompressedPublicKeyBase { /// # Example /// /// ```rust - /// use tfhe::shortint::parameters::MessageModulus; - /// use tfhe::shortint::{ClientKey, CompressedPublicKeyBig, CompressedPublicKeySmall, Parameters}; + /// use tfhe::shortint::parameters::{MessageModulus, PARAM_MESSAGE_2_CARRY_2}; + /// use tfhe::shortint::{ClientKey, CompressedPublicKeyBig, CompressedPublicKeySmall}; /// /// // Generate the client key: - /// let cks = ClientKey::new(Parameters::default()); + /// let cks = ClientKey::new(PARAM_MESSAGE_2_CARRY_2); /// /// let pk = CompressedPublicKeyBig::new(&cks); /// @@ -174,10 +174,11 @@ impl CompressedPublicKeyBase { /// # Example /// /// ```rust - /// use tfhe::shortint::{ClientKey, CompressedPublicKeyBig, CompressedPublicKeySmall, Parameters}; + /// use tfhe::shortint::parameters::PARAM_MESSAGE_2_CARRY_2; + /// use tfhe::shortint::{ClientKey, CompressedPublicKeyBig, CompressedPublicKeySmall}; /// /// // Generate the client key: - /// let cks = ClientKey::new(Parameters::default()); + /// let cks = ClientKey::new(PARAM_MESSAGE_2_CARRY_2); /// /// let pk = CompressedPublicKeyBig::new(&cks); /// @@ -256,10 +257,11 @@ impl CompressedPublicKeyBase { /// # Example /// /// ```rust - /// use tfhe::shortint::{ClientKey, CompressedPublicKeyBig, CompressedPublicKeySmall, Parameters}; + /// use tfhe::shortint::parameters::PARAM_MESSAGE_2_CARRY_2; + /// use tfhe::shortint::{ClientKey, CompressedPublicKeyBig, CompressedPublicKeySmall}; /// /// // Generate the client key: - /// let cks = ClientKey::new(Parameters::default()); + /// let cks = ClientKey::new(PARAM_MESSAGE_2_CARRY_2); /// /// let pk = CompressedPublicKeyBig::new(&cks); /// diff --git a/tfhe/src/shortint/public_key/standard.rs b/tfhe/src/shortint/public_key/standard.rs index a3da4aef8..8057ae961 100644 --- a/tfhe/src/shortint/public_key/standard.rs +++ b/tfhe/src/shortint/public_key/standard.rs @@ -27,11 +27,11 @@ impl PublicKeyBig { /// /// ```rust /// use tfhe::shortint::client_key::ClientKey; - /// use tfhe::shortint::parameters::Parameters; + /// use tfhe::shortint::parameters::PARAM_MESSAGE_2_CARRY_2; /// use tfhe::shortint::public_key::PublicKeyBig; /// /// // Generate the client key: - /// let cks = ClientKey::new(Parameters::default()); + /// let cks = ClientKey::new(PARAM_MESSAGE_2_CARRY_2); /// /// let pk = PublicKeyBig::new(&cks); /// ``` @@ -47,11 +47,11 @@ impl PublicKeySmall { /// /// ```rust /// use tfhe::shortint::client_key::ClientKey; - /// use tfhe::shortint::parameters::Parameters; + /// use tfhe::shortint::parameters::PARAM_MESSAGE_2_CARRY_2; /// use tfhe::shortint::public_key::PublicKeySmall; /// /// // Generate the client key: - /// let cks = ClientKey::new(Parameters::default()); + /// let cks = ClientKey::new(PARAM_MESSAGE_2_CARRY_2); /// /// let pk = PublicKeySmall::new(&cks); /// ``` @@ -119,11 +119,11 @@ impl PublicKeyBase { /// # Example /// /// ```rust - /// use tfhe::shortint::parameters::MessageModulus; - /// use tfhe::shortint::{ClientKey, Parameters, PublicKeyBig, PublicKeySmall}; + /// use tfhe::shortint::parameters::{MessageModulus, PARAM_MESSAGE_2_CARRY_2}; + /// use tfhe::shortint::{ClientKey, PublicKeyBig, PublicKeySmall}; /// /// // Generate the client key: - /// let cks = ClientKey::new(Parameters::default()); + /// let cks = ClientKey::new(PARAM_MESSAGE_2_CARRY_2); /// /// let pk = PublicKeyBig::new(&cks); /// @@ -164,10 +164,11 @@ impl PublicKeyBase { /// # Example /// /// ```rust + /// use tfhe::shortint::parameters::PARAM_MESSAGE_2_CARRY_2; /// use tfhe::shortint::{ClientKey, Parameters, PublicKeyBig, PublicKeySmall}; /// /// // Generate the client key: - /// let cks = ClientKey::new(Parameters::default()); + /// let cks = ClientKey::new(PARAM_MESSAGE_2_CARRY_2); /// /// let pk = PublicKeyBig::new(&cks); /// @@ -247,10 +248,11 @@ impl PublicKeyBase { /// # Example /// /// ```rust - /// use tfhe::shortint::{ClientKey, Parameters, PublicKeyBig, PublicKeySmall}; + /// use tfhe::shortint::parameters::PARAM_MESSAGE_2_CARRY_2; + /// use tfhe::shortint::{ClientKey, PublicKeyBig, PublicKeySmall}; /// /// // Generate the client key: - /// let cks = ClientKey::new(Parameters::default()); + /// let cks = ClientKey::new(PARAM_MESSAGE_2_CARRY_2); /// /// let pk = PublicKeyBig::new(&cks); /// diff --git a/tfhe/src/shortint/server_key/compressed.rs b/tfhe/src/shortint/server_key/compressed.rs index c73cb38fd..40e72269f 100644 --- a/tfhe/src/shortint/server_key/compressed.rs +++ b/tfhe/src/shortint/server_key/compressed.rs @@ -30,11 +30,11 @@ impl CompressedServerKey { /// /// ```rust /// use tfhe::shortint::client_key::ClientKey; - /// use tfhe::shortint::parameters::Parameters; + /// use tfhe::shortint::parameters::PARAM_MESSAGE_2_CARRY_2; /// use tfhe::shortint::server_key::CompressedServerKey; /// /// // Generate the client key: - /// let cks = ClientKey::new(Parameters::default()); + /// let cks = ClientKey::new(PARAM_MESSAGE_2_CARRY_2); /// /// let sks = CompressedServerKey::new(&cks); /// ```