Electroneum
Functions | Variables
crypto::ElectrumWords Namespace Reference

Mnemonic seed word generation and wallet restoration helper functions. More...

Functions

bool words_to_bytes (std::string words, crypto::secret_key &dst, std::string &language_name)
 Converts seed words to bytes (secret key). More...
 
bool bytes_to_words (const crypto::secret_key &src, std::string &words, const std::string &language_name)
 Converts bytes (secret key) to seed words. More...
 
void get_language_list (std::vector< std::string > &languages)
 Gets a list of seed languages that are supported. More...
 
bool get_is_old_style_seed (std::string seed)
 Tells if the seed passed is an old style seed or not. More...
 

Variables

const int seed_length = 24
 
const std::string old_language_name = "EnglishOld"
 

Detailed Description

Mnemonic seed word generation and wallet restoration helper functions.

Function Documentation

◆ bytes_to_words()

bool crypto::ElectrumWords::bytes_to_words ( const crypto::secret_key src,
std::string &  words,
const std::string &  language_name 
)

Converts bytes (secret key) to seed words.

Parameters
srcSecret key
wordsSpace delimited concatenated words get written here.
language_nameSeed language name
Returns
true if successful false if not. Unsuccessful if wrong key size.

◆ get_is_old_style_seed()

bool crypto::ElectrumWords::get_is_old_style_seed ( std::string  seed)

Tells if the seed passed is an old style seed or not.

Parameters
seedThe seed to check (a space delimited concatenated word list)
Returns
true if the seed passed is a old style seed false if not.

◆ get_language_list()

void crypto::ElectrumWords::get_language_list ( std::vector< std::string > &  languages)

Gets a list of seed languages that are supported.

Parameters
languagesThe vector is set to the list of languages.
languagesA vector is set to the list of languages.

◆ words_to_bytes()

bool crypto::ElectrumWords::words_to_bytes ( std::string  words,
crypto::secret_key dst,
std::string &  language_name 
)

Converts seed words to bytes (secret key).

Parameters
wordsString containing the words separated by spaces.
dstTo put the secret key restored from the words.
language_nameLanguage of the seed as found gets written here.
Returns
false if not a multiple of 3 words, or if word is not in the words list

Variable Documentation

◆ old_language_name

const std::string crypto::ElectrumWords::old_language_name = "EnglishOld"

◆ seed_length

const int crypto::ElectrumWords::seed_length = 24