With pwg
you can easily create random passwords. You can specify how long the password should be and whether it should also contain capital letters, numbers and special characters.
Add this to your Cargo.toml
:
[dependencies]
pwg = "0.1"
Add this to your *.rs
file:
extern crate pwg;
Now you can proceed as follows:
/*
A password with 20 characters is generated.
It contains lowercase letters (default),
uppercase letters, numbers and symbols.
*/
let password = pwg::new(20, &["uppercase", "numbers", "symbols"]);
println!("{}", password);
/* A password with 10 characters (lower case letters) is generated. */
let password = pwg::new(10, &[]);
println!("{}", password);
/*
A password with 20 characters is generated.
It contains lowercase letters (default) and uppercase letters.
*/
let password = pwg::new(20, &["uppercase"]);
println!("{}", password);
/*
A password with 20 characters is generated.
It contains lowercase letters (default) and numbers.
*/
let password = pwg::new(20, &["numbers"]);
println!("{}", password);
/*
A password with 20 characters is generated.
It contains lowercase letters (default) and symbols.
*/
let password = pwg::new(20, &["symbols"]);
println!("{}", password);
A detailed changelog is available.
If you have questions or problems with pwg
, then we are happy to respond to GitHub issues or come chat with us on our Gitter channel - if you have any questions about the project, or just want to say hi!
pwg
is distributed under the terms of the MIT license.
See LICENSE for details.