MCPcopy Create free account
hub / github.com/ElementsProject/elements / Damage

Method Damage

src/test/pmt_tests.cpp:22–26  ·  view source on GitHub ↗

flip one bit in one of the hashes - this should break the authentication

Source from the content-addressed store, hash-verified

20public:
21 // flip one bit in one of the hashes - this should break the authentication
22 void Damage() {
23 unsigned int n = InsecureRandRange(vHash.size());
24 int bit = InsecureRandBits(8);
25 *(vHash[n].begin() + (bit>>3)) ^= 1<<(bit&7);
26 }
27};
28
29BOOST_FIXTURE_TEST_SUITE(pmt_tests, BasicTestingSetup)

Callers 1

BOOST_AUTO_TEST_CASEFunction · 0.80

Calls 4

InsecureRandRangeFunction · 0.85
InsecureRandBitsFunction · 0.85
sizeMethod · 0.45
beginMethod · 0.45

Tested by

no test coverage detected