Expand description
This crate is for generating random passphrases from characters.
The heavy lifting is done by PasswordGenerator
structs, which needs to be
mutable because of the encapsulated
underlying RNG.
§Examples
let mut pwg = yapg::PasswordGenerator::from("ab").length(10);
let pass = pwg.generate();
assert_eq!(pass.len(), 10);
assert_eq!(pass.to_ascii_lowercase(), pass);
assert_eq!(pwg.entropy(), 10);
let pass_vec = pwg.length(2).generate_n(2);
assert_eq!(pass_vec.len(), 2);
let permutations = vec![
"aa".to_string(),
"ab".to_string(),
"ba".to_string(),
"bb".to_string(),
];
assert!(permutations.contains(&pass_vec[0]));
assert!(permutations.contains(&pass_vec[1]));
§Future ideas
- creating passphrases from syllables or words
Structs§
- Charset
Spec - Represents a specification for a charset
- Password
Generator - Encapsulates RNG and set of characters. See crate documentation for more.
Enums§
- Charset
Name - Translation layer between chars (e.g. for cli flags) and the actual character sets.
Statics§
- CHARSET_
ALPHA_ LOWER - Contains all lower-case latin letters
- CHARSET_
ALPHA_ UPPER - Contains all upper-case latin letters.
- CHARSET_
DELIM - Contains ‘(’, ‘)’, ‘[’, ‘]’, ‘{’, and ‘}’.
- CHARSET_
MATHOPS - Contains ‘+’, ‘-’, ‘*’, ‘/’, ‘=’, ‘<’, and ‘>’.
- CHARSET_
MISC_ SPECIAL - Contains ‘#’, ‘@’, ‘$’, ‘%’, ‘&’, ‘|’, ‘\’, ‘~’, ‘^’, ‘_’, and ‘`’.
- CHARSET_
NUMERIC - Contains all digits.
- CHARSET_
PROSE - Contains ‘.’, ‘:’, ‘,’, ‘;’, ‘!’, ‘?’, ’ ’, ‘'’, and ‘“’.