powlib/examples/simple_pow.rs

19 lines
620 B
Rust
Raw Normal View History

2023-08-01 06:06:02 +02:00
2023-08-02 12:21:49 +02:00
use std::time::Instant;
2023-08-02 12:45:06 +02:00
use powlib::{self, gen::{POWRange, POWChallenge}, hash::hash_num, num::Num, solver::POWSolver};
2023-08-01 06:06:02 +02:00
fn main() {
2023-08-02 12:21:49 +02:00
{
let num = Num::new(473823);
let time = Instant::now();
hash_num(num);
println!("Simple hash of {} took {} millis", u128::from(num), time.elapsed().as_millis());
}
{
let time = Instant::now();
let challenge = POWChallenge::make(POWRange::new(0, 20480));
2023-08-02 12:45:06 +02:00
let mut solver = POWSolver::new(challenge);
println!("Solvling {} took {} seconds", solver.solve_signle().unwrap(), time.elapsed().as_secs_f32());
2023-08-02 12:21:49 +02:00
}
2023-08-01 06:06:02 +02:00
}