This crate provides useful tools to generate multiple readable passwords, as well as analyze and score them.
PasswordGenerator
can be used for generating passwords which consist optional numbers, lowercase letters, uppercase letters and symbols.
```rust extern crate passwords;
use passwords::PasswordGenerator;
let pg = PasswordGenerator { length: 8, numbers: true, lowercaseletters: true, uppercaseletters: true, symbols: true, strict: true, };
println!("{}", pg.generate_one().unwrap()); println!("{:?}", pg.generate(5).unwrap()); ```
To enable hashing functions, you need to enable the crypto feature.
toml
[dependencies.passwords]
version = "*"
features = ["crypto"]
Then, bcrypt
, identify_bcrypt
and gen_salt
functions are available.
```rust extern crate passwords;
let salt = passwords::gensalt(); let hashed = passwords::bcrypt(10, &salt, "password").unwrap(); assert!(passwords::identifybcrypt(10, &salt, "password", &hashed).unwrap()); ```
https://crates.io/crates/passwords
https://docs.rs/passwords