[Haskell-cafe] Crypto-api performance

Johan Brinch brinchj at gmail.com
Tue May 3 22:05:17 CEST 2011


Does anyone have experience with the crypto-api package?

It seems to define a nice common API for block ciphers, hash functions
and prng's. However, I get very low performance using it.

I ran its benchmark on a NOP block cipher, where encryptBlock k = id,
and it's still very slow.

After expanded the included block cipher benchmark (which uses ECB) to
include CBC and CTR I got the following:
ECB: 30 MB/s -- somewhat slow
CBC: 12 MB/s -- very slow
CTR: 4 MB/s -- why is adding a counter so bad?

Have anyone else benchmarked this and if so with what results?
Are there any other high level crypto API?


Here's my benchmark code for CTR (easily modified to use ECB/CBC):
https://gist.github.com/954093

And here's my patched Benchmark/Crypto.hs:
https://gist.github.com/954099


Package in question:
http://hackage.haskell.org/package/crypto-api


-- 
Johan Brinch,
Dept. of Computer Science,
University of Copenhagen



More information about the Haskell-Cafe mailing list