Expand description
§Generate passphrase
This crate allows to generate passphrases easily and securely.
Choose the source of words to use in passphrases: either use built-in dictionaries or provide your own dictionary!
By default, the crate does not come with any built-in dictionaries in order to keep the crate small. Built-in dictionaries can be added through the usage of features in the crate.
§Custom dictionary
let dictionary = &["hello", "bonjour", "hola", "ciao"];
// Example of generated passphrase: "bonjour-hello"
let passphrase = gen_passphrase::generate(&[dictionary], 2, Some("-"));
§Built-in dictionary
To enable built-in dictionaries, you need to enable the feature corresponding to the requested dictionary.
Dictionary | Feature to enable |
---|---|
Eff Short Wordlist 2 | eff_short_2 |
Eff Short Wordlist 1 | eff_short_1 |
Eff Large Wordlist | eff_large |
For example, to use the dictionary eff_short_2, add this in your Cargo.toml
:
[dependencies.gen_passphrase]
version = "*"
features = ["eff_short_2"]
Then, use the dictionary like you would use a custom dictionary:
use gen_passphrase::dictionary::EFF_SHORT_2;
let passphrase = gen_passphrase::generate(&[EFF_SHORT_2], 1, None);
Modules§
- dictionary
- Built-in dictionaries, ready to be used
Functions§
- generate
- Generate a passphrase