aboutsummaryrefslogtreecommitdiff
path: root/src/crypto/electrum-words.cpp
diff options
context:
space:
mode:
authorThomas Winget <tewinget@gmail.com>2014-06-06 14:18:11 -0400
committerThomas Winget <tewinget@gmail.com>2014-06-12 19:05:51 -0400
commitd22e458c6c680f4b5dcf56a58a37a5f79912e65c (patch)
tree05a150051c892903c87d913dddf321996c035079 /src/crypto/electrum-words.cpp
parentmissing '.at' on two map calls. built on some machines, very strange... (diff)
downloadmonero-d22e458c6c680f4b5dcf56a58a37a5f79912e65c.tar.xz
builds, but doesn't link. other than that, electrum-style recovery implemented (but not tested\!)
Diffstat (limited to 'src/crypto/electrum-words.cpp')
-rw-r--r--src/crypto/electrum-words.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/crypto/electrum-words.cpp b/src/crypto/electrum-words.cpp
index b4580e01f..048aa403f 100644
--- a/src/crypto/electrum-words.cpp
+++ b/src/crypto/electrum-words.cpp
@@ -36,7 +36,7 @@ namespace crypto
// error on non-compliant word list
if (wlist.size() != 12 && wlist.size() != 24) return false;
- for (int i=0; i < wlist.size() / 3; i++)
+ for (unsigned int i=0; i < wlist.size() / 3; i++)
{
uint32_t val;
uint32_t w1, w2, w3;
@@ -55,12 +55,12 @@ 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
}
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
}
return true;
@@ -78,13 +78,13 @@ namespace crypto
if (sizeof(src.data) % 4 != 0) return false;
// 8 bytes -> 3 words. 8 digits base 16 -> 3 digits base 1626
- for (int i=0; i < sizeof(src.data)/4; i++, words += ' ')
+ for (unsigned int i=0; i < sizeof(src.data)/4; i++, words += ' ')
{
uint32_t w1, w2, w3;
uint32_t val;
- memcpy(val, src, 4);
+ memcpy(&val, &src.data, 4);
w1 = val % n;
w2 = ((val / n) + w1) % n;