Add setFamilySeedGeneric to take any text.

This commit is contained in:
Arthur Britto
2012-05-12 21:52:43 -07:00
parent 87d9d59f11
commit 0dbd07445c
2 changed files with 19 additions and 0 deletions

View File

@@ -562,6 +562,24 @@ bool NewcoinAddress::setFamilySeed(const std::string& strSeed)
return SetString(strSeed.c_str(), VER_FAMILY_SEED);
}
void NewcoinAddress::setFamilySeedGeneric(const std::string& strText)
{
if (setFamilySeed(strText))
{
std::cerr << "Recognized seed." << std::endl;
}
else if (1 == setFamilySeed1751(strText))
{
std::cerr << "Recognized 1751 seed." << std::endl;
}
else
{
std::cerr << "Creating seed from pass phrase." << std::endl;
setFamilySeed(CKey::PassPhraseToKey(strText));
}
}
void NewcoinAddress::setFamilySeed(uint128 hash128) {
SetData(VER_FAMILY_SEED, hash128.begin(), 16);
}

View File

@@ -117,6 +117,7 @@ public:
bool setFamilySeed(const std::string& strSeed);
int setFamilySeed1751(const std::string& strHuman1751);
void setFamilySeedGeneric(const std::string& strText);
void setFamilySeed(uint128 hash128);
void setFamilySeedRandom();
};