aboutsummaryrefslogtreecommitdiff
path: root/src/crypto/electrum-words.cpp
diff options
context:
space:
mode:
authorThomas Winget <tewinget@gmail.com>2014-06-06 16:31:04 -0400
committerThomas Winget <tewinget@gmail.com>2014-06-12 19:05:51 -0400
commit8bc032ed092e65e944e9032bc6042ae118346fa9 (patch)
tree0f7b23b07b8d87a806ebbcffb68f5c6ffb56db6f /src/crypto/electrum-words.cpp
parentfixed some pointer- and loop-based derps (diff)
downloadmonero-8bc032ed092e65e944e9032bc6042ae118346fa9.tar.xz
more pointer-based derp
Diffstat (limited to 'src/crypto/electrum-words.cpp')
-rw-r--r--src/crypto/electrum-words.cpp13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/crypto/electrum-words.cpp b/src/crypto/electrum-words.cpp
index 5489d5034..a11d287b2 100644
--- a/src/crypto/electrum-words.cpp
+++ b/src/crypto/electrum-words.cpp
@@ -5,6 +5,7 @@
*/
#include <string>
+#include <cassert>
#include <map>
#include <cstdint>
#include <vector>
@@ -55,14 +56,22 @@ namespace crypto
val = w1 + n * ((w2 - w1) % n) + n * n * ((w3 - w2) % n);
- memcpy(&dst.data + i * 4, &val, 4); // copy 4 bytes to position
+ memcpy(dst.data + i * 4, &val, 4); // copy 4 bytes to position
}
+ std::string wlist_copy = words;
if (wlist.size() == 12)
{
- memcpy(&dst.data, &dst.data + 16, 16); // if electrum 12-word seed, duplicate
+ memcpy(dst.data, dst.data + 16, 16); // if electrum 12-word seed, duplicate
+ wlist_copy += ' ';
+ wlist_copy += words;
}
+ std::string back_to_words;
+ bytes_to_words(dst, back_to_words);
+
+ assert(wlist_copy == back_to_words); // sanity check
+
return true;
}