[Haskell-cafe] Crypto-api performance
brinchj at gmail.com
Tue May 10 09:47:10 CEST 2011
On Tue, May 3, 2011 at 22:05, Johan Brinch <brinchj at gmail.com> wrote:
> 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):
> And here's my patched Benchmark/Crypto.hs:
> Package in question:
Would there be anything wrong / really ugly in simply pushing those
small bottlenecks into C code?
Stuff like xor'ing two bytestrings or generating a block of
incremental IV's (for CTR mode)?
More information about the Haskell-Cafe