| 66 | } |
| 67 | |
| 68 | void BenchMarkDecryption(const char *name, PK_Decryptor &priv, PK_Encryptor &pub, double timeTotal) |
| 69 | { |
| 70 | unsigned int len = 16; |
| 71 | SecByteBlock ciphertext(pub.CiphertextLength(len)); |
| 72 | SecByteBlock plaintext(pub.MaxPlaintextLength(ciphertext.size())); |
| 73 | GlobalRNG().GenerateBlock(plaintext, len); |
| 74 | pub.Encrypt(GlobalRNG(), plaintext, len, ciphertext); |
| 75 | |
| 76 | const clock_t start = clock(); |
| 77 | unsigned int i; |
| 78 | double timeTaken; |
| 79 | for (timeTaken=(double)0, i=0; timeTaken < timeTotal; timeTaken = double(clock() - start) / CLOCK_TICKS_PER_SECOND, i++) |
| 80 | priv.Decrypt(GlobalRNG(), ciphertext, ciphertext.size(), plaintext); |
| 81 | |
| 82 | OutputResultOperations(name, "Decryption", false, i, timeTaken); |
| 83 | } |
| 84 | |
| 85 | void BenchMarkSigning(const char *name, PK_Signer &key, double timeTotal, bool pc=false) |
| 86 | { |
no test coverage detected