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

Function BenchMarkEncryption

src/cryptopp/bench2.cpp:47–66  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

45void OutputResultOperations(const char *name, const char *operation, bool pc, unsigned long iterations, double timeTaken);
46
47void BenchMarkEncryption(const char *name, PK_Encryptor &key, double timeTotal, bool pc=false)
48{
49 unsigned int len = 16;
50 SecByteBlock plaintext(len), ciphertext(key.CiphertextLength(len));
51 GlobalRNG().GenerateBlock(plaintext, len);
52
53 const clock_t start = clock();
54 unsigned int i;
55 double timeTaken;
56 for (timeTaken=(double)0, i=0; timeTaken < timeTotal; timeTaken = double(clock() - start) / CLOCK_TICKS_PER_SECOND, i++)
57 key.Encrypt(GlobalRNG(), plaintext, len, ciphertext);
58
59 OutputResultOperations(name, "Encryption", pc, i, timeTaken);
60
61 if (!pc && key.GetMaterial().SupportsPrecomputation())
62 {
63 key.AccessMaterial().Precompute(16);
64 BenchMarkEncryption(name, key, timeTotal, true);
65 }
66}
67
68void BenchMarkDecryption(const char *name, PK_Decryptor &priv, PK_Encryptor &pub, double timeTotal)
69{

Callers 2

BenchMarkCryptoFunction · 0.85
BenchmarkAll2Function · 0.85

Calls 5

OutputResultOperationsFunction · 0.85
GenerateBlockMethod · 0.45
EncryptMethod · 0.45
PrecomputeMethod · 0.45

Tested by

no test coverage detected