pub struct PasswordMaker<'a, T: HasherList> { /* private fields */ }Expand description
A cached instance of validated PasswordMaker settings. See new for details.
Implementations§
Source§impl<'a, T: HasherList> PasswordMaker<'a, T>
impl<'a, T: HasherList> PasswordMaker<'a, T>
Sourcepub fn new(
hash_algorithm: HashAlgorithm,
use_leet: UseLeetWhenGenerating,
characters: &'a str,
username: &'a str,
modifier: &'a str,
password_length: usize,
prefix: &'a str,
suffix: &'a str,
) -> Result<Self, SettingsError>
pub fn new( hash_algorithm: HashAlgorithm, use_leet: UseLeetWhenGenerating, characters: &'a str, username: &'a str, modifier: &'a str, password_length: usize, prefix: &'a str, suffix: &'a str, ) -> Result<Self, SettingsError>
Validates user input and returns a PasswordMaker object if the input is valid.
hash_algorithm is a PasswordMaker Pro algorithm selection.
use_leet details when to use leet, if at all.
characters is the list of output password characters. Actually this is not true. It’s the list of grapheme clusters.
username is the “username” field of PasswordMaker Pro.
modifier is the “modifier” field of PasswordMaker Pro.
password_length is the desired password length to generate.
prefix is the prefix to which the password gets appended. Counts towards password_length.
suffix is the suffix appended to the password. Counts towards password_length.
§Errors
Fails if characters does not contain at least 2 grapheme clusters. Mapping to output happens by number system conversion, and a number system base 1 or base 0 does not make any sense.
Sourcepub fn generate(
&self,
data: String,
key: String,
) -> Result<String, GenerationError>
pub fn generate( &self, data: String, key: String, ) -> Result<String, GenerationError>
Generates a password for the given data and key.
data is the “text-to-use”, typically the output of UrlParsing.
key is the key, also known as “master password”.
§Errors
Fails if either of the parameters has zero-length.