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 from
  • domain - Domain / URL to generate password for
  • secret - Secret added to the master password
  • length - Length of generated password, min: 4, max: 24
  • hash_rounds - Number of hash rounds
  • hash_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);