Skip to content

Instantly share code, notes, and snippets.

@bonega
Created March 20, 2021 09:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bonega/b69fe306638bb8ae3e72225aa65851a0 to your computer and use it in GitHub Desktop.
Save bonega/b69fe306638bb8ae3e72225aa65851a0 to your computer and use it in GitHub Desktop.
use std::io;
mod xorshift;
mod password;
fn main() {
let length = loop {
let mut length_buffer = String::new();
println!("Enter the length of wannabe password: ");
io::stdin()
.read_line(&mut length_buffer)
.expect("Failed to read the line");
match length_buffer.trim().parse() {
Ok(n) => {
break n;
}
Err(..) => {
println!("Not a valid integer!");
}
}
};
println!("Enter the characters you want to exclude: ");
let mut exclude = String::new();
io::stdin()
.read_line(&mut exclude)
.expect("Failed to read the line");
let excluded: Vec<_> = exclude.chars().collect();
println!("{}", password::rand_pass(length, &excluded));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment