[Haskell-cafe] haskell crypto is reaaaaaaaaaally slow

Dominic Steinitz dominic.steinitz at blueyonder.co.uk
Wed Jun 20 16:23:51 EDT 2007

I'm probably missing something here but writing MD5 (and for that matter
 SHA1) requires bit twiddling operations (Data.Bits) and these aren't
defined for ByteString. For example, SHA1 defines the following function
and it's not clear to me how you'd implement this for ByteString rather
than Word8.

f n x y z
   | n <= 19 = (x .&. y) .|. ((complement x) .&. z)
   | n <= 39 = x `xor` y `xor` z
   | n <= 59 = (x .&. y) .|. (x .&. z) .|. (y .&. z)
   | n <= 79 = x `xor` y `xor` z

I'd love to have blazzingly fast implementations for all the functions
in the crypto library so if anyone feels inclined, any contributions
would be very gratefully accepted. Unfortunately, I don't have the time
to do this myself.


More information about the Haskell-Cafe mailing list