fn decrypt(_opts: &Opts, args: &Decrypt) {
    let mut tt = TimeTaker::new();
    tt.take("start");
    let input: String = (*args.input).parse().unwrap();
    let output: String = (*args.output).parse().unwrap();
    let dictionary = args.dictionary.clone();
    let data = fs::read(input).expect("Failed to read input file!");

    if let Some(dict) = dictionary {
        tt.take("decryption-start");
        if let Some(dec_data) = decrypt_with_dictionary_file(dict, &data) {
            fs::write(output, &dec_data).expect("Failed to write output file!");
            println!(
                "Decryption took {:.2}s",
                tt.since("decryption-start").unwrap().as_secs_f32()
            );
            println!("Finished {:.2}s!", tt.since("start").unwrap().as_secs_f32());
        } else {
            println!("\nNo password found!");
            println!("Finished {:.2}s!", tt.since("start").unwrap().as_secs_f32());
        }
    } else {
        println!("No checksum file given!");
    }
}
/// Decrypts a des encrypted file.
/// Brute forces if the dictionary argument was passed
Decrypts a des encrypted file.
Brute forces if the dictionary argument was passed
Decrypts a des encrypted file . Brute forces if the dictionary argument was passed
fn decrypt(_opts: &Opts, args: &Decrypt) {
    let mut tt = TimeTaker::new();
    tt.take("start");
    let input: String = (*args.input).parse().unwrap();
    let output: String = (*args.output).parse().unwrap();
    let dictionary = args.dictionary.clone();
    let data = fs::read(input).expect("Failed to read input file!");
    if let Some(dict) = dictionary {
        tt.take("decryption-start");
        if let Some(dec_data) = decrypt_with_dictionary_file(dict, &data) {
            fs::write(output, &dec_data).expect("Failed to write output file!");
            println!(
                "Decryption took {:.2}s",
                tt.since("decryption-start").unwrap().as_secs_f32()
            );
            println!("Finished {:.2}s!", tt.since("start").unwrap().as_secs_f32());
        } else {
            println!("\nNo password found!");
            println!("Finished {:.2}s!", tt.since("start").unwrap().as_secs_f32());
        }
    } else {
        println!("No checksum file given!");
    }
}
fn decrypt ( _opts : & Opts , args : & Decrypt ) { let mut tt = TimeTaker :: new ( ) ; tt . take ( " " ) ; let input : String = ( * args . input ) . parse ( ) . unwrap ( ) ; let output : String = ( * args . output ) . parse ( ) . unwrap ( ) ; let dictionary = args . dictionary . clone ( ) ; let data = fs :: read ( input ) . expect ( " " ) ; if let Some ( dict ) = dictionary { tt . take ( " " ) ; if let Some ( dec_data ) = decrypt_with_dictionary_file ( dict , & data ) { fs :: write ( output , & dec_data ) . expect ( " " ) ; println ! ( " " tt since ( " " ) unwrap ( ) as_secs_f32 ( ) ) ; println ! ( " " tt since ( " " ) unwrap ( ) as_secs_f32 ( ) ) ; } else { println ! ( " \n " ) ; println ! ( " " tt since ( " " ) unwrap ( ) as_secs_f32 ( ) ) ; } } else { println ! ( " " ) ; } }
Decrypts a des encrypted file.
Decrypts a des encrypted file .
_opts
&Opts
args
&Decrypt