[Botan-announce] Botan 1.7.21: Major engine/lookup changes, new microbenchmark system

Jack Lloyd lloyd at randombit.net
Tue Nov 11 17:53:45 EST 2008


http://botan.randombit.net/

I've released Botan 1.7.21 today with many changes to the internals of
the algorithm lookup code. It is now possible to query Botan to find
out which providers are available for an algorithm, compare them using
a builtin microbenchmark system, and then get a copy of the fastest
implementation (or, I suppose, the slowest, if desired).

A usage example:

-- CUT --
void benchmark(const std::string& algo, double ms,
               Timer& timer, RandomNumberGenerator& rng,
               Algorithm_Factory& af)
   {
   std::map<std::string, double> results;

   results = algorithm_benchmark(algo, ms, timer, rng, af);

   std::cout << algo << ":\n";
   for(std::map<std::string, double>::iterator i = results.begin(); i != results.end(); ++i)
      std::cout << "  " << i->first << ": " << i->second << " MiB/s\n";
   std::cout << "\n";
   }

int main()
   {
   LibraryInitializer init;

   AutoSeeded_RNG rng;
   POSIX_Timer timer;

   // Get implementations using af.make_XXX
   Algorithm_Factory& af = global_state().algorithm_factory();

   double ms = 5000; // 5 seconds

   benchmark("Blowfish", ms, timer, rng, af);
   benchmark("TripleDES", ms, timer, rng, af);
   benchmark("SHA-1", ms, timer, rng, af);
   benchmark("MD5", ms, timer, rng, af);
   benchmark("ARC4", ms, timer, rng, af);
   benchmark("Turing", ms, timer, rng, af);
   }
-- CUT --

On my Core2 system, the output is:

Blowfish:
  core: 75.9035 MiB/s
  openssl: 69.9064 MiB/s

TripleDES:
  core: 19.1453 MiB/s
  openssl: 14.9059 MiB/s

SHA-1:
  amd64: 213.725 MiB/s
  core: 211.791 MiB/s
  openssl: 338.505 MiB/s
  sse2: 297.687 MiB/s

MD5:
  core: 352.486 MiB/s
  openssl: 407.909 MiB/s

ARC4:
  core: 147.408 MiB/s
  openssl: 126.832 MiB/s

Turing:
  core: 308.358 MiB/s

A few interesting points to note about this output. Firstly, Turing
reports a speed significantly higher than the regular benchmark output
(probably due to their being no filter overhead in the microbenchmark
code). On the downside, OpenSSL's RC4 runs here at less than half the
speed reported by `openssl speed rc4`, and attempting to use AES
through OpenSSL in the benchmark crashes somewhere inside OpenSSL, for
reasons I don't understand yet.

Another downside: currently the lookup code isn't smart enough to
figure out that for "HMAC(SHA-1)", you might want to use the asm or
OpenSSL code for SHA-1.

Things are inching along towards 1.8.0, and still on track I think for
a release this year (which means by about mid-December, given my
schedule). I think there will probably be a RC1 in early December (two
weeks!), followed by either a second release candiate or the actual
release a week or so later.

-Jack



More information about the botan-announce mailing list