Skip to content

Commit

Permalink
Move UniformSieve to hazmat
Browse files Browse the repository at this point in the history
  • Loading branch information
dvdplm committed Nov 25, 2024
1 parent 40fa8f1 commit 55deec8
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 8 deletions.
2 changes: 1 addition & 1 deletion benches/bench.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ fn make_presieved_num<const L: usize>(rng: &mut impl CryptoRngCore) -> Odd<Uint<
}

fn bench_uniform_sieve(c: &mut Criterion) {
use crypto_primes::uniform_sieve::UniformSieve;
use crypto_primes::hazmat::UniformSieve;
let mut group = c.benchmark_group("Uniform sieve");

let mut rng = make_rng();
Expand Down
2 changes: 1 addition & 1 deletion examples/distribution.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use crypto_bigint::{FixedInteger, NonZero, RandomBits, RandomMod};
use crypto_primes::uniform_sieve::UniformSieve;
use crypto_primes::hazmat::UniformSieve;
use statrs::distribution::{ChiSquared, ContinuousCDF};

/// Chi-squared statistical test for some collection of primes.
Expand Down
3 changes: 2 additions & 1 deletion src/hazmat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,13 @@ pub(crate) mod primes;
#[cfg(test)]
pub(crate) mod pseudoprimes;
mod sieve;
mod uniform_sieve;

pub use lucas::{lucas_test, AStarBase, BruteForceBase, LucasBase, LucasCheck, SelfridgeBase};
pub use miller_rabin::MillerRabin;

pub use sieve::{random_odd_integer, Sieve};

pub use uniform_sieve::UniformSieve;
/// Possible results of various primality tests.
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
pub enum Primality {
Expand Down
File renamed without changes.
3 changes: 0 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,3 @@ pub use presets::{par_generate_prime_with_rng, par_generate_safe_prime_with_rng}
#[cfg(test)]
/// Statistical helpers.
pub mod stat_utils;

/// TODO docs
pub mod uniform_sieve;
5 changes: 3 additions & 2 deletions src/stat_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ use crypto_bigint::{Bounded, Constants, Integer, NonZero, RandomBits, RandomMod}
use statrs::distribution::{ChiSquared, ContinuousCDF};
use tracing::{debug, info};

use crate::uniform_sieve::UniformSieve;
use crate::hazmat::UniformSieve;

/// Calculate the distribution quality for a prime generator.
/// Calculate the distribution quality for a prime generator. In this example the we work with the
/// [`UniformSieve`].
pub fn check_distribution_quality<T>()
where
T: Integer + Copy + Bounded + Constants + RandomBits + RandomMod + UniformSieve<T>,
Expand Down

0 comments on commit 55deec8

Please sign in to comment.