Skip to content

Commit

Permalink
remove crossbeam because it is not in the hotpath anymore
Browse files Browse the repository at this point in the history
  • Loading branch information
agourlay committed Aug 3, 2024
1 parent 65adbd5 commit 318b505
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 16 deletions.
10 changes: 0 additions & 10 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ zip = "2.1.6"
pbkdf2 = "0.12.2" # parallel version did not help the performance
hmac = { version = "0.12.1", features = ["reset"] }
sha1 = "0.10.6"
crossbeam-channel = "0.5.13"
clap = { version = "4.5.13", features = ["cargo"] }
indicatif = "0.17.8"
thiserror = "1.0.63"
Expand Down
6 changes: 3 additions & 3 deletions src/password_finder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ use crate::password_reader::password_reader_count;
use crate::password_worker::password_checker;
use crate::zip_utils::validate_zip;
use crate::{GenPasswords, PasswordFile};
use crossbeam_channel::{Receiver, Sender};
use indicatif::{ProgressBar, ProgressDrawTarget, ProgressStyle};
use std::path::{Path, PathBuf};
use std::sync::atomic::{AtomicBool, Ordering};
use std::sync::mpsc::{sync_channel, Receiver, SyncSender};
use std::sync::Arc;

#[derive(Clone, Debug)]
Expand Down Expand Up @@ -49,8 +49,8 @@ pub fn password_finder(
.println("Archive encrypted with ZipCrypto - expect a much faster throughput"),
}

let (send_found_password, receive_found_password): (Sender<String>, Receiver<String>) =
crossbeam_channel::bounded(1);
let (send_found_password, receive_found_password): (SyncSender<String>, Receiver<String>) =
sync_channel(1);

// stop signals to shut down threads
let stop_workers_signal = Arc::new(AtomicBool::new(false));
Expand Down
4 changes: 2 additions & 2 deletions src/password_worker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ use crate::password_finder::Strategy;
use crate::password_gen::password_generator_iter;
use crate::password_reader::password_dictionary_reader_iter;
use crate::zip_utils::AesInfo;
use crossbeam_channel::Sender;
use hmac::Hmac;
use indicatif::ProgressBar;
use sha1::Sha1;
use std::io::{BufReader, Cursor, Read, Seek};
use std::path::Path;
use std::sync::atomic::{AtomicBool, Ordering};
use std::sync::mpsc::SyncSender;
use std::sync::Arc;
use std::thread::JoinHandle;
use std::{fs, thread};
Expand Down Expand Up @@ -47,7 +47,7 @@ pub fn password_checker(
file_number: usize,
aes_info: Option<AesInfo>,
strategy: Strategy,
send_password_found: Sender<String>,
send_password_found: SyncSender<String>,
stop_signal: Arc<AtomicBool>,
progress_bar: ProgressBar,
) -> JoinHandle<()> {
Expand Down

0 comments on commit 318b505

Please sign in to comment.