Browse Source

move num-bigint-dig to dev dependency

par-agg-key-shares
Janmajaya Mall 9 months ago
parent
commit
1b5a2129e0
2 changed files with 3 additions and 1 deletions
  1. +1
    -1
      Cargo.toml
  2. +2
    -0
      src/utils.rs

+ 1
- 1
Cargo.toml

@ -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 = []

+ 2
- 0
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 // 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;

Loading…
Cancel
Save