From 1b5a2129e0ef762a5d42ea0181e9fd94f6506657 Mon Sep 17 00:00:00 2001 From: Janmajaya Mall Date: Tue, 23 Jul 2024 11:15:00 -0700 Subject: [PATCH] move num-bigint-dig to dev dependency --- Cargo.toml | 2 +- src/utils.rs | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index ea467f9..8e34081 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -14,11 +14,11 @@ num-traits = "0.2.18" rand = "0.8.5" rand_chacha = "0.3.1" rand_distr = "0.4.3" -num-bigint-dig = { version = "0.8.4", features = ["prime"] } [dev-dependencies] criterion = "0.5.1" rayon = "1.10.0" +num-bigint-dig = { version = "0.8.4", features = ["prime"] } [features] interactive_mp = [] diff --git a/src/utils.rs b/src/utils.rs index 3cac804..05216d8 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -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 // tests. +#[cfg(test)] fn is_probably_prime(candidate: u64) -> bool { 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$ /// - $\log{prime} = num_bits$ /// - `prime % modulo == 1` +#[cfg(test)] pub(crate) fn generate_prime(num_bits: usize, modulo: u64, upper_bound: u64) -> Option { let leading_zeros = (64 - num_bits) as u32;