Modify "Algorithm key lengths" output format

pull/131/merge
Jeffrey Walton 2016-09-05 09:37:51 -04:00
parent 0bc85ca42f
commit 88bc98fa25
1 changed files with 8 additions and 10 deletions

View File

@ -2007,7 +2007,6 @@ bool ValidateRijndael()
pass1 = enc.StaticGetValidKeyLength(32) == 32 && pass1; pass1 = enc.StaticGetValidKeyLength(32) == 32 && pass1;
pass1 = enc.StaticGetValidKeyLength(64) == 32 && pass1; pass1 = enc.StaticGetValidKeyLength(64) == 32 && pass1;
pass1 = enc.StaticGetValidKeyLength(128) == 32 && pass1; pass1 = enc.StaticGetValidKeyLength(128) == 32 && pass1;
cout << (pass1 ? "passed:" : "FAILED:") << " RijndaelEncryption StaticGetValidKeyLength\n";
RijndaelDecryption dec; RijndaelDecryption dec;
pass2 = dec.StaticGetValidKeyLength(8) == 16 && pass2; pass2 = dec.StaticGetValidKeyLength(8) == 16 && pass2;
@ -2016,7 +2015,7 @@ bool ValidateRijndael()
pass2 = dec.StaticGetValidKeyLength(32) == 32 && pass2; pass2 = dec.StaticGetValidKeyLength(32) == 32 && pass2;
pass2 = dec.StaticGetValidKeyLength(64) == 32 && pass2; pass2 = dec.StaticGetValidKeyLength(64) == 32 && pass2;
pass2 = dec.StaticGetValidKeyLength(128) == 32 && pass2; pass2 = dec.StaticGetValidKeyLength(128) == 32 && pass2;
cout << (pass2 ? "passed:" : "FAILED:") << " RijndaelDecryption StaticGetValidKeyLength\n"; cout << (pass1 && pass2 ? "passed:" : "FAILED:") << " Algorithm key lengths\n";
FileSource valdata(CRYPTOPP_DATA_DIR "TestData/rijndael.dat", true, new HexDecoder); FileSource valdata(CRYPTOPP_DATA_DIR "TestData/rijndael.dat", true, new HexDecoder);
pass3 = BlockTransformationTest(FixedRoundsCipherFactory<RijndaelEncryption, RijndaelDecryption>(16), valdata, 4) && pass3; pass3 = BlockTransformationTest(FixedRoundsCipherFactory<RijndaelEncryption, RijndaelDecryption>(16), valdata, 4) && pass3;
@ -2032,22 +2031,21 @@ bool ValidateTwofish()
bool pass1 = true, pass2 = true, pass3 = true; bool pass1 = true, pass2 = true, pass3 = true;
TwofishEncryption enc; TwofishEncryption enc;
// pass1 = enc.StaticGetValidKeyLength(8) == 16 && pass1; pass1 = enc.StaticGetValidKeyLength(8) == 16 && pass1;
pass1 = enc.StaticGetValidKeyLength(16) == 16 && pass1; pass1 = enc.StaticGetValidKeyLength(16) == 16 && pass1;
pass1 = enc.StaticGetValidKeyLength(24) == 24 && pass1; pass1 = enc.StaticGetValidKeyLength(24) == 24 && pass1;
pass1 = enc.StaticGetValidKeyLength(32) == 32 && pass1; pass1 = enc.StaticGetValidKeyLength(32) == 32 && pass1;
// pass1 = enc.StaticGetValidKeyLength(64) == 32 && pass1; pass1 = enc.StaticGetValidKeyLength(64) == 32 && pass1;
// pass1 = enc.StaticGetValidKeyLength(128) == 32 && pass1; pass1 = enc.StaticGetValidKeyLength(128) == 32 && pass1;
cout << (pass1 ? "passed:" : "FAILED:") << " TwofishEncryption StaticGetValidKeyLength\n";
TwofishDecryption dec; TwofishDecryption dec;
// pass2 = dec.StaticGetValidKeyLength(8) == 16 && pass2; pass2 = dec.StaticGetValidKeyLength(8) == 16 && pass2;
pass2 = dec.StaticGetValidKeyLength(16) == 16 && pass2; pass2 = dec.StaticGetValidKeyLength(16) == 16 && pass2;
pass2 = dec.StaticGetValidKeyLength(24) == 24 && pass2; pass2 = dec.StaticGetValidKeyLength(24) == 24 && pass2;
pass2 = dec.StaticGetValidKeyLength(32) == 32 && pass2; pass2 = dec.StaticGetValidKeyLength(32) == 32 && pass2;
// pass2 = dec.StaticGetValidKeyLength(64) == 32 && pass2; pass2 = dec.StaticGetValidKeyLength(64) == 32 && pass2;
// pass2 = dec.StaticGetValidKeyLength(128) == 32 && pass2; pass2 = dec.StaticGetValidKeyLength(128) == 32 && pass2;
cout << (pass2 ? "passed:" : "FAILED:") << " TwofishDecryption StaticGetValidKeyLength\n"; cout << (pass1 && pass2 ? "passed:" : "FAILED:") << " Algorithm key lengths\n";
FileSource valdata(CRYPTOPP_DATA_DIR "TestData/twofishv.dat", true, new HexDecoder); FileSource valdata(CRYPTOPP_DATA_DIR "TestData/twofishv.dat", true, new HexDecoder);
pass3 = BlockTransformationTest(FixedRoundsCipherFactory<TwofishEncryption, TwofishDecryption>(16), valdata, 4) && pass3; pass3 = BlockTransformationTest(FixedRoundsCipherFactory<TwofishEncryption, TwofishDecryption>(16), valdata, 4) && pass3;