Expand description

An implementation in Rust of the SuperGenPass utility.

Hash a master password into unique, complex passwords specific for each website.

Examples

With defaults

use rustgenpass::generate;
let generated_password = generate("masterpassword", "example.com");
assert_eq!("jHMOHn7bRs", generated_password);

With configuration matching defaults

use rustgenpass::{ get_hostname, generate_with_config, HashAlgorithm };
let domain = get_hostname("example.com", false, false).unwrap();
let generated_password = generate_with_config("masterpassword", "example.com", None, 10, 10, HashAlgorithm::MD5);
assert_eq!("jHMOHn7bRs", generated_password);

With configuration matching defaults

use rustgenpass::{ get_hostname, generate_with_config, HashAlgorithm };
let domain = get_hostname("example.com", false, false).unwrap();
let generated_password = generate_with_config("masterpassword", "example.com", Some("secret".to_string()), 24, 50, HashAlgorithm::MD5);
assert_eq!("izHhm22SMfZeg8Q3t2BrZgAA", generated_password);

Full example with hostname isolation from URL

use rustgenpass::{ get_hostname, generate_with_config, HashAlgorithm };
let domain = get_hostname("https://www.example.com/foo/bar.html", false, false).unwrap();
let generated_password = generate_with_config("masterpassword", &domain, Some("secret".to_string()), 24, 50, HashAlgorithm::MD5);
assert_eq!("izHhm22SMfZeg8Q3t2BrZgAA", generated_password);

Full example using SHA512 hashing

use rustgenpass::{ get_hostname, generate_with_config, HashAlgorithm };
let domain = get_hostname("https://www.example.com/foo/bar.html", false, false).unwrap();
let generated_password = generate_with_config("masterpassword", &domain, Some("secret".to_string()), 24, 50, HashAlgorithm::SHA512);
assert_eq!("awqhRUhYQSj48FIp678e84LO", generated_password);

Structs

Options parsed from command line used by the binary

Enums

Supported hashing algorithms

Functions

Generate a hashed password with default options.
Generate a hashed password with given options.
Isolate the domain name of a URL.