int main(int argc, char** argv)
{
+ // test HashSumValue which doesn't calculate but just stores sums
+ {
+ string md5sum = argv[2];
+ MD5SumValue md5(md5sum);
+ equals(md5.Value(), md5sum);
+ }
+ {
+ string sha1sum = argv[3];
+ SHA1SumValue sha1(sha1sum);
+ equals(sha1.Value(), sha1sum);
+ }
+ {
+ string sha2sum = argv[4];
+ SHA256SumValue sha2(sha2sum);
+ equals(sha2.Value(), sha2sum);
+ }
+ {
+ string sha2sum = argv[5];
+ SHA512SumValue sha2(sha2sum);
+ equals(sha2.Value(), sha2sum);
+ }
+
// From FIPS PUB 180-1
Test<SHA1Summation>("","da39a3ee5e6b4b0d3255bfef95601890afd80709");
Test<SHA1Summation>("abc","a9993e364706816aba3e25717850c26c9cd0d89d");
equals(argv[5], sha2.Result().Value());
}
fclose(fd);
+
+ // test HashString code
+ {
+ HashString sha2("SHA256", argv[4]);
+ equals(sha2.VerifyFile(argv[1]), true);
+ }
+ {
+ HashString sha2("SHA512", argv[5]);
+ equals(sha2.VerifyFile(argv[1]), true);
+ }
+ {
+ HashString sha2("SHA256:" + std::string(argv[4]));
+ equals(sha2.VerifyFile(argv[1]), true);
+ }
+
return 0;
}