Project

General

Profile

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

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