arnaucube
arnaucube/phantom-zonePublic Self-hosted repository
move num-bigint-dig to dev dependency
Janmajaya Mall janmajayamall@protonmail.com
Tue, 23 Jul 2024 11:15:00 -0700
commit

1b5a2129e0ef762a5d42ea0181e9fd94f6506657

parent

b3eb7e2109d439e0048960b63f0aa3182c0e8485

2 files changed, 3 insertions(+), 1 deletions(-)

jump to
M Cargo.toml → 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 = []
M src/utils.rs → src/utils.rs

@@ -111,6 +111,7 @@ }

// 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 @@ /// Finds prime that satisfy

/// - $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<u64> { let leading_zeros = (64 - num_bits) as u32;