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

Function BlockTransformationTest

src/cryptopp/validat1.cpp:1162–1194  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1160};
1161
1162bool BlockTransformationTest(const CipherFactory &cg, BufferedTransformation &valdata, unsigned int tuples = 0xffff)
1163{
1164 HexEncoder output(new FileSink(cout));
1165 SecByteBlock plain(cg.BlockSize()), cipher(cg.BlockSize()), out(cg.BlockSize()), outplain(cg.BlockSize());
1166 SecByteBlock key(cg.KeyLength());
1167 bool pass=true, fail;
1168
1169 while (valdata.MaxRetrievable() && tuples--)
1170 {
1171 valdata.Get(key, cg.KeyLength());
1172 valdata.Get(plain, cg.BlockSize());
1173 valdata.Get(cipher, cg.BlockSize());
1174
1175 member_ptr<BlockTransformation> transE(cg.NewEncryption(key));
1176 transE->ProcessBlock(plain, out);
1177 fail = memcmp(out, cipher, cg.BlockSize()) != 0;
1178
1179 member_ptr<BlockTransformation> transD(cg.NewDecryption(key));
1180 transD->ProcessBlock(out, outplain);
1181 fail=fail || memcmp(outplain, plain, cg.BlockSize());
1182
1183 pass = pass && !fail;
1184
1185 cout << (fail ? "FAILED " : "passed ");
1186 output.Put(key, cg.KeyLength());
1187 cout << " ";
1188 output.Put(outplain, cg.BlockSize());
1189 cout << " ";
1190 output.Put(out, cg.BlockSize());
1191 cout << endl;
1192 }
1193 return pass;
1194}
1195
1196class FilterTester : public Unflushable<Sink>
1197{

Callers 15

ValidateDESFunction · 0.85
ValidateIDEAFunction · 0.85
ValidateSAFERFunction · 0.85
ValidateRC5Function · 0.85
ValidateRC6Function · 0.85
ValidateMARSFunction · 0.85
ValidateRijndaelFunction · 0.85
ValidateTwofishFunction · 0.85
ValidateSerpentFunction · 0.85
ValidateThreeWayFunction · 0.85
ValidateGOSTFunction · 0.85
ValidateSHARKFunction · 0.85

Calls 8

ProcessBlockMethod · 0.80
BlockSizeMethod · 0.45
KeyLengthMethod · 0.45
MaxRetrievableMethod · 0.45
GetMethod · 0.45
NewEncryptionMethod · 0.45
NewDecryptionMethod · 0.45
PutMethod · 0.45

Tested by

no test coverage detected