mirror of
https://github.com/monero-project/monero.git
synced 2025-10-12 23:30:40 -04:00
Informs about old style mnemonics from older wallet and provides a new one. CMakeLists.txt update.
This commit is contained in:
parent
262e155bab
commit
91aa25e055
8 changed files with 7792 additions and 6 deletions
|
@ -50,6 +50,8 @@ namespace
|
|||
std::map<std::string,uint32_t> words_map;
|
||||
std::vector<std::string> words_array;
|
||||
|
||||
bool is_old_style_mnemonics = false;
|
||||
|
||||
const std::string WORD_LISTS_DIRECTORY = "wordlists";
|
||||
const std::string LANGUAGES_DIRECTORY = "languages";
|
||||
const std::string OLD_WORD_FILE = "old-word-list";
|
||||
|
@ -103,10 +105,12 @@ namespace crypto
|
|||
if (old_word_list)
|
||||
{
|
||||
create_data_structures(WORD_LISTS_DIRECTORY + '/' + OLD_WORD_FILE);
|
||||
is_old_style_mnemonics = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
create_data_structures(WORD_LISTS_DIRECTORY + '/' + LANGUAGES_DIRECTORY + '/' + language);
|
||||
is_old_style_mnemonics = false;
|
||||
}
|
||||
if (num_words == 0)
|
||||
{
|
||||
|
@ -115,6 +119,14 @@ namespace crypto
|
|||
}
|
||||
}
|
||||
|
||||
bool get_is_old_style_mnemonics()
|
||||
{
|
||||
if (is_uninitialized())
|
||||
{
|
||||
throw std::runtime_error("ElectrumWords hasn't been initialized with a word list yet.");
|
||||
}
|
||||
return is_old_style_mnemonics;
|
||||
}
|
||||
/* convert words to bytes, 3 words -> 4 bytes
|
||||
* returns:
|
||||
* false if not a multiple of 3 words, or if a words is not in the
|
||||
|
|
|
@ -45,5 +45,6 @@ namespace crypto
|
|||
bool words_to_bytes(const std::string& words, crypto::secret_key& dst);
|
||||
bool bytes_to_words(const crypto::secret_key& src, std::string& words);
|
||||
void get_language_list(std::vector<std::string> &languages);
|
||||
bool get_is_old_style_mnemonics();
|
||||
}
|
||||
}
|
||||
|
|
2048
src/mnemonics/wordlists/languages/english
Normal file
2048
src/mnemonics/wordlists/languages/english
Normal file
File diff suppressed because it is too large
Load diff
2048
src/mnemonics/wordlists/languages/japanese
Normal file
2048
src/mnemonics/wordlists/languages/japanese
Normal file
File diff suppressed because it is too large
Load diff
1626
src/mnemonics/wordlists/languages/portuguese
Normal file
1626
src/mnemonics/wordlists/languages/portuguese
Normal file
File diff suppressed because it is too large
Load diff
2048
src/mnemonics/wordlists/languages/spanish
Normal file
2048
src/mnemonics/wordlists/languages/spanish
Normal file
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue