Fabcoin Core  0.16.2
P2P Digital Currency
bench1.cpp
Go to the documentation of this file.
1 // bench1.cpp - written and placed in the public domain by Wei Dai
2 
3 #include "cryptlib.h"
4 #include "bench.h"
5 #include "validate.h"
6 
7 #include "aes.h"
8 #include "blumshub.h"
9 #include "files.h"
10 #include "filters.h"
11 #include "hex.h"
12 #include "modes.h"
13 #include "factory.h"
14 #include "smartptr.h"
15 #include "cpu.h"
16 
17 #include <time.h>
18 #include <math.h>
19 #include <iostream>
20 #include <sstream>
21 #include <iomanip>
22 
23 // These are noisy enoguh due to test.cpp. Turn them off here.
24 #if CRYPTOPP_GCC_DIAGNOSTIC_AVAILABLE
25 # pragma GCC diagnostic ignored "-Wdeprecated-declarations"
26 #endif
27 
30 
31 #ifdef CLOCKS_PER_SEC
32 const double CLOCK_TICKS_PER_SECOND = (double)CLOCKS_PER_SEC;
33 #elif defined(CLK_TCK)
34 const double CLOCK_TICKS_PER_SECOND = (double)CLK_TCK;
35 #else
36 const double CLOCK_TICKS_PER_SECOND = 1000000.0;
37 #endif
38 
39 double logtotal = 0.0, g_allocatedTime = 0, g_hertz = 0;
40 unsigned int logcount = 0;
41 
42 static const byte defaultKey[] = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
43  "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000";
44 
45 void OutputResultBytes(const char *name, double length, double timeTaken)
46 {
47  // Coverity finding, also see http://stackoverflow.com/a/34509163/608639.
48  StreamState ss(cout);
49 
50  // Coverity finding
51  if (length < 0.0000000001f) length = 0.000001f;
52  if (timeTaken < 0.0000000001f) timeTaken = 0.000001f;
53 
54  double mbs = length / timeTaken / (1024*1024);
55  cout << "\n<TR><TH>" << name;
56 // cout << "<TD>" << setprecision(3) << length / (1024*1024);
57  cout << setiosflags(ios::fixed);
58 // cout << "<TD>" << setprecision(3) << timeTaken;
59  cout << "<TD>" << setprecision(0) << setiosflags(ios::fixed) << mbs;
60  if (g_hertz)
61  cout << "<TD>" << setprecision(1) << setiosflags(ios::fixed) << timeTaken * g_hertz / length;
62  logtotal += log(mbs);
63  logcount++;
64 }
65 
66 void OutputResultKeying(double iterations, double timeTaken)
67 {
68  // Coverity finding, also see http://stackoverflow.com/a/34509163/608639.
69  StreamState ss(cout);
70 
71  // Coverity finding
72  if (iterations < 0.0000000001f) iterations = 0.000001f;
73  if (timeTaken < 0.0000000001f) timeTaken = 0.000001f;
74 
75  cout << "<TD>" << setprecision(3) << setiosflags(ios::fixed) << (1000*1000*timeTaken/iterations);
76  if (g_hertz)
77  cout << "<TD>" << setprecision(0) << setiosflags(ios::fixed) << timeTaken * g_hertz / iterations;
78 }
79 
80 void OutputResultOperations(const char *name, const char *operation, bool pc, unsigned long iterations, double timeTaken)
81 {
82  // Coverity finding, also see http://stackoverflow.com/a/34509163/608639.
83  StreamState ss(cout);
84 
85  // Coverity finding
86  if (!iterations) iterations++;
87  if (timeTaken < 0.0000000001f) timeTaken = 0.000001f;
88 
89  cout << "\n<TR><TH>" << name << " " << operation << (pc ? " with precomputation" : "");
90  cout << "<TD>" << setprecision(2) << setiosflags(ios::fixed) << (1000*timeTaken/iterations);
91  if (g_hertz)
92  cout << "<TD>" << setprecision(2) << setiosflags(ios::fixed) << timeTaken * g_hertz / iterations / 1000000;
93 
94  logtotal += log(iterations/timeTaken);
95  logcount++;
96 }
97 
98 /*
99 void BenchMark(const char *name, BlockTransformation &cipher, double timeTotal)
100 {
101  const int BUF_SIZE = RoundUpToMultipleOf(2048U, cipher.OptimalNumberOfParallelBlocks() * cipher.BlockSize());
102  AlignedSecByteBlock buf(BUF_SIZE);
103  const int nBlocks = BUF_SIZE / cipher.BlockSize();
104  clock_t start = clock();
105 
106  unsigned long i=0, blocks=1;
107  double timeTaken;
108  do
109  {
110  blocks *= 2;
111  for (; i<blocks; i++)
112  cipher.ProcessAndXorMultipleBlocks(buf, NULL, buf, nBlocks);
113  timeTaken = double(clock() - start) / CLOCK_TICKS_PER_SECOND;
114  }
115  while (timeTaken < 2.0/3*timeTotal);
116 
117  OutputResultBytes(name, double(blocks) * BUF_SIZE, timeTaken);
118 }
119 */
120 
121 void BenchMark(const char *name, StreamTransformation &cipher, double timeTotal)
122 {
123  const int BUF_SIZE=RoundUpToMultipleOf(2048U, cipher.OptimalBlockSize());
124  AlignedSecByteBlock buf(BUF_SIZE);
125  GlobalRNG().GenerateBlock(buf, BUF_SIZE);
126  clock_t start = clock();
127 
128  unsigned long i=0, blocks=1;
129  double timeTaken;
130  do
131  {
132  blocks *= 2;
133  for (; i<blocks; i++)
134  cipher.ProcessString(buf, BUF_SIZE);
135  timeTaken = double(clock() - start) / CLOCK_TICKS_PER_SECOND;
136  }
137  while (timeTaken < 2.0/3*timeTotal);
138 
139  OutputResultBytes(name, double(blocks) * BUF_SIZE, timeTaken);
140 }
141 
142 void BenchMark(const char *name, AuthenticatedSymmetricCipher &cipher, double timeTotal)
143 {
144  if (cipher.NeedsPrespecifiedDataLengths())
145  cipher.SpecifyDataLengths(0, cipher.MaxMessageLength(), 0);
146 
147  BenchMark(name, static_cast<StreamTransformation &>(cipher), timeTotal);
148 }
149 
150 void BenchMark(const char *name, HashTransformation &ht, double timeTotal)
151 {
152  const int BUF_SIZE=2048U;
153  AlignedSecByteBlock buf(BUF_SIZE);
154  GlobalRNG().GenerateBlock(buf, BUF_SIZE);
155  clock_t start = clock();
156 
157  unsigned long i=0, blocks=1;
158  double timeTaken;
159  do
160  {
161  blocks *= 2;
162  for (; i<blocks; i++)
163  ht.Update(buf, BUF_SIZE);
164  timeTaken = double(clock() - start) / CLOCK_TICKS_PER_SECOND;
165  }
166  while (timeTaken < 2.0/3*timeTotal);
167 
168  OutputResultBytes(name, double(blocks) * BUF_SIZE, timeTaken);
169 }
170 
171 void BenchMark(const char *name, BufferedTransformation &bt, double timeTotal)
172 {
173  const int BUF_SIZE=2048U;
174  AlignedSecByteBlock buf(BUF_SIZE);
175  GlobalRNG().GenerateBlock(buf, BUF_SIZE);
176  clock_t start = clock();
177 
178  unsigned long i=0, blocks=1;
179  double timeTaken;
180  do
181  {
182  blocks *= 2;
183  for (; i<blocks; i++)
184  bt.Put(buf, BUF_SIZE);
185  timeTaken = double(clock() - start) / CLOCK_TICKS_PER_SECOND;
186  }
187  while (timeTaken < 2.0/3*timeTotal);
188 
189  OutputResultBytes(name, double(blocks) * BUF_SIZE, timeTaken);
190 }
191 
192 void BenchMarkKeying(SimpleKeyingInterface &c, size_t keyLength, const NameValuePairs &params)
193 {
194  unsigned long iterations = 0;
195  clock_t start = clock();
196  double timeTaken;
197  do
198  {
199  for (unsigned int i=0; i<1024; i++)
200  c.SetKey(defaultKey, keyLength, params);
201  timeTaken = double(clock() - start) / CLOCK_TICKS_PER_SECOND;
202  iterations += 1024;
203  }
204  while (timeTaken < g_allocatedTime);
205 
206  OutputResultKeying(iterations, timeTaken);
207 }
208 
209 template <class T_FactoryOutput, class T_Interface>
210 void BenchMarkByName2(const char *factoryName, size_t keyLength = 0, const char *displayName=NULL, const NameValuePairs &params = g_nullNameValuePairs)
211 {
212  CRYPTOPP_UNUSED(params);
213  std::string name(factoryName ? factoryName : "");
215 
216  if (!keyLength)
217  keyLength = obj->DefaultKeyLength();
218 
219  if (displayName)
220  name = displayName;
221  else if (keyLength)
222  name += " (" + IntToString(keyLength * 8) + "-bit key)";
223 
224  obj->SetKey(defaultKey, keyLength, CombinedNameValuePairs(params, MakeParameters(Name::IV(), ConstByteArrayParameter(defaultKey, obj->IVSize()), false)));
225  BenchMark(name.c_str(), *static_cast<T_Interface *>(obj.get()), g_allocatedTime);
226  BenchMarkKeying(*obj, keyLength, CombinedNameValuePairs(params, MakeParameters(Name::IV(), ConstByteArrayParameter(defaultKey, obj->IVSize()), false)));
227 }
228 
229 template <class T_FactoryOutput>
230 void BenchMarkByName(const char *factoryName, size_t keyLength = 0, const char *displayName=NULL, const NameValuePairs &params = g_nullNameValuePairs)
231 {
232  CRYPTOPP_UNUSED(params);
233  BenchMarkByName2<T_FactoryOutput, T_FactoryOutput>(factoryName, keyLength, displayName, params);
234 }
235 
236 template <class T>
237 void BenchMarkByNameKeyLess(const char *factoryName, const char *displayName=NULL, const NameValuePairs &params = g_nullNameValuePairs)
238 {
239  CRYPTOPP_UNUSED(params);
240  std::string name = factoryName;
241  if (displayName)
242  name = displayName;
243 
244  member_ptr<T> obj(ObjectFactoryRegistry<T>::Registry().CreateObject(factoryName));
245  BenchMark(name.c_str(), *obj, g_allocatedTime);
246 }
247 
248 void BenchmarkAll(double t, double hertz)
249 {
250 #if 1
251  logtotal = 0;
252  logcount = 0;
253  g_allocatedTime = t;
254  g_hertz = hertz;
255 
256  const char *cpb, *cpk;
257  if (g_hertz)
258  {
259  cpb = "<TH>Cycles Per Byte";
260  cpk = "<TH>Cycles to<br>Setup Key and IV";
261  cout << "CPU frequency of the test platform is " << g_hertz << " Hz.\n";
262  }
263  else
264  {
265  cpb = cpk = "";
266  cout << "CPU frequency of the test platform was not provided.\n";
267  }
268 
269  cout << "<TABLE border=1><COLGROUP><COL align=left><COL align=right><COL align=right><COL align=right><COL align=right>" << endl;
270  cout << "<THEAD><TR><TH>Algorithm<TH>MiB/Second" << cpb << "<TH>Microseconds to<br>Setup Key and IV" << cpk << endl;
271 
272  cout << "\n<TBODY style=\"background: yellow\">";
273 #if CRYPTOPP_BOOL_AESNI_INTRINSICS_AVAILABLE
274  if (HasCLMUL())
275  BenchMarkByName2<AuthenticatedSymmetricCipher, AuthenticatedSymmetricCipher>("AES/GCM", 0, "AES/GCM");
276  else
277 #endif
278  {
279  BenchMarkByName2<AuthenticatedSymmetricCipher, AuthenticatedSymmetricCipher>("AES/GCM", 0, "AES/GCM (2K tables)", MakeParameters(Name::TableSize(), 2048));
280  BenchMarkByName2<AuthenticatedSymmetricCipher, AuthenticatedSymmetricCipher>("AES/GCM", 0, "AES/GCM (64K tables)", MakeParameters(Name::TableSize(), 64*1024));
281  }
282  BenchMarkByName2<AuthenticatedSymmetricCipher, AuthenticatedSymmetricCipher>("AES/CCM");
283  BenchMarkByName2<AuthenticatedSymmetricCipher, AuthenticatedSymmetricCipher>("AES/EAX");
284 
285  cout << "\n<TBODY style=\"background: white\">";
286 #if CRYPTOPP_BOOL_AESNI_INTRINSICS_AVAILABLE
287  if (HasCLMUL())
288  BenchMarkByName2<AuthenticatedSymmetricCipher, MessageAuthenticationCode>("AES/GCM", 0, "GMAC(AES)");
289  else
290 #endif
291  {
292  BenchMarkByName2<AuthenticatedSymmetricCipher, MessageAuthenticationCode>("AES/GCM", 0, "GMAC(AES) (2K tables)", MakeParameters(Name::TableSize(), 2048));
293  BenchMarkByName2<AuthenticatedSymmetricCipher, MessageAuthenticationCode>("AES/GCM", 0, "GMAC(AES) (64K tables)", MakeParameters(Name::TableSize(), 64*1024));
294  }
295  BenchMarkByName<MessageAuthenticationCode>("VMAC(AES)-64");
296  BenchMarkByName<MessageAuthenticationCode>("VMAC(AES)-128");
297  BenchMarkByName<MessageAuthenticationCode>("HMAC(SHA-1)");
298  BenchMarkByName<MessageAuthenticationCode>("Two-Track-MAC");
299  BenchMarkByName<MessageAuthenticationCode>("CMAC(AES)");
300  BenchMarkByName<MessageAuthenticationCode>("DMAC(AES)");
301  BenchMarkByName<MessageAuthenticationCode>("Poly1305(AES)");
302  BenchMarkByName<MessageAuthenticationCode>("BLAKE2s");
303  BenchMarkByName<MessageAuthenticationCode>("BLAKE2b");
304  BenchMarkByName<MessageAuthenticationCode>("SipHash-2-4");
305  BenchMarkByName<MessageAuthenticationCode>("SipHash-4-8");
306 
307  cout << "\n<TBODY style=\"background: yellow\">";
308  BenchMarkByNameKeyLess<HashTransformation>("CRC32");
309  BenchMarkByNameKeyLess<HashTransformation>("CRC32C");
310  BenchMarkByNameKeyLess<HashTransformation>("Adler32");
311  BenchMarkByNameKeyLess<HashTransformation>("MD5");
312  BenchMarkByNameKeyLess<HashTransformation>("SHA-1");
313  BenchMarkByNameKeyLess<HashTransformation>("SHA-256");
314  BenchMarkByNameKeyLess<HashTransformation>("SHA-512");
315  BenchMarkByNameKeyLess<HashTransformation>("Keccak-224");
316  BenchMarkByNameKeyLess<HashTransformation>("Keccak-256");
317  BenchMarkByNameKeyLess<HashTransformation>("Keccak-384");
318  BenchMarkByNameKeyLess<HashTransformation>("Keccak-512");
319  BenchMarkByNameKeyLess<HashTransformation>("SHA3-224");
320  BenchMarkByNameKeyLess<HashTransformation>("SHA3-256");
321  BenchMarkByNameKeyLess<HashTransformation>("SHA3-384");
322  BenchMarkByNameKeyLess<HashTransformation>("SHA3-512");
323  BenchMarkByNameKeyLess<HashTransformation>("Tiger");
324  BenchMarkByNameKeyLess<HashTransformation>("Whirlpool");
325  BenchMarkByNameKeyLess<HashTransformation>("RIPEMD-160");
326  BenchMarkByNameKeyLess<HashTransformation>("RIPEMD-320");
327  BenchMarkByNameKeyLess<HashTransformation>("RIPEMD-128");
328  BenchMarkByNameKeyLess<HashTransformation>("RIPEMD-256");
329  BenchMarkByNameKeyLess<HashTransformation>("BLAKE2s");
330  BenchMarkByNameKeyLess<HashTransformation>("BLAKE2b");
331 
332  cout << "\n<TBODY style=\"background: white\">";
333  BenchMarkByName<SymmetricCipher>("Panama-LE");
334  BenchMarkByName<SymmetricCipher>("Panama-BE");
335  BenchMarkByName<SymmetricCipher>("Salsa20");
336  BenchMarkByName<SymmetricCipher>("Salsa20", 0, "Salsa20/12", MakeParameters(Name::Rounds(), 12));
337  BenchMarkByName<SymmetricCipher>("Salsa20", 0, "Salsa20/8", MakeParameters(Name::Rounds(), 8));
338  BenchMarkByName<SymmetricCipher>("ChaCha20");
339  BenchMarkByName<SymmetricCipher>("ChaCha12");
340  BenchMarkByName<SymmetricCipher>("ChaCha8");
341  BenchMarkByName<SymmetricCipher>("Sosemanuk");
342  BenchMarkByName<SymmetricCipher>("MARC4");
343  BenchMarkByName<SymmetricCipher>("SEAL-3.0-LE");
344  BenchMarkByName<SymmetricCipher>("WAKE-OFB-LE");
345 
346  cout << "\n<TBODY style=\"background: yellow\">";
347  BenchMarkByName<SymmetricCipher>("AES/CTR", 16);
348  BenchMarkByName<SymmetricCipher>("AES/CTR", 24);
349  BenchMarkByName<SymmetricCipher>("AES/CTR", 32);
350  BenchMarkByName<SymmetricCipher>("AES/CBC", 16);
351  BenchMarkByName<SymmetricCipher>("AES/CBC", 24);
352  BenchMarkByName<SymmetricCipher>("AES/CBC", 32);
353  BenchMarkByName<SymmetricCipher>("AES/OFB", 16);
354  BenchMarkByName<SymmetricCipher>("AES/CFB", 16);
355  BenchMarkByName<SymmetricCipher>("AES/ECB", 16);
356  BenchMarkByName<SymmetricCipher>("Camellia/CTR", 16);
357  BenchMarkByName<SymmetricCipher>("Camellia/CTR", 32);
358  BenchMarkByName<SymmetricCipher>("Twofish/CTR");
359  BenchMarkByName<SymmetricCipher>("Serpent/CTR");
360  BenchMarkByName<SymmetricCipher>("CAST-256/CTR");
361  BenchMarkByName<SymmetricCipher>("RC6/CTR");
362  BenchMarkByName<SymmetricCipher>("MARS/CTR");
363  BenchMarkByName<SymmetricCipher>("SHACAL-2/CTR", 16);
364  BenchMarkByName<SymmetricCipher>("SHACAL-2/CTR", 64);
365  BenchMarkByName<SymmetricCipher>("DES/CTR");
366  BenchMarkByName<SymmetricCipher>("DES-XEX3/CTR");
367  BenchMarkByName<SymmetricCipher>("DES-EDE3/CTR");
368  BenchMarkByName<SymmetricCipher>("IDEA/CTR");
369  BenchMarkByName<SymmetricCipher>("RC5/CTR", 0, "RC5 (r=16)");
370  BenchMarkByName<SymmetricCipher>("Blowfish/CTR");
371  BenchMarkByName<SymmetricCipher>("TEA/CTR");
372  BenchMarkByName<SymmetricCipher>("XTEA/CTR");
373  BenchMarkByName<SymmetricCipher>("CAST-128/CTR");
374  BenchMarkByName<SymmetricCipher>("SKIPJACK/CTR");
375  BenchMarkByName<SymmetricCipher>("SEED/CTR", 0, "SEED/CTR (1/2 K table)");
376  cout << "</TABLE>" << endl;
377 
378  BenchmarkAll2(t, hertz);
379  cout << "Throughput Geometric Average: " << setiosflags(ios::fixed) << exp(logtotal/(logcount ? logcount : 1)) << endl;
380 
381 // Safer functions on Windows for C&A, https://github.com/weidai11/cryptopp/issues/55
382 #if (CRYPTOPP_MSC_VERSION >= 1400)
383  tm localTime = {};
384  char timeBuf[64];
385  errno_t err;
386 
387  const time_t endTime = time(NULL);
388  err = localtime_s(&localTime, &endTime);
389  CRYPTOPP_ASSERT(err == 0);
390  err = asctime_s(timeBuf, sizeof(timeBuf), &localTime);
391  CRYPTOPP_ASSERT(err == 0);
392 
393  cout << "\nTest ended at " << timeBuf;
394 #else
395  const time_t endTime = time(NULL);
396  cout << "\nTest ended at " << asctime(localtime(&endTime));
397 #endif
398 #endif
399 }
unsigned int logcount
Definition: bench1.cpp:40
Used to pass byte array input as part of a NameValuePairs object.
Definition: algparam.h:29
uint8_t byte
Definition: Common.h:57
virtual void SetKey(const byte *key, size_t length, const NameValuePairs &params=g_nullNameValuePairs)
Sets or reset the key of this object.
Definition: cryptlib.cpp:97
Interface for one direction (encryption or decryption) of a stream cipher or block cipher mode with a...
Definition: cryptlib.h:1121
Class file for modes of operation.
virtual void GenerateBlock(byte *output, size_t size)
Generate random array of bytes.
Definition: cryptlib.cpp:326
virtual bool NeedsPrespecifiedDataLengths() const
Determines if data lengths must be specified prior to inputting data.
Definition: cryptlib.h:1150
Abstract base classes that provide a uniform interface to this library.
void BenchMarkByNameKeyLess(const char *factoryName, const char *displayName=NULL, const NameValuePairs &params=g_nullNameValuePairs)
Definition: bench1.cpp:237
RandomNumberGenerator & GlobalRNG()
Definition: test.cpp:123
Classes for automatic resource management.
#define c(i)
std::hash for asio::adress
Definition: Common.h:323
void ProcessString(byte *inoutString, size_t length)
Encrypt or decrypt a string of bytes.
Definition: cryptlib.h:877
Combines two sets of NameValuePairs.
Definition: algparam.h:135
Interface for buffered transformations.
Definition: cryptlib.h:1352
void BenchMarkKeying(SimpleKeyingInterface &c, size_t keyLength, const NameValuePairs &params)
Definition: bench1.cpp:192
Pointer that overloads operator ->
Definition: smartptr.h:39
best_clock::type clock
Definition: bench.h:48
void BenchmarkAll2(double t, double hertz)
Definition: bench2.cpp:271
size_t Put(byte inByte, bool blocking=true)
Input a byte for processing.
Definition: cryptlib.h:1376
virtual unsigned int OptimalBlockSize() const
Provides the input block size most efficient for this cipher.
Definition: cryptlib.h:842
AlgorithmParameters MakeParameters(const char *name, const T &value, bool throwIfNotUsed=true)
Create an object that implements NameValuePairs.
Definition: algparam.h:498
void BenchMarkByName2(const char *factoryName, size_t keyLength=0, const char *displayName=NULL, const NameValuePairs &params=g_nullNameValuePairs)
Definition: bench1.cpp:210
const char * name
Definition: rest.cpp:36
Classes for HexEncoder and HexDecoder.
Class file for the AES cipher (Rijndael)
void OutputResultBytes(const char *name, double length, double timeTaken)
Definition: bench1.cpp:45
Interface for algorithms that take byte strings as keys.
Definition: cryptlib.h:524
void OutputResultKeying(double iterations, double timeTaken)
Definition: bench1.cpp:66
Classes and functions for registering and locating library objects.
Interface for the data processing portion of stream ciphers.
Definition: cryptlib.h:823
const T * get() const
Definition: smartptr.h:52
#define CRYPTOPP_ASSERT(exp)
Definition: trap.h:92
const NameValuePairs & g_nullNameValuePairs
An empty set of name-value pairs.
Definition: cryptlib.cpp:76
void BenchMarkByName(const char *factoryName, size_t keyLength=0, const char *displayName=NULL, const NameValuePairs &params=g_nullNameValuePairs)
Definition: bench1.cpp:230
double g_hertz
Definition: bench1.cpp:39
Functions for CPU features and intrinsics.
Implementation of BufferedTransformation&#39;s attachment interface.
#define f(x)
Definition: gost.cpp:57
virtual lword MaxMessageLength() const =0
Provides the maximum length of encrypted data.
#define USING_NAMESPACE(x)
Definition: config.h:206
Classes for Blum Blum Shub generator.
#define CRYPTOPP_UNUSED(x)
Definition: config.h:741
Interface for hash functions and data processing part of MACs.
Definition: cryptlib.h:930
std::string IntToString(T value, unsigned int base=10)
Converts a value to a string.
Definition: misc.h:539
T1 RoundUpToMultipleOf(const T1 &n, const T2 &m)
Rounds a value up to a multiple of a second value.
Definition: misc.h:905
Classes providing file-based library services.
void SpecifyDataLengths(lword headerLength, lword messageLength, lword footerLength=0)
Prespecifies the data lengths.
Definition: cryptlib.cpp:254
Object factory registry.
Definition: factory.h:45
void BenchmarkAll(double t, double hertz)
Definition: bench1.cpp:248
void OutputResultOperations(const char *name, const char *operation, bool pc, unsigned long iterations, double timeTaken)
Definition: bench1.cpp:80
const double CLOCK_TICKS_PER_SECOND
Definition: bench1.cpp:36
void BenchMark(const char *name, StreamTransformation &cipher, double timeTotal)
Definition: bench1.cpp:121
double logtotal
Definition: bench1.cpp:39
virtual void Update(const byte *input, size_t length)=0
Updates a hash with additional input.
double g_allocatedTime
Definition: bench1.cpp:39
Interface for retrieving values given their names.
Definition: cryptlib.h:279