[Haskell-beginners] Calculating SHA1 hashes?

Tom Tobin korpios at korpios.com
Sat Feb 13 22:39:46 EST 2010

I'm trying to figure out the best way to calculate SHA1 hashes for
files using Haskell.  There are several libraries I tried from
Hackage, but they all seem to end up computing the hash far too slowly
vs. OpenSSL.  Some of the libraries seem to be FFI bindings to
OpenSSL, but I haven't figured out how to efficiently feed these.
(For instance, hopenssl consumes a [Word8], but I haven't figured out
how to lazily produce that from a file; using "unpack" on a ByteString
seems to end up much too slow.)  I also tried mimicking nano-md5 by
writing a "nano-sha1" that was largely a "replace the name of the
digest function" hack job, but I couldn't manage to get that working.

Is there a particular accepted way to generate hashes that I'm missing?

More information about the Beginners mailing list