Function rustgenpass::generate_with_config
source · [−]pub fn generate_with_config<S: Into<String>>(
password: S,
domain: S,
config: GenerateConfig
) -> String
Expand description
Generate a hashed password with given options.
Arguments
password
- Master password to generate hashed password fromdomain
- Domain / URL to generate password forsecret
- Secret added to the master passwordlength
- Length of generated password, min: 4, max: 24hash_rounds
- Number of hash roundshash_algorithm
- Hashing algorithm to use
Examples
use rustgenpass::{generate_with_config, GenerateConfig, HashAlgorithm};
let config = GenerateConfig {
secret: Some("secret".to_string()),
length: 10,
hash_rounds: 10,
hash_algorithm: HashAlgorithm::MD5,
};
let generated_password = generate_with_config("masterpassword", "example.com", config);
assert_eq!("fqProIJ38f", generated_password);