pub struct Passgen {
pub enab_letters: bool,
pub enab_u_letters: bool,
pub enab_num: bool,
pub enab_spec_symbs: bool,
pub enab_strong_usab: bool,
pub custom_charset: &'static str,
}Expand description
Main Passgen structure.
§Examples
You can create a token that includes lowercase letters and numbers up to 30 characters long:
use passgenlib::Passgen;
let result = Passgen::new().set_enabled_letters(true).set_enabled_numbers(true).generate(30);You can create a default strong password including all literals, numbers and symbols:
use passgenlib::Passgen;
let result = Passgen::default().generate(12);You can create a strong and usability password.
Including all characters, but
the first position in the password is a capital or small letter,
the last position is the symbol.
🔸 Excluded ambiguous characters "0oOiIlL1".
use passgenlib::Passgen;
let result = Passgen::default_strong_and_usab().generate(8);You can create a set from your custom charset:
use passgenlib::Passgen;
let result = Passgen::new().set_custom_charset("bla@.321").generate(8);Fields§
§enab_letters: boolPresence of letters.
enab_u_letters: boolPresence of a capital letters.
enab_num: boolPresence of numeric characters.
enab_spec_symbs: boolPresence of special characters.
enab_strong_usab: boolIncluding all characters, but
the first position in the password is a capital or small letter,
the last position is the symbol. Excluded ambiguous characters "0oOiIlL1".
⚠️ If this rule is enabled, the other consistency rules of the generating are not taken,
except for a rule custom_charset.
custom_charset: &'static strUser defined character set.
⚠️This set of characters will exclude all other rules except for a rule "enab_strong_usab".
⚙️If "enab_strong_usab" on too then you can generate combined strong and usability result with custom charset.
Implementations§
Source§impl Passgen
impl Passgen
Sourcepub fn default_strong_and_usab() -> Passgen
pub fn default_strong_and_usab() -> Passgen
Set default ruleset of Passgen to “Strong & usability”.
Including all characters, but
the first position in the password is a capital or small letter,
the last position is the symbol. Excluded ambiguous characters "0oOiIlL1".
⚠️ If this rule is enabled, the other consistency rules of the generating are not taken,
except for a rule custom_charset.
Sourcepub fn set_enabled_letters(&mut self, value: bool) -> &mut Passgen
pub fn set_enabled_letters(&mut self, value: bool) -> &mut Passgen
Set value of the field enab_letters for Passgen.
Sourcepub fn set_enabled_uppercase_letters(&mut self, value: bool) -> &mut Passgen
pub fn set_enabled_uppercase_letters(&mut self, value: bool) -> &mut Passgen
Set value of the field enab_u_letters for Passgen.
Sourcepub fn set_enabled_numbers(&mut self, value: bool) -> &mut Passgen
pub fn set_enabled_numbers(&mut self, value: bool) -> &mut Passgen
Set value of the field enab_num for Passgen.
Sourcepub fn set_enabled_spec_symbols(&mut self, value: bool) -> &mut Passgen
pub fn set_enabled_spec_symbols(&mut self, value: bool) -> &mut Passgen
Set value of the field enab_spec_symbs for Passgen.
Sourcepub fn set_enabled_strong_usab(&mut self, value: bool) -> &mut Passgen
pub fn set_enabled_strong_usab(&mut self, value: bool) -> &mut Passgen
Set value of the field enab_strong_usab for Passgen.
Including all characters, but
the first position in the password is a capital or small letter,
the last position is the symbol. Excluded ambiguous characters "0oOiIlL1".
⚠️ If this rule is enabled, the other consistency rules of the generating are not taken,
except for a rule custom_charset.
Sourcepub fn set_custom_charset(&mut self, value: &'static str) -> &mut Passgen
pub fn set_custom_charset(&mut self, value: &'static str) -> &mut Passgen
Set user defined character set. You can use any Unicode characters and emoji. For example: abcABC123⭕➖❎⚫⬛n₼⁂🙂
⚠️This set of characters will exclude all other rules except for a rule "enab_strong_usab".
⚙️If "enab_strong_usab" on too then you can generate combined strong and usability result with custom charset.