Struct chbs::word::WordList[][src]

pub struct WordList { /* fields omitted */ }

A wordlist.

To load a built-in wordlist, checkout the methods on this struct prefixed with builtin_.
The default wordlist loaded when using default() uses builtin_eff_large().

A loaded fixed wordlist which may be used as word provider for passphrase generation by constructing a sampler using sampler.

It is highly recommended that the worlist contains at least 7776 (65) words to provide enough entropy when uniformly sampling words from it.

Methods

impl WordList
[src]

Construct a new word list with the given words.

To load a wordlist from a file, use load instead.
To load a built-in wordlist, use the methods on this struct prefixed with builtin_.

Panics

This panics if the given set of words is empty.

Load a wordlist from a file.

This loads a wordlist from a file at the given path, and constructs a WordList.

  • Words are splitted by any whitespace (including newlines), see char::is_whitespace
  • It assumes any non-whitespace character is part of a word
  • Whitespaces are omitted the final wordlist
  • Emtpy items are omitted
  • The file must not include dice numbers

For wordlists that include dice numbers, the load_diced method may be used instead.
If words are separated in a different manner, manually load each word and use the new constructor instead.

An error is returned if loading the wordlist failed, or if the loaded file didn't contain any words.

File examples

abacus abdomen abdominal abide abiding

or

abacus
abdomen

Load a diced wordlist from a file.

This loads a diced wordlist from a file at the given path, and constructs a WordList. Many diceware wordlists include dice numbers for each word, these should be omitted when using this crate. This method helps with that.

  • Words are splitted by the newline character (\n).
  • Only the last word on each line is kept, terminated by any whitespace, see char::is_whitespace
  • It assumes any non-whitespace character is part of a word
  • Prefixed words do not have to be dice numbers
  • Lines having a single word with no dice number prefix are included
  • Emtpy lines are omitted

For wordlists that do not include dice numbers, the the regular load method instead.
If words are separated in a different manner, manually load each word and use the new constructor instead.

An error is returned if loading the wordlist failed, or if the loaded file didn't contain any words.

File examples

11111 abacus
11112 abdomen
11113 abdominal

or

#1 (1,1,1,1,2)    abacus
#2 (1,1,1,1,2)    abdomen

Construct wordlist from built-in EFF large.

Use the built-in EFF large list of words, and construct a wordlist from it. This is based on BUILTIN_EFF_LARGE.

Construct wordlist from built-in EFF short.

Use the built-in EFF short list of words, and construct a wordlist from it. This is based on BUILTIN_EFF_SHORT.

Note: this wordlist is considered short, as it only contains 1296 (64) words. The list has an entropy of about 10.3 bits when uniformly sampling words from it.
It is recommended to use a larger wordlist such as builtin_eff_large.

Construct wordlist from built-in EFF general short.

Use the built-in EFF general short list of words, and construct a wordlist from it. This is based on BUILTIN_EFF_GENERAL_SHORT.

Note: this wordlist is considered short, as it only contains 1296 (64) words. The list has an entropy of about 10.3 bits when uniformly sampling words from it.
It is recommended to use a larger wordlist such as builtin_eff_large.

Important traits for WordSampler

Build a sampler for this wordlist.

The word sampler may be used to pull any number of random words from the wordlist for passphrase generation.

Trait Implementations

impl Clone for WordList
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl Debug for WordList
[src]

Formats the value using the given formatter. Read more

impl Default for WordList
[src]

Construct a default wordlist.

This uses the built-in EFF large wordlist, which can be constructed with WordList::builtin_eff_large().

Auto Trait Implementations

impl Send for WordList

impl Sync for WordList