diff options
| author | Riccardo Spagni <ric@spagni.net> | 2015-06-21 15:43:30 +0200 |
|---|---|---|
| committer | Riccardo Spagni <ric@spagni.net> | 2015-06-21 16:00:19 +0200 |
| commit | eeff247bf15e2e9406776f8e441d1986c133466a (patch) | |
| tree | e86993c095e77deff2b498cba34094c68913cbfd /src/mnemonics/electrum-words.cpp | |
| parent | 1720affbd628db150a67e7ef09817f3f8707ee55 (diff) | |
| parent | ea33cadebf93995c86559f233d4c79d65ff1f860 (diff) | |
| download | monzero-core-eeff247bf15e2e9406776f8e441d1986c133466a.tar.gz monzero-core-eeff247bf15e2e9406776f8e441d1986c133466a.tar.xz monzero-core-eeff247bf15e2e9406776f8e441d1986c133466a.zip | |
Merge pull request #326
ea33cad mnemonics: fix prefix extraction with non ASCII text (moneromooo-monero)
Diffstat (limited to 'src/mnemonics/electrum-words.cpp')
| -rw-r--r-- | src/mnemonics/electrum-words.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/mnemonics/electrum-words.cpp b/src/mnemonics/electrum-words.cpp index 590320550..9c42c5792 100644 --- a/src/mnemonics/electrum-words.cpp +++ b/src/mnemonics/electrum-words.cpp @@ -99,7 +99,7 @@ namespace { if (has_checksum) { - trimmed_word = it2->substr(0, (*it1)->get_unique_prefix_length()); + trimmed_word = Language::utf8prefix(*it2, (*it1)->get_unique_prefix_length()); // Use the trimmed words and map if (trimmed_word_map.count(trimmed_word) == 0) { @@ -144,7 +144,7 @@ namespace { if (it->length() > unique_prefix_length) { - trimmed_words += it->substr(0, unique_prefix_length); + trimmed_words += Language::utf8prefix(*it, unique_prefix_length); } else { @@ -170,9 +170,9 @@ namespace std::string checksum = seed[create_checksum_index(seed, unique_prefix_length)]; - std::string trimmed_checksum = checksum.length() > unique_prefix_length ? checksum.substr(0, unique_prefix_length) : + std::string trimmed_checksum = checksum.length() > unique_prefix_length ? Language::utf8prefix(checksum, unique_prefix_length) : checksum; - std::string trimmed_last_word = last_word.length() > unique_prefix_length ? last_word.substr(0, unique_prefix_length) : + std::string trimmed_last_word = last_word.length() > unique_prefix_length ? Language::utf8prefix(last_word, unique_prefix_length) : last_word; return trimmed_checksum == trimmed_last_word; } |
