
On Friday 16 March 2007 21:24, Ian Lynagh wrote:
On Sun, Mar 11, 2007 at 08:18:44PM +0000, Dominic Steinitz wrote:
I have re-written the sha1 code so that it is (hopefully) easy to see that it faithfully implements the algorithm (see http://www.itl.nist.gov/fipspubs/fip180-1.htm). Having got rid of the space leak, I have been trying to improve performance.
Currently, the haskell code is 2 orders of magnitude slower than the sha1sum that ships with my linux.
I don't know if this is useful to you, but darcs has some SHA1 code that IIRC is much closer to C's performance. It currently uses darcs' own FastPackedString library, but porting it to ByteString should be fairly easy.
See SHA1.lhs in http://www.abridgegame.org/repos/darcs-unstable
It might even be able to be made faster still by calling lower-level functions than {shift,rotate}{L,R} directly.
Thanks Ian Ian,
Thanks. I'm trying to build just SHA1 but I am getting the following linker errors. Do you know what option I should be adding? Dominic. dom@heisenberg:~/sha11> ghc -o perfTest perfTest.hs -iIgloo/darcs-unstable/src --make -lz Linking perfTest ... Igloo/darcs-unstable/src/FastPackedString.o: In function `r4Lk_info': (.text+0x34c): undefined reference to `utf8_to_ints' Igloo/darcs-unstable/src/FastPackedString.o: In function `r4Lm_info': (.text+0x370): undefined reference to `first_nonwhite' Igloo/darcs-unstable/src/FastPackedString.o: In function `r4Lo_info': (.text+0x430): undefined reference to `first_white' Igloo/darcs-unstable/src/FastPackedString.o: In function `r4Lq_info': (.text+0x4f0): undefined reference to `has_funky_char' Igloo/darcs-unstable/src/FastPackedString.o: In function `r4LE_info': (.text+0x848): undefined reference to `my_mmap' Igloo/darcs-unstable/src/FastPackedString.o: In function `r4LM_info': (.text+0x8dc): undefined reference to `conv_to_hex' Igloo/darcs-unstable/src/FastPackedString.o: In function `r4LO_info': (.text+0x904): undefined reference to `conv_from_hex' collect2: ld returned 1 exit status