[Haskell-cafe] Re: SHA1 again

Dominic Steinitz dominic.steinitz at blueyonder.co.uk
Sun Jul 15 15:44:10 EDT 2007


Malte Milatz <malte <at> gmx-topmail.de> writes:

> 
> See the following link for a purely functional and straight-forward
> implementation of SHA1.  Disclaimer: Please be kind to me, I haven't
> done much Haskell (yet).  And I know nothing about SHA1 except its
> specification.
> 
> 	http://hpaste.org/1695#a2
> 
> It performs better than the SHA1 algorithm in Crypto:  It is faster by a
> factor of approximately e.   It is also competitive (regarding time)
> with the »unsafe« SHA1 implementation posted here some days ago,

Great. Can you post some timings?

> although it uses considerably more memory.  Of course, you may safely

Does it have a space leak or does it run in constant but larger space than the
other versions?

> forget it if you're interested in performance near a C implementation
> such as GNU sha1sum.
> 

I don't think it's unreasonable to think we could get near to C performance and
we've been getting closer.

> I'd heartily welcome any comments or suggestions for improvement, as
> well as benchmark results, especially if they differ from mine. I'm
> using the standard ghc -O2, by the way.

For me it will have to wait until next weekend at the very earliest but I hope
your post sparks some interest in the meantime.

Dominic.

PS I had a 5 minute (well actually less) look at the code and it doesn't look
dissimilar to other versions I've seen in Haskell. I wonder if the speedup is
principally because of ByteString.

PPS We have to put splitn in a library.



More information about the Haskell-Cafe mailing list