use happy_cracking::crypto::primes;
use std::sync::mpsc;
use std::thread;
use std::time::Duration;
#[test]
fn test_pollard_rho_dos_prevention() {
let n = 166153499473114561646947067345511247u128;
let (tx, rx) = mpsc::channel();
thread::spawn(move || {
let factors = primes::factorize(n);
tx.send(factors).unwrap();
});
match rx.recv_timeout(Duration::from_secs(2)) {
Ok(_) => println!("Factorization completed successfully."),
Err(_) => panic!("Factorization timed out! Potential DoS vulnerability."),
}
}