Merge remote-tracking branch 'github/master'

master
trivernis 5 years ago
commit 14a05da97f

@ -5,6 +5,7 @@ use des::Des;
use rand::Rng;
use rayon::prelude::*;
use std::sync::Mutex;
use std::time::Instant;
type DesCfb = Cfb<Des>;
@ -37,6 +38,7 @@ 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);
@ -49,7 +51,11 @@ pub fn decrypt_with_dictionary(
};
});
if let Some((pw, _key)) = pass {
println!("\nPassword found: {}", pw);
println!(
"\nPassword found in {:.2}s: {}",
start.elapsed().as_secs_f32(),
pw
);
let decry = decrypted.lock().unwrap();
if let Some(decrypted_data) = (*decry).clone() {
return Some(decrypted_data);

Loading…
Cancel
Save