diff --git a/apps/trivium/benches/kreyvium_shortint.rs b/apps/trivium/benches/kreyvium_shortint.rs index 4ede073b6b..1246412d11 100644 --- a/apps/trivium/benches/kreyvium_shortint.rs +++ b/apps/trivium/benches/kreyvium_shortint.rs @@ -17,7 +17,7 @@ pub fn kreyvium_shortint_warmup(c: &mut Criterion) { let ksk = KeySwitchingKey::new( (&client_key, Some(&server_key)), (&underlying_ck, &underlying_sk), - PARAM_KEYSWITCH_1_1_KS_PBS_TO_2_2_KS_PBS, + V0_11_PARAM_KEYSWITCH_1_1_KS_PBS_TO_2_2_KS_PBS, ); let key_string = "0053A6F94C9FF24598EB000000000000".to_string(); @@ -68,7 +68,7 @@ pub fn kreyvium_shortint_gen(c: &mut Criterion) { let ksk = KeySwitchingKey::new( (&client_key, Some(&server_key)), (&underlying_ck, &underlying_sk), - PARAM_KEYSWITCH_1_1_KS_PBS_TO_2_2_KS_PBS, + V0_11_PARAM_KEYSWITCH_1_1_KS_PBS_TO_2_2_KS_PBS, ); let key_string = "0053A6F94C9FF24598EB000000000000".to_string(); @@ -114,7 +114,7 @@ pub fn kreyvium_shortint_trans(c: &mut Criterion) { let ksk = KeySwitchingKey::new( (&client_key, Some(&server_key)), (&underlying_ck, &underlying_sk), - PARAM_KEYSWITCH_1_1_KS_PBS_TO_2_2_KS_PBS, + V0_11_PARAM_KEYSWITCH_1_1_KS_PBS_TO_2_2_KS_PBS, ); let key_string = "0053A6F94C9FF24598EB000000000000".to_string(); diff --git a/apps/trivium/benches/trivium_shortint.rs b/apps/trivium/benches/trivium_shortint.rs index b49da8462e..bc85462f0d 100644 --- a/apps/trivium/benches/trivium_shortint.rs +++ b/apps/trivium/benches/trivium_shortint.rs @@ -17,7 +17,7 @@ pub fn trivium_shortint_warmup(c: &mut Criterion) { let ksk = KeySwitchingKey::new( (&client_key, Some(&server_key)), (&underlying_ck, &underlying_sk), - PARAM_KEYSWITCH_1_1_KS_PBS_TO_2_2_KS_PBS, + V0_11_PARAM_KEYSWITCH_1_1_KS_PBS_TO_2_2_KS_PBS, ); let key_string = "0053A6F94C9FF24598EB".to_string(); @@ -68,7 +68,7 @@ pub fn trivium_shortint_gen(c: &mut Criterion) { let ksk = KeySwitchingKey::new( (&client_key, Some(&server_key)), (&underlying_ck, &underlying_sk), - PARAM_KEYSWITCH_1_1_KS_PBS_TO_2_2_KS_PBS, + V0_11_PARAM_KEYSWITCH_1_1_KS_PBS_TO_2_2_KS_PBS, ); let key_string = "0053A6F94C9FF24598EB".to_string(); @@ -114,7 +114,7 @@ pub fn trivium_shortint_trans(c: &mut Criterion) { let ksk = KeySwitchingKey::new( (&client_key, Some(&server_key)), (&underlying_ck, &underlying_sk), - PARAM_KEYSWITCH_1_1_KS_PBS_TO_2_2_KS_PBS, + V0_11_PARAM_KEYSWITCH_1_1_KS_PBS_TO_2_2_KS_PBS, ); let key_string = "0053A6F94C9FF24598EB".to_string(); diff --git a/apps/trivium/src/kreyvium/test.rs b/apps/trivium/src/kreyvium/test.rs index 24b2e1bee0..77ed74daea 100644 --- a/apps/trivium/src/kreyvium/test.rs +++ b/apps/trivium/src/kreyvium/test.rs @@ -227,7 +227,7 @@ fn kreyvium_test_shortint_long() { let ksk = KeySwitchingKey::new( (&client_key, Some(&server_key)), (&underlying_ck, &underlying_sk), - PARAM_KEYSWITCH_1_1_KS_PBS_TO_2_2_KS_PBS, + V0_11_PARAM_KEYSWITCH_1_1_KS_PBS_TO_2_2_KS_PBS, ); let key_string = "0053A6F94C9FF24598EB000000000000".to_string(); diff --git a/apps/trivium/src/trivium/test.rs b/apps/trivium/src/trivium/test.rs index 0d755571fc..df5e00dc5f 100644 --- a/apps/trivium/src/trivium/test.rs +++ b/apps/trivium/src/trivium/test.rs @@ -363,7 +363,7 @@ fn trivium_test_shortint_long() { let ksk = KeySwitchingKey::new( (&client_key, Some(&server_key)), (&underlying_ck, &underlying_sk), - PARAM_KEYSWITCH_1_1_KS_PBS_TO_2_2_KS_PBS, + V0_11_PARAM_KEYSWITCH_1_1_KS_PBS_TO_2_2_KS_PBS, ); let key_string = "0053A6F94C9FF24598EB".to_string(); diff --git a/tfhe/benches/shortint/casting.rs b/tfhe/benches/shortint/casting.rs index 5dc56d5722..7992dfdcc5 100644 --- a/tfhe/benches/shortint/casting.rs +++ b/tfhe/benches/shortint/casting.rs @@ -16,8 +16,8 @@ pub fn pack_cast_64(c: &mut Criterion) { let (client_key_2, server_key_2): (ClientKey, ServerKey) = gen_keys(V0_11_PARAM_MESSAGE_2_CARRY_2_KS_PBS_GAUSSIAN_2M64); - let ks_param = PARAM_KEYSWITCH_1_1_KS_PBS_TO_2_2_KS_PBS; - let ks_param_name = "PARAM_KEYSWITCH_1_1_KS_PBS_TO_2_2_KS_PBS"; + let ks_param = V0_11_PARAM_KEYSWITCH_1_1_KS_PBS_TO_2_2_KS_PBS; + let ks_param_name = "V0_11_PARAM_KEYSWITCH_1_1_KS_PBS_TO_2_2_KS_PBS"; let ksk = KeySwitchingKey::new( (&client_key_1, Some(&server_key_1)), @@ -67,8 +67,8 @@ pub fn pack_cast(c: &mut Criterion) { let (client_key_2, server_key_2): (ClientKey, ServerKey) = gen_keys(V0_11_PARAM_MESSAGE_2_CARRY_2_KS_PBS_GAUSSIAN_2M64); - let ks_param = PARAM_KEYSWITCH_1_1_KS_PBS_TO_2_2_KS_PBS; - let ks_param_name = "PARAM_KEYSWITCH_1_1_KS_PBS_TO_2_2_KS_PBS"; + let ks_param = V0_11_PARAM_KEYSWITCH_1_1_KS_PBS_TO_2_2_KS_PBS; + let ks_param_name = "V0_11_PARAM_KEYSWITCH_1_1_KS_PBS_TO_2_2_KS_PBS"; let ksk = KeySwitchingKey::new( (&client_key_1, Some(&server_key_1)), @@ -108,8 +108,8 @@ pub fn cast(c: &mut Criterion) { let (client_key_2, server_key_2): (ClientKey, ServerKey) = gen_keys(V0_11_PARAM_MESSAGE_2_CARRY_2_KS_PBS_GAUSSIAN_2M64); - let ks_param = PARAM_KEYSWITCH_1_1_KS_PBS_TO_2_2_KS_PBS; - let ks_param_name = "PARAM_KEYSWITCH_1_1_KS_PBS_TO_2_2_KS_PBS"; + let ks_param = V0_11_PARAM_KEYSWITCH_1_1_KS_PBS_TO_2_2_KS_PBS; + let ks_param_name = "V0_11_PARAM_KEYSWITCH_1_1_KS_PBS_TO_2_2_KS_PBS"; let ksk = KeySwitchingKey::new( (&client_key_1, Some(&server_key_1)), diff --git a/tfhe/examples/utilities/generates_test_keys.rs b/tfhe/examples/utilities/generates_test_keys.rs index 033f65125c..178296f7f0 100644 --- a/tfhe/examples/utilities/generates_test_keys.rs +++ b/tfhe/examples/utilities/generates_test_keys.rs @@ -13,7 +13,7 @@ use tfhe::shortint::parameters::coverage_parameters::{ COVERAGE_PARAM_MESSAGE_5_CARRY_1_KS_PBS, COVERAGE_PARAM_MULTI_BIT_MESSAGE_2_CARRY_2_GROUP_2_KS_PBS, }; -use tfhe::shortint::parameters::key_switching::p_fail_2_minus_64::ks_pbs::PARAM_KEYSWITCH_1_1_KS_PBS_TO_2_2_KS_PBS; +use tfhe::shortint::parameters::key_switching::p_fail_2_minus_64::ks_pbs::V0_11_PARAM_KEYSWITCH_1_1_KS_PBS_TO_2_2_KS_PBS; use tfhe::shortint::parameters::key_switching::ShortintKeySwitchingParameters; use tfhe::shortint::parameters::multi_bit::gaussian::p_fail_2_minus_64::ks_pbs::{ @@ -110,12 +110,12 @@ fn client_server_keys() { ( V0_11_PARAM_MESSAGE_1_CARRY_1_KS_PBS_GAUSSIAN_2M64, V0_11_PARAM_MESSAGE_2_CARRY_2_KS_PBS_GAUSSIAN_2M64, - PARAM_KEYSWITCH_1_1_KS_PBS_TO_2_2_KS_PBS, + V0_11_PARAM_KEYSWITCH_1_1_KS_PBS_TO_2_2_KS_PBS, ), ( V0_11_PARAM_MESSAGE_1_CARRY_1_KS_PBS_GAUSSIAN_2M64, V0_11_PARAM_MESSAGE_3_CARRY_3_KS_PBS_GAUSSIAN_2M64, - PARAM_KEYSWITCH_1_1_KS_PBS_TO_2_2_KS_PBS, + V0_11_PARAM_KEYSWITCH_1_1_KS_PBS_TO_2_2_KS_PBS, ), ]; diff --git a/tfhe/src/shortint/key_switching_key/mod.rs b/tfhe/src/shortint/key_switching_key/mod.rs index 4aa6082587..00ac2271e4 100644 --- a/tfhe/src/shortint/key_switching_key/mod.rs +++ b/tfhe/src/shortint/key_switching_key/mod.rs @@ -190,7 +190,7 @@ impl KeySwitchingKey { /// let ksk = KeySwitchingKey::new( /// (&ck1, Some(&sk1)), /// (&ck2, &sk2), - /// PARAM_KEYSWITCH_1_1_KS_PBS_TO_2_2_KS_PBS, + /// V0_11_PARAM_KEYSWITCH_1_1_KS_PBS_TO_2_2_KS_PBS, /// ); /// ``` pub fn new<'input_key, InputEncryptionKey>( @@ -337,7 +337,7 @@ impl KeySwitchingKey { /// let ksk = KeySwitchingKey::new( /// (&ck1, Some(&sk1)), /// (&ck2, &sk2), - /// PARAM_KEYSWITCH_1_1_KS_PBS_TO_2_2_KS_PBS, + /// V0_11_PARAM_KEYSWITCH_1_1_KS_PBS_TO_2_2_KS_PBS, /// ); /// /// let cleartext = 1; @@ -478,7 +478,7 @@ impl<'keys> KeySwitchingKeyView<'keys> { /// let ksk = KeySwitchingKey::new( /// (&ck1, Some(&sk1)), /// (&ck2, &sk2), - /// PARAM_KEYSWITCH_1_1_KS_PBS_TO_2_2_KS_PBS, + /// V0_11_PARAM_KEYSWITCH_1_1_KS_PBS_TO_2_2_KS_PBS, /// ); /// /// let cleartext = 1; diff --git a/tfhe/src/shortint/key_switching_key/test.rs b/tfhe/src/shortint/key_switching_key/test.rs index 239930d4ea..251d8a8242 100644 --- a/tfhe/src/shortint/key_switching_key/test.rs +++ b/tfhe/src/shortint/key_switching_key/test.rs @@ -11,7 +11,7 @@ fn gen_multi_keys_test_fresh_ci_run_filter() { let keys = KEY_CACHE_KSK.get_from_param(( V0_11_PARAM_MESSAGE_1_CARRY_1_KS_PBS_GAUSSIAN_2M64, V0_11_PARAM_MESSAGE_2_CARRY_2_KS_PBS_GAUSSIAN_2M64, - PARAM_KEYSWITCH_1_1_KS_PBS_TO_2_2_KS_PBS, + V0_11_PARAM_KEYSWITCH_1_1_KS_PBS_TO_2_2_KS_PBS, )); let ck1 = keys.client_key_1(); let (ck2, sk2) = (keys.client_key_2(), keys.server_key_2()); @@ -119,7 +119,7 @@ fn gen_multi_keys_test_add_with_overflow_ci_run_filter() { let keys = KEY_CACHE_KSK.get_from_param(( V0_11_PARAM_MESSAGE_1_CARRY_1_KS_PBS_GAUSSIAN_2M64, V0_11_PARAM_MESSAGE_3_CARRY_3_KS_PBS_GAUSSIAN_2M64, - PARAM_KEYSWITCH_1_1_KS_PBS_TO_2_2_KS_PBS, + V0_11_PARAM_KEYSWITCH_1_1_KS_PBS_TO_2_2_KS_PBS, )); let (ck1, sk1) = (keys.client_key_1(), keys.server_key_1()); let (ck2, sk2) = (keys.client_key_2(), keys.server_key_2()); diff --git a/tfhe/src/shortint/keycache.rs b/tfhe/src/shortint/keycache.rs index e377910f82..71bba5af08 100644 --- a/tfhe/src/shortint/keycache.rs +++ b/tfhe/src/shortint/keycache.rs @@ -7,7 +7,7 @@ use crate::shortint::parameters::classic::tuniform::p_fail_2_minus_64::ks_pbs::P use crate::shortint::parameters::compact_public_key_only::p_fail_2_minus_64::ks_pbs::V0_11_PARAM_PKE_MESSAGE_2_CARRY_2_KS_PBS_TUNIFORM_2M64; #[cfg(tarpaulin)] use crate::shortint::parameters::coverage_parameters::*; -use crate::shortint::parameters::key_switching::p_fail_2_minus_64::ks_pbs::PARAM_KEYSWITCH_1_1_KS_PBS_TO_2_2_KS_PBS; +use crate::shortint::parameters::key_switching::p_fail_2_minus_64::ks_pbs::V0_11_PARAM_KEYSWITCH_1_1_KS_PBS_TO_2_2_KS_PBS; use crate::shortint::parameters::key_switching::*; use crate::shortint::parameters::list_compression::*; use crate::shortint::parameters::parameters_wopbs::*; @@ -285,12 +285,12 @@ impl NamedParam for WopbsParameters { impl NamedParam for ShortintKeySwitchingParameters { fn name(&self) -> String { - named_params_impl!(expose PARAM_KEYSWITCH_1_1_KS_PBS_TO_2_2_KS_PBS); + named_params_impl!(expose V0_11_PARAM_KEYSWITCH_1_1_KS_PBS_TO_2_2_KS_PBS); named_params_impl!( { *self; Self - } == (PARAM_KEYSWITCH_1_1_KS_PBS_TO_2_2_KS_PBS) + } == (V0_11_PARAM_KEYSWITCH_1_1_KS_PBS_TO_2_2_KS_PBS) ); format!( diff --git a/tfhe/src/shortint/parameters/key_switching/p_fail_2_minus_64/ks_pbs.rs b/tfhe/src/shortint/parameters/key_switching/p_fail_2_minus_64/ks_pbs.rs index fb4c4d7acb..0286a71707 100644 --- a/tfhe/src/shortint/parameters/key_switching/p_fail_2_minus_64/ks_pbs.rs +++ b/tfhe/src/shortint/parameters/key_switching/p_fail_2_minus_64/ks_pbs.rs @@ -2,11 +2,11 @@ use crate::shortint::parameters::{ DecompositionBaseLog, DecompositionLevelCount, EncryptionKeyChoice, ShortintKeySwitchingParameters, }; -pub const PARAM_KEYSWITCH_1_1_KS_PBS_TO_2_2_KS_PBS: ShortintKeySwitchingParameters = +pub const V0_11_PARAM_KEYSWITCH_1_1_KS_PBS_TO_2_2_KS_PBS: ShortintKeySwitchingParameters = ShortintKeySwitchingParameters { - ks_level: DecompositionLevelCount(15), - ks_base_log: DecompositionBaseLog(1), - destination_key: EncryptionKeyChoice::Big, + ks_level: DecompositionLevelCount(5), + ks_base_log: DecompositionBaseLog(3), + destination_key: EncryptionKeyChoice::Small, }; // The level and base log correspond to the level and base log of the 2_2 TUniform parameters, so diff --git a/tfhe/src/shortint/parameters/v0_10/key_switching/p_fail_2_minus_64/ks_pbs.rs b/tfhe/src/shortint/parameters/v0_10/key_switching/p_fail_2_minus_64/ks_pbs.rs index e0d12960e7..57f44066a4 100644 --- a/tfhe/src/shortint/parameters/v0_10/key_switching/p_fail_2_minus_64/ks_pbs.rs +++ b/tfhe/src/shortint/parameters/v0_10/key_switching/p_fail_2_minus_64/ks_pbs.rs @@ -3,6 +3,13 @@ use crate::shortint::parameters::{ ShortintKeySwitchingParameters, }; +pub const V0_10_PARAM_KEYSWITCH_1_1_KS_PBS_TO_2_2_KS_PBS: ShortintKeySwitchingParameters = + ShortintKeySwitchingParameters { + ks_level: DecompositionLevelCount(15), + ks_base_log: DecompositionBaseLog(1), + destination_key: EncryptionKeyChoice::Big, + }; + pub const V0_10_PARAM_KEYSWITCH_MESSAGE_2_CARRY_2_KS_PBS_TUNIFORM_2M64: ShortintKeySwitchingParameters = V0_10_PARAM_KEYSWITCH_PKE_TO_SMALL_MESSAGE_2_CARRY_2_KS_PBS_TUNIFORM_2M64; diff --git a/tfhe/src/shortint/prelude.rs b/tfhe/src/shortint/prelude.rs index bced57fc15..a6c120c338 100644 --- a/tfhe/src/shortint/prelude.rs +++ b/tfhe/src/shortint/prelude.rs @@ -7,7 +7,7 @@ pub use super::ciphertext::{Ciphertext, CompressedCiphertext, PBSOrder}; pub use super::client_key::ClientKey; pub use super::gen_keys; pub use super::key_switching_key::KeySwitchingKey; -pub use super::parameters::key_switching::p_fail_2_minus_64::ks_pbs::PARAM_KEYSWITCH_1_1_KS_PBS_TO_2_2_KS_PBS; +pub use super::parameters::key_switching::p_fail_2_minus_64::ks_pbs::V0_11_PARAM_KEYSWITCH_1_1_KS_PBS_TO_2_2_KS_PBS; pub use super::parameters::{ CarryModulus, CiphertextModulus, ClassicPBSParameters, DecompositionBaseLog, DecompositionLevelCount, EncryptionKeyChoice, GlweDimension, LweDimension, MaxNoiseLevel,