-
Notifications
You must be signed in to change notification settings - Fork 163
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(shortint): move parameters set to their own directory
This is done to ease automatic parameters updates.
- Loading branch information
Showing
19 changed files
with
87 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
tfhe/src/shortint/parameters/compact_public_key_only/p_fail_2_minus_64/ks_pbs.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
use crate::core_crypto::commons::parameters::{ | ||
CiphertextModulus, DynamicDistribution, LweDimension, | ||
}; | ||
use crate::shortint::parameters::{ | ||
CarryModulus, CompactCiphertextListExpansionKind, CompactPublicKeyEncryptionParameters, | ||
MessageModulus, | ||
}; | ||
|
||
pub const PARAM_PKE_MESSAGE_2_CARRY_2_KS_PBS_TUNIFORM_2M64: CompactPublicKeyEncryptionParameters = | ||
CompactPublicKeyEncryptionParameters { | ||
encryption_lwe_dimension: LweDimension(1024), | ||
encryption_noise_distribution: DynamicDistribution::new_t_uniform(42), | ||
message_modulus: MessageModulus(4), | ||
carry_modulus: CarryModulus(4), | ||
ciphertext_modulus: CiphertextModulus::new_native(), | ||
expansion_kind: CompactCiphertextListExpansionKind::RequiresCasting, | ||
} | ||
.validate(); |
1 change: 1 addition & 0 deletions
1
tfhe/src/shortint/parameters/compact_public_key_only/p_fail_2_minus_64/mod.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
pub mod ks_pbs; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
pub mod p_fail_2_minus_64; | ||
|
||
use crate::shortint::backward_compatibility::parameters::key_switching::ShortintKeySwitchingParametersVersions; | ||
use crate::shortint::parameters::{ | ||
DecompositionBaseLog, DecompositionLevelCount, EncryptionKeyChoice, | ||
}; | ||
use serde::{Deserialize, Serialize}; | ||
use tfhe_versionable::Versionize; | ||
|
||
/// A set of cryptographic parameters for homomorphic Shortint key switching. | ||
#[derive(Copy, Clone, Debug, PartialEq, Eq, Serialize, Deserialize, Versionize)] | ||
#[versionize(ShortintKeySwitchingParametersVersions)] | ||
pub struct ShortintKeySwitchingParameters { | ||
pub ks_base_log: DecompositionBaseLog, | ||
pub ks_level: DecompositionLevelCount, | ||
pub destination_key: EncryptionKeyChoice, | ||
} | ||
|
||
impl ShortintKeySwitchingParameters { | ||
/// Constructs a new set of parameters for shortint key switching. | ||
/// | ||
/// # Warning | ||
/// | ||
/// Failing to fix the parameters properly would yield incorrect and insecure computation. | ||
/// Unless you are a cryptographer who really knows the impact of each of those parameters, you | ||
/// __must__ stick with the provided parameters (if any), which both offer correct results with | ||
/// 128 bits of security. | ||
pub fn new( | ||
ks_base_log: DecompositionBaseLog, | ||
ks_level: DecompositionLevelCount, | ||
destination_key: EncryptionKeyChoice, | ||
) -> Self { | ||
Self { | ||
ks_base_log, | ||
ks_level, | ||
destination_key, | ||
} | ||
} | ||
} |
36 changes: 1 addition & 35 deletions
36
.../src/shortint/parameters/key_switching.rs → ...key_switching/p_fail_2_minus_64/ks_pbs.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
tfhe/src/shortint/parameters/key_switching/p_fail_2_minus_64/mod.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
pub mod ks_pbs; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters