Changeset View
Changeset View
Standalone View
Standalone View
src/test/key_tests.cpp
Show First 20 Lines • Show All 373 Lines • ▼ Show 20 Lines | |||||
} | } | ||||
BOOST_AUTO_TEST_CASE(key_key_negation) { | BOOST_AUTO_TEST_CASE(key_key_negation) { | ||||
// create a dummy hash for signature comparison | // create a dummy hash for signature comparison | ||||
uint8_t rnd[8]; | uint8_t rnd[8]; | ||||
std::string str = "Bitcoin key verification\n"; | std::string str = "Bitcoin key verification\n"; | ||||
GetRandBytes(rnd, sizeof(rnd)); | GetRandBytes(rnd, sizeof(rnd)); | ||||
uint256 hash; | uint256 hash; | ||||
CHash256() | CHash256().Write(MakeUCharSpan(str)).Write(rnd).Finalize(hash.begin()); | ||||
.Write((uint8_t *)str.data(), str.size()) | |||||
.Write(rnd, sizeof(rnd)) | |||||
.Finalize(hash.begin()); | |||||
// import the static test key | // import the static test key | ||||
CKey key = DecodeSecret(strSecret1C); | CKey key = DecodeSecret(strSecret1C); | ||||
// create a signature | // create a signature | ||||
std::vector<uint8_t> vch_sig; | std::vector<uint8_t> vch_sig; | ||||
std::vector<uint8_t> vch_sig_cmp; | std::vector<uint8_t> vch_sig_cmp; | ||||
key.SignECDSA(hash, vch_sig); | key.SignECDSA(hash, vch_sig); | ||||
Show All 17 Lines |