Some missing pieces for deterministic wallets.

This commit is contained in:
JoelKatz
2011-12-12 15:52:13 -08:00
parent 7253073cbd
commit 8c677fd421
3 changed files with 7 additions and 1 deletions

View File

@@ -10,7 +10,7 @@
DetKeySet::DetKeySet(const std::string& phrase) DetKeySet::DetKeySet(const std::string& phrase)
{ {
Serializer s; Serializer s;
s.addRaw(phrase); s.addRaw((const void *) phrase.c_str(), phrase.length());
mBase=s.getSHA512Half(); mBase=s.getSHA512Half();
s.secureErase(); s.secureErase();
} }

View File

@@ -57,6 +57,11 @@ int Serializer::addRaw(const std::vector<unsigned char> &vector)
return ret; return ret;
} }
int Serializer::addRaw(const void *ptr, int len)
{
mData.insert(mData.end(), (const char *) ptr, ((const char *)ptr)+len);
}
bool Serializer::get16(uint16& o, int offset) const bool Serializer::get16(uint16& o, int offset) const
{ {
if((offset+2)>mData.size()) return false; if((offset+2)>mData.size()) return false;

View File

@@ -27,6 +27,7 @@ class Serializer
int add160(const uint160&); // account names, hankos int add160(const uint160&); // account names, hankos
int add256(const uint256&); // transaction and ledger hashes int add256(const uint256&); // transaction and ledger hashes
int addRaw(const std::vector<unsigned char> &vector); int addRaw(const std::vector<unsigned char> &vector);
int addRaw(const void *ptr, int len);
// disassemble functions // disassemble functions
bool get16(uint16&, int offset) const; bool get16(uint16&, int offset) const;