This commit is contained in:
Peter Conrad 2015-03-11 11:07:14 +01:00
parent 66e6475600
commit 1de9a3ba87
2 changed files with 7 additions and 1 deletions

View file

@ -49,7 +49,10 @@ namespace fc { namespace ecc {
fc::sha256 private_key::get_secret()const fc::sha256 private_key::get_secret()const
{ {
FC_ASSERT( my->_key != nullptr ); if( !my->_key )
{
return fc::sha256();
}
return *my->_key; return *my->_key;
} }

View file

@ -68,6 +68,8 @@ int main( int argc, char** argv )
interop_file(argv[2]); interop_file(argv[2]);
} }
fc::ecc::private_key nullkey;
for( uint32_t i = 0; i < 3000; ++ i ) for( uint32_t i = 0; i < 3000; ++ i )
{ {
try { try {
@ -76,6 +78,7 @@ int main( int argc, char** argv )
std::string pass(argv[1]); std::string pass(argv[1]);
fc::sha256 h = fc::sha256::hash( pass.c_str(), pass.size() ); fc::sha256 h = fc::sha256::hash( pass.c_str(), pass.size() );
fc::ecc::private_key priv = fc::ecc::private_key::generate_from_seed(h); fc::ecc::private_key priv = fc::ecc::private_key::generate_from_seed(h);
FC_ASSERT( nullkey != priv );
interop_do(priv.get_secret()); interop_do(priv.get_secret());
fc::ecc::public_key pub = priv.get_public_key(); fc::ecc::public_key pub = priv.get_public_key();
interop_do(pub.serialize()); interop_do(pub.serialize());