This Haskell package provides AES encryption with optional hardware acceleration. Further, it provides statistically sound, splittable random number generation based on AES. The package is nothing more than a wrapper around the Intel-provided AESNI sample library that also bundles a fallback portable software implementation by Brian Gladman.
The package includes C and assembly sources. Also included are prebuilt
dynamic libraries for these sources to make the build process less
fragile. (Rebuilding requires the
yasm assembler.) But prebuilt
shared libraries are not included for all platforms yet.
Here are some example results from an Intel X5680 processor:
How many random numbers can we generate in a second on one thread? First, timing with System.Random interface: 14,482,725 random ints generated [System.Random stdGen] 16,061 random ints generated [PureHaskell/reference] 32,309 random ints generated [PureHaskell] 2,401,893 random ints generated [Gladman unbuffered] 15,980,625 random ints generated [Gladman buffered] 2,329,500 random ints generated [IntelAES unbuffered] 32,383,799 random ints generated [IntelAES buffered] Comparison to C's rand(): 71,347,778 random ints generated [rand in Haskell loop]