aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Eilertsen <haraldei@anduin.net>2018-03-26 15:57:48 +0200
committerHarald Eilertsen <haraldei@anduin.net>2018-04-04 16:05:29 +0200
commit12e4c2ffd92329c965f12064bbfa3de0fc82d750 (patch)
tree72e32fbff07a73b5310aa8e89095252d3399fe84
parent14fdf11a35687889b88c244408a3ad62c2f21729 (diff)
downloadcheckpw-12e4c2ffd92329c965f12064bbfa3de0fc82d750.tar.gz
checkpw-12e4c2ffd92329c965f12064bbfa3de0fc82d750.tar.bz2
checkpw-12e4c2ffd92329c965f12064bbfa3de0fc82d750.zip
Throttle checking multiple passwords.
-rw-r--r--src/main.rs11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/main.rs b/src/main.rs
index 05dd895..48b8e4c 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -16,7 +16,7 @@
extern crate reqwest;
extern crate ring;
-use std::env;
+use std::{env, thread, time};
use std::error::Error;
use ring::digest;
@@ -131,7 +131,16 @@ fn main() {
return;
}
+ let mut first_round = true;
+
for pw in passwords {
+ if first_round {
+ first_round = false;
+ }
+ else {
+ thread::sleep(time::Duration::new(1, 0));
+ }
+
match check(Password::new(&pw)) {
Err(e) => println!("{}", e.description()),
Ok(num) => {