summaryrefslogtreecommitdiff
path: root/validat4.cpp
diff options
context:
space:
mode:
authorJeffrey Walton <noloader@gmail.com>2019-10-12 09:40:34 -0400
committerJeffrey Walton <noloader@gmail.com>2019-10-12 09:40:34 -0400
commitb91ce07bfbbf53d03ce002b08cf6ef3ea699af5a (patch)
treee37fd84eebb3e3739e7cbc5da468d45064c6774d /validat4.cpp
parentdd005c4bc3fb6db1ff98081c9901d79bcc086c48 (diff)
downloadcryptopp-git-b91ce07bfbbf53d03ce002b08cf6ef3ea699af5a.tar.gz
Revert BlowfishCompat changes (PR #877)
Diffstat (limited to 'validat4.cpp')
-rw-r--r--validat4.cpp63
1 files changed, 0 insertions, 63 deletions
diff --git a/validat4.cpp b/validat4.cpp
index 1dc52d45..18bd7f0a 100644
--- a/validat4.cpp
+++ b/validat4.cpp
@@ -1126,69 +1126,6 @@ bool ValidateBlowfish()
return pass1 && pass2 && pass3;
}
-bool ValidateBlowfishCompat()
-{
- std::cout << "\nBlowfishCompat validation suite running...\n\n";
- bool pass1 = true, pass2 = true, pass3 = true, fail;
-
- BlowfishCompatEncryption enc1; // 32 to 448-bits (4 to 56-bytes)
- pass1 = enc1.StaticGetValidKeyLength(3) == 4 && pass1;
- pass1 = enc1.StaticGetValidKeyLength(4) == 4 && pass1;
- pass1 = enc1.StaticGetValidKeyLength(5) == 5 && pass1;
- pass1 = enc1.StaticGetValidKeyLength(8) == 8 && pass1;
- pass1 = enc1.StaticGetValidKeyLength(16) == 16 && pass1;
- pass1 = enc1.StaticGetValidKeyLength(24) == 24 && pass1;
- pass1 = enc1.StaticGetValidKeyLength(32) == 32 && pass1;
- pass1 = enc1.StaticGetValidKeyLength(56) == 56 && pass1;
- pass1 = enc1.StaticGetValidKeyLength(57) == 56 && pass1;
- pass1 = enc1.StaticGetValidKeyLength(60) == 56 && pass1;
- pass1 = enc1.StaticGetValidKeyLength(64) == 56 && pass1;
- pass1 = enc1.StaticGetValidKeyLength(128) == 56 && pass1;
-
- BlowfishCompatDecryption dec1; // 32 to 448-bits (4 to 56-bytes)
- pass2 = dec1.StaticGetValidKeyLength(3) == 4 && pass2;
- pass2 = dec1.StaticGetValidKeyLength(4) == 4 && pass2;
- pass2 = dec1.StaticGetValidKeyLength(5) == 5 && pass2;
- pass2 = dec1.StaticGetValidKeyLength(8) == 8 && pass2;
- pass2 = dec1.StaticGetValidKeyLength(16) == 16 && pass2;
- pass2 = dec1.StaticGetValidKeyLength(24) == 24 && pass2;
- pass2 = dec1.StaticGetValidKeyLength(32) == 32 && pass2;
- pass2 = dec1.StaticGetValidKeyLength(56) == 56 && pass2;
- pass2 = dec1.StaticGetValidKeyLength(57) == 56 && pass2;
- pass2 = dec1.StaticGetValidKeyLength(60) == 56 && pass2;
- pass2 = dec1.StaticGetValidKeyLength(64) == 56 && pass2;
- pass2 = dec1.StaticGetValidKeyLength(128) == 56 && pass2;
- std::cout << (pass1 && pass2 ? "passed:" : "FAILED:") << " Algorithm key lengths\n";
-
- HexEncoder output(new FileSink(std::cout));
- const char *key[]={"abcdefghijklmnopqrstuvwxyz", "Who is John Galt?"};
- byte *plain[]={(byte *)"BLOWFISH", (byte *)"\xfe\xdc\xba\x98\x76\x54\x32\x10"};
- byte *cipher[]={(byte *)"\x82\x4d\x92\x0d\x00\x4d\x7e\xe3", (byte *)"\xd4\xf9\xb0\x06\xd3\x84\x92\x7e"};
- byte out[8], outplain[8];
-
- for (int i=0; i<2; i++)
- {
- ECB_Mode<BlowfishCompat>::Encryption enc2((byte *)key[i], strlen(key[i]));
- enc2.ProcessData(out, plain[i], 8);
- fail = memcmp(out, cipher[i], 8) != 0;
-
- ECB_Mode<BlowfishCompat>::Decryption dec2((byte *)key[i], strlen(key[i]));
- dec2.ProcessData(outplain, cipher[i], 8);
- fail = fail || memcmp(outplain, plain[i], 8);
- pass3 = pass3 && !fail;
-
- std::cout << (fail ? "FAILED " : "passed ");
- std::cout << '\"' << key[i] << '\"';
- for (int j=0; j<(signed int)(30-strlen(key[i])); j++)
- std::cout << ' ';
- output.Put(outplain, 8);
- std::cout << " ";
- output.Put(out, 8);
- std::cout << std::endl;
- }
- return pass1 && pass2 && pass3;
-}
-
bool ValidateThreeWay()
{
std::cout << "\n3-WAY validation suite running...\n\n";