Got Bored

…and so I wrote up an implementation of Daniel J. Bernstein’s Salsa20 encryption function in Haskell.

It won’t win any prizes for speed (it runs at a blazingly slow speed of ~3.2 MB/s on my Core Duo) or cleverness (I’m sure there’s a lot left to do in terms of taking advantage of Haskell the language), but it is very straightforward. Much of that straightforwardness is due to the simplicity of Bernstein’s algorithm than anything I coded, but I was still rather surprised at the incredible resemblance between what I wrote and what’s in Bernstein’s paper. That’s high-level languages for you…

Code is browseable here and can be checked out with git clone http://code.ninjawedding.org/salsa20.git. Not sure if I’ll keep working on this one, but if I do, you’ll know. I place all this code in the public domain.

I think this goes without saying, but I’ll say it anyway: if you use this code to do anything important, you’re insane.