Crate yapg[−][src]
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
CharsetSpec | Represents a specification for a charset |
PasswordGenerator | Encapsulates RNG and set of characters. See crate documentation for more. |
Enums
CharsetName | 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 ‘“’. |