move num-bigint-dig to dev dependency

This commit is contained in:
Janmajaya Mall
2024-07-23 11:15:00 -07:00
parent b3eb7e2109
commit 1b5a2129e0
2 changed files with 3 additions and 1 deletions

View File

@@ -14,11 +14,11 @@ num-traits = "0.2.18"
rand = "0.8.5" rand = "0.8.5"
rand_chacha = "0.3.1" rand_chacha = "0.3.1"
rand_distr = "0.4.3" rand_distr = "0.4.3"
num-bigint-dig = { version = "0.8.4", features = ["prime"] }
[dev-dependencies] [dev-dependencies]
criterion = "0.5.1" criterion = "0.5.1"
rayon = "1.10.0" rayon = "1.10.0"
num-bigint-dig = { version = "0.8.4", features = ["prime"] }
[features] [features]
interactive_mp = [] interactive_mp = []

View File

@@ -111,6 +111,7 @@ pub fn fill_random_ternary_secret_with_hamming_weight<
// TODO (Jay): this is only a workaround. Add a propoer way to perform primality // TODO (Jay): this is only a workaround. Add a propoer way to perform primality
// tests. // tests.
#[cfg(test)]
fn is_probably_prime(candidate: u64) -> bool { fn is_probably_prime(candidate: u64) -> bool {
num_bigint_dig::prime::probably_prime(&num_bigint_dig::BigUint::from(candidate), 0) num_bigint_dig::prime::probably_prime(&num_bigint_dig::BigUint::from(candidate), 0)
} }
@@ -119,6 +120,7 @@ fn is_probably_prime(candidate: u64) -> bool {
/// - $prime \lt upper_bound$ /// - $prime \lt upper_bound$
/// - $\log{prime} = num_bits$ /// - $\log{prime} = num_bits$
/// - `prime % modulo == 1` /// - `prime % modulo == 1`
#[cfg(test)]
pub(crate) fn generate_prime(num_bits: usize, modulo: u64, upper_bound: u64) -> Option<u64> { pub(crate) fn generate_prime(num_bits: usize, modulo: u64, upper_bound: u64) -> Option<u64> {
let leading_zeros = (64 - num_bits) as u32; let leading_zeros = (64 - num_bits) as u32;