Equity
Bitcoin Protocol Library
Public Types | Public Member Functions | Static Public Attributes | List of all members
Equity::Mnemonic Class Reference

Mnemonic Generator. More...

#include <Mnemonic.h>

Public Types

enum  Language { ENGLISH }
 Supported languages.
 
using WordList = std::vector< std::string >
 A list of words.
 

Public Member Functions

 Mnemonic (WordList const &words)
 
 Mnemonic (uint8_t const *entropy, size_t size, Language language=ENGLISH)
 
 Mnemonic (std::vector< uint8_t > const &entropy, Language language=ENGLISH)
 
std::vector< uint8_t > seed (char const *password="") const
 Returns the 512-bit seed computed from the mnemonic sentence. More...
 
std::vector< uint8_t > entropy () const
 Returns the original entropy data used to generate the mnemonic.
 
std::string sentence () const
 Returns the mnemonic sentence. More...
 
WordList words () const
 Returns the mnemonic words.
 
bool isValid () const
 Returns true if the Mnemonic is valid.
 
WordList suggestions (std::string const &word, size_t max=0) const
 Returns a list of the possible words given a partial word hint. More...
 

Static Public Attributes

static size_t const NUM_LANGUAGES = Language::ENGLISH + 1
 Number of supported languages.
 

Detailed Description

Mnemonic Generator.

This class implements BIP-39.

See also
https://github.com/bitcoin/bips/blob/master/bip-0039.mediawiki

Constructor & Destructor Documentation

Equity::Mnemonic::Mnemonic ( WordList const &  words)
explicit
Parameters
wordsmnemonic sentence
Note
If the mnemonic is not valid, invalid size or checksum, then isValid() will return false.
Equity::Mnemonic::Mnemonic ( uint8_t const *  entropy,
size_t  size,
Language  language = ENGLISH 
)
Parameters
entropyentropy source for the mnemonic
sizesize of entropy data
languageword list language (default: English)
Note
The entropy data does not include a checksum
The size of the entropy must be a multiple of 4. If not, isValid() will return false.
Equity::Mnemonic::Mnemonic ( std::vector< uint8_t > const &  entropy,
Language  language = ENGLISH 
)
inlineexplicit
Parameters
entropyentropy source
languageword list language (default: English)
Note
The entropy data does not include a checksum
The size of the entropy must be a multiple of 4. If not, isValid() will return false.

Member Function Documentation

std::vector< uint8_t > Equity::Mnemonic::seed ( char const *  password = "") const

Returns the 512-bit seed computed from the mnemonic sentence.

Parameters
passwordpassword used to generate the seed (default: "")
Returns
A 512-bit seed value
std::string Equity::Mnemonic::sentence ( ) const

Returns the mnemonic sentence.

The sentence is simply a string containing the words in order separated by a spaces.

Mnemonic::WordList Equity::Mnemonic::suggestions ( std::string const &  word,
size_t  max = 0 
) const

Returns a list of the possible words given a partial word hint.

Parameters
wordpartial word to test
maxmaximum number of suggestions to return
Returns
list of suggestions

The documentation for this class was generated from the following files: