Project

General

Profile

SHA-1 prototype (oldHaskell) » History » Version 4

Greg Burri, 03/29/2009 07:42 PM

1 1 Greg Burri
h1. SHA-1 prototype
2
3
h2. Goals
4
5
* Compute the SHA-1 of each part of a given file.
6
* Compute the SHA-1 of a stream.
7
8
h2. Speed measures
9
10 2 Greg Burri
file : @01.wmv@ : 17'639'245 byte ~ 17Mo
11 1 Greg Burri
12
h3. sha1sum from GNU coreutils (Reference)
13
14 4 Greg Burri
speed : 57 MB/s
15 1 Greg Burri
16
<pre>
17
<gburri@overnux:~/code/lang/haskell/SHA1$> time sha1sum < 01.wmv
18
3aec84601612e8c604ac01971e0ecd9d536dbead  -
19
20 4 Greg Burri
real    0m0.301s
21
user    0m0.276s
22
sys     0m0.020s
23 1 Greg Burri
</pre>
24
25
h3. "SHA 1.2.0":http://hackage.haskell.org/cgi-bin/hackage-scripts/package/SHA-1.2.0
26
27
file : _Hash.hs_
28 4 Greg Burri
speed : 4 times slower (14 MB/s)
29 1 Greg Burri
30
<pre>
31
<gburri@overnux:~/code/lang/haskell/SHA1$> ghc --make -O2 Hash.hs -o hash && time ./hash 01.wmv
32
[0 - 3aec84601612e8c604ac01971e0ecd9d536dbead]
33
34 4 Greg Burri
real    0m1.214s
35
user    0m1.200s
36
sys     0m0.012s$
37 1 Greg Burri
</pre>
38
39
40
h3. "Crypto 4.2.0":http://hackage.haskell.org/cgi-bin/hackage-scripts/package/Crypto-4.2.0
41
42
file : _Hash2.hs_
43
speed : 267 times slower (1 MB/s) :
44
45
<pre>
46
<gburri@overnux:~/code/lang/haskell/SHA1$> ghc --make -O2 Hash2.hs -o hash2 && time ./hash2 01.wmv
47
[0 - Word160 988578912 370337990 78381463 504286621 1399701165]
48
49 4 Greg Burri
real    0m7.628s
50
user    0m7.576s
51
sys     0m0.028s
52 1 Greg Burri
</pre>
53
54
h3. Binding with sha1.h from coreutils
55
56
file : _Hash3.hs_
57
58
TODO...