Remove timing report from decryption since it only reports the time it took for one chunk

master
trivernis 5 years ago
parent 14a05da97f
commit 96da5e629d

@ -5,7 +5,6 @@ use des::Des;
use rand::Rng;
use rayon::prelude::*;
use std::sync::Mutex;
use std::time::Instant;
type DesCfb = Cfb<Des>;
@ -38,7 +37,6 @@ pub fn decrypt_with_dictionary(
checksum: &[u8],
) -> Option<Vec<u8>> {
let decrypted = Mutex::<Option<Vec<u8>>>::new(None);
let start = Instant::now();
let pass = dict.par_iter().find_first(|(_pw, key)| {
let decrypted_data = decrypt_data(&data, key);
let decr_check = sha_checksum(&decrypted_data);
@ -51,11 +49,7 @@ pub fn decrypt_with_dictionary(
};
});
if let Some((pw, _key)) = pass {
println!(
"\nPassword found in {:.2}s: {}",
start.elapsed().as_secs_f32(),
pw
);
println!("\nPassword found: {}", pw);
let decry = decrypted.lock().unwrap();
if let Some(decrypted_data) = (*decry).clone() {
return Some(decrypted_data);

Loading…
Cancel
Save