Documentation ¶
Index ¶
Constants ¶
const BitsPerWord = wordlist4096.BitsPerWord
BitsPerWord is the number of bits of information represented by each word in the wordlist.
Variables ¶
var ErrInvalidIndex = errors.New("word index value is too large")
ErrInvalidIndex is returned when given a word index which cannot be represented in at most BitsPerWord bits.
var ErrInvalidWord = errors.New("word is not a member of the wordlist")
ErrInvalidWord is returned when a word is passed to DecodeWords which is not a member of the wordlist.
Functions ¶
func DecodeIndices ¶
DecodeIndices decodes the given wordlist indices into an integer representation.
Returns ErrInvalidIndex if any of the given indices are outside the domain of the word list size.
func DecodeWords ¶
DecodeWords decodes the given set of words into their indices in the wordlist. The words can be in either upper or lower case.
Returns ErrInvalidWord if any of the words are not members of the wordlist.
func EncodeToIndices ¶
EncodeToIndices encodes the given payload as a slice of word indices.
The bitSize parameter determines how many words will be used to encode the payload, which is calculated as:
nWords = ceil(bitSize / BitsPerWord)
bitSize does not necessarily have to be evenly divisible by BitsPerWord. If there is any unused space, it will be encoded at the leading edge of the resulting slice of indices.
func EncodeToWords ¶
EncodeToWords encodes the given word indices as a series of words from the wordlist. The returned phrase is encoded with lower-case characters.
Returns ErrInvalidIndex if any of the given indices are outside the domain of the word list.
Types ¶
This section is empty.