Crate dictionary_1024
source ·Expand description
dictionary-1024 is a mnemonic dictionary that can be used with cryptographic seeds or to transform other binary data. The dictionary has 1024 words in it, which means you can pack exactly 10 bits of entropy into each word. The dictionary has the property that every word can be uniquely determined by its first 3 characters. The API is designed such that only the first 3 characters of a word are considered when doing a lookup in the dictionary.
This is a helper library that is used in downstream crates such as seed15 and mnemonic-16bit.
let word = dictionary_1024::word_at_index(5); // "ace"
let index = dictionary_1024::index_of_word(&word); // 5
Constants
DICTIONARY contains the dictionary-1024 wordlist. This const is here for documentation
purposes. Use the methods for accessing the dictionary instead.
DICTIONARY_UNIQUE_PREFIX defines the number of characters that are guaranteed to be unique for
each word in the dictionary. The seed code only looks at these three characters when parsing a
word, allowing users to make substitutions for words if they prefer or find it easier to
memorize.
Functions
index_of_word will return the index of the provided word within the dictionary, using only the
first three characters of the word to find a match. If no match is found, an error will be
returned.
word_at_index will return the word with the provided index. If the index is greater than 1023,
the program will panic.
words_match will return ‘true’ if the two provided words represent the same word in the
dictionary, false otherwise. If the words do not appear in the dictionary at all, false will
also be returned.