Untie the dependencies between NewcoinAddress and BIGNUM.

This commit is contained in:
JoelKatz
2012-06-08 20:47:05 -07:00
parent 51d0a44cdd
commit f92d5b6ceb
4 changed files with 76 additions and 13 deletions

View File

@@ -503,12 +503,33 @@ BIGNUM* NewcoinAddress::getFamilyGeneratorBN() const
throw std::runtime_error(str(boost::format("bad source: %d") % int(nVersion)));
}
assert(vchData.size() <= (256 / 8));
BIGNUM* ret = BN_bin2bn(&vchData[0], vchData.size(), NULL);
assert(ret);
return ret;
}
uint256 NewcoinAddress::getFamilyGeneratorU() const
{
switch (nVersion) {
case VER_NONE:
throw std::runtime_error("unset source");
case VER_FAMILY_GENERATOR:
// Do nothing.
break;
default:
throw std::runtime_error(str(boost::format("bad source: %d") % int(nVersion)));
}
assert(vchData.size() <= (256 / 8));
uint256 ret;
memcpy(ret.begin() + (ret.size() - vchData.size()), &vchData[0], vchData.size());
return ret;
}
const std::vector<unsigned char>& NewcoinAddress::getFamilyGenerator() const
{
switch (nVersion) {