Skip to content

Commit

Permalink
chore(shortint): new parameters for zkv1
Browse files Browse the repository at this point in the history
  • Loading branch information
nsarlin-zama committed Dec 17, 2024
1 parent 4e2db92 commit 535734e
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,35 @@ pub const V0_11_PARAM_PKE_MESSAGE_2_CARRY_2_KS_PBS_TUNIFORM_2M64:
}
.validate();

/// This legacy parameter set should be used with the v1 pke zk scheme of TFHE-rs v0.10 and lower
pub const V0_10_PARAM_PKE_MESSAGE_2_CARRY_2_KS_PBS_TUNIFORM_2M64:
/// This parameter set can be used with the v1 pke zk scheme on TFHE-rs v0.11 and after
/// Should be used with
/// V0_11_PARAM_KEYSWITCH_PKE_TO_SMALL_MESSAGE_2_CARRY_2_KS_PBS_TUNIFORM_2M64_ZKV1
pub const V0_11_PARAM_PKE_TO_SMALL_MESSAGE_2_CARRY_2_KS_PBS_TUNIFORM_2M64_ZKV1:
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();

/// This parameter set can be used with the v1 pke zk scheme on TFHE-rs v0.11 and after
/// Should be used with V0_11_PARAM_KEYSWITCH_PKE_TO_BIG_MESSAGE_2_CARRY_2_KS_PBS_TUNIFORM_2M64_ZKV1
pub const V0_11_PARAM_PKE_TO_BIG_MESSAGE_2_CARRY_2_KS_PBS_TUNIFORM_2M64_ZKV1:
CompactPublicKeyEncryptionParameters = CompactPublicKeyEncryptionParameters {
encryption_lwe_dimension: LweDimension(2048),
encryption_noise_distribution: DynamicDistribution::new_t_uniform(17),
message_modulus: MessageModulus(4),
carry_modulus: CarryModulus(4),
ciphertext_modulus: CiphertextModulus::new_native(),
expansion_kind: CompactCiphertextListExpansionKind::RequiresCasting,
}
.validate();

/// This legacy parameter set were used with the v1 pke zk scheme on TFHE-rs v0.10 and lower
pub const V0_10_PARAM_PKE_MESSAGE_2_CARRY_2_KS_PBS_TUNIFORM_2M64_ZKV1:
CompactPublicKeyEncryptionParameters = CompactPublicKeyEncryptionParameters {
encryption_lwe_dimension: LweDimension(1024),
encryption_noise_distribution: DynamicDistribution::new_t_uniform(42),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,24 @@ pub const V0_11_PARAM_KEYSWITCH_PKE_TO_BIG_MESSAGE_2_CARRY_2_KS_PBS_TUNIFORM_2M6
destination_key: EncryptionKeyChoice::Big,
};

// Parameters to keyswitch from input PKE 2_2 TUniform parameters to 2_2 KS_PBS compute parameters
// arriving under the small key, requires a PBS to get to the big key
pub const V0_11_PARAM_KEYSWITCH_PKE_TO_SMALL_MESSAGE_2_CARRY_2_KS_PBS_TUNIFORM_2M64_ZKV1:
ShortintKeySwitchingParameters = ShortintKeySwitchingParameters {
ks_level: DecompositionLevelCount(5),
ks_base_log: DecompositionBaseLog(3),
destination_key: EncryptionKeyChoice::Small,
};

// Parameters to keyswitch from input PKE 2_2 TUniform parameters to 2_2 KS_PBS compute parameters
// arriving under the big key, requires a PBS to get to the big key
pub const V0_11_PARAM_KEYSWITCH_PKE_TO_BIG_MESSAGE_2_CARRY_2_KS_PBS_TUNIFORM_2M64_ZKV1:
ShortintKeySwitchingParameters = ShortintKeySwitchingParameters {
ks_level: DecompositionLevelCount(1),
ks_base_log: DecompositionBaseLog(23),
destination_key: EncryptionKeyChoice::Big,
};

// These are the same parameters as they where defined in TFHE-rs 0.10 and before
pub const V0_10_PARAM_KEYSWITCH_MESSAGE_2_CARRY_2_KS_PBS_TUNIFORM_2M64:
ShortintKeySwitchingParameters =
Expand Down

0 comments on commit 535734e

Please sign in to comment.