Project

General

Profile

Actions

SHA-1 prototype

directory : source:/prototypes/01_SHA1

Goals

  • Compute the SHA-1 of each part of a given file.
  • Compute the SHA-1 of a stream.
  • Find the fastest way to compute SHA1, should be at least 40 MB/s.

Speed measures

file : 01.wmv : 17'639'245 byte ~ 17Mo (buffered)
Each measurement is pre-runned once to put the file in cache.

sha1sum from GNU coreutils (Reference)

speed : 57 MB/s

<gburri@overnux:~/code/lang/haskell/SHA1$> time sha1sum < 01.wmv
3aec84601612e8c604ac01971e0ecd9d536dbead  -

real    0m0.301s
user    0m0.276s
sys     0m0.020s

SHA 1.2.0

file : Hash1.hs
speed : 4 times slower (14 MB/s)

<gburri@overnux:~/code/lang/haskell/SHA1$> ghc --make -O2 Hash1.hs && time ./Hash1 01.wmv
[0 - 3aec84601612e8c604ac01971e0ecd9d536dbead]

real    0m1.214s
user    0m1.200s
sys     0m0.012s$

Crypto 4.2.0

file : Hash2.hs
speed : 267 times slower (1 MB/s) :

<gburri@overnux:~/code/lang/haskell/SHA1$> ghc --make -O2 Hash2.hs && time ./Hash2 01.wmv
[0 - Word160 988578912 370337990 78381463 504286621 1399701165]

real    0m7.628s
user    0m7.576s
sys     0m0.028s

Binding with sha1.h from coreutils

file : Hash3.hs

TODO...

Updated by Greg Burri about 15 years ago · 6 revisions