MCPcopy Create free account
hub / github.com/LUX-Core/lux / HashModuleTest

Function HashModuleTest

src/cryptopp/validat3.cpp:66–93  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

64};
65
66bool HashModuleTest(HashTransformation &md, const HashTestTuple *testSet, unsigned int testSetSize)
67{
68 bool pass=true, fail;
69 SecByteBlock digest(md.DigestSize());
70
71 // Coverity finding, also see http://stackoverflow.com/a/34509163/608639.
72 StreamState ss(cout);
73 for (unsigned int i=0; i<testSetSize; i++)
74 {
75 unsigned j;
76
77 for (j=0; j<testSet[i].repeatTimes; j++)
78 md.Update(testSet[i].input, testSet[i].inputLen);
79 md.Final(digest);
80 fail = !!memcmp(digest, testSet[i].output, md.DigestSize()) != 0;
81 pass = pass && !fail;
82
83 cout << (fail ? "FAILED " : "passed ");
84 for (j=0; j<md.DigestSize(); j++)
85 cout << setw(2) << setfill('0') << hex << (int)digest[j];
86 cout << " \"" << (char *)testSet[i].input << '\"';
87 if (testSet[i].repeatTimes != 1)
88 cout << " repeated " << dec << testSet[i].repeatTimes << " times";
89 cout << endl;
90 }
91
92 return pass;
93}
94
95bool ValidateCRC32()
96{

Callers 9

ValidateCRC32Function · 0.85
ValidateCRC32CFunction · 0.85
ValidateAdler32Function · 0.85
ValidateMD2Function · 0.85
ValidateMD4Function · 0.85
ValidateMD5Function · 0.85
ValidateTigerFunction · 0.85
ValidateRIPEMDFunction · 0.85
ValidateHAVALFunction · 0.85

Calls 2

DigestSizeMethod · 0.45
UpdateMethod · 0.45

Tested by

no test coverage detected