This is a way to do deterministic keys that fits in better.

This commit is contained in:
JoelKatz
2011-12-17 21:12:05 -08:00
parent aad4696a46
commit 80b2ac8ee2
5 changed files with 29 additions and 123 deletions

11
key.h
View File

@@ -86,6 +86,8 @@ protected:
EC_KEY* pkey;
bool fSet;
static EC_KEY* GenerateDeterministicKey(const uint256& base, uint32 n, bool private_key);
public:
typedef boost::shared_ptr<CKey> pointer;
@@ -115,11 +117,20 @@ public:
return (*this);
}
~CKey()
{
EC_KEY_free(pkey);
}
CKey(const uint256& base, uint32 seq, bool private_key) : fSet(true)
{
pkey=GenerateDeterministicKey(base, seq, private_key);
}
static uint256 GetBaseFromString(const std::string& base);
static uint256 GetRandomBase(void);
bool IsNull() const
{
return !fSet;