Project

General

Profile

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

Greg Burri, 03/25/2009 11:46 AM

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 for a given part of a given file.
7
* Compute the SHA-1 of a stream.
8
9
h2. Speed measures
10
11
*file* : 01.wmv : 17'639'245 byte ~ 17Mo
12
13
h3. sha1sum from GNU coreutils (Reference)
14
15
speed : 173 MB/s
16
17
<pre>
18
<gburri@overnux:~/code/lang/haskell/SHA1$> time sha1sum < 01.wmv
19
3aec84601612e8c604ac01971e0ecd9d536dbead  -
20
21
real    0m0.098s
22
user    0m0.092s
23
sys     0m0.004s
24
</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
speed : 18 times slower (13 MB/s)
30
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
real    0m1.244s
36
user    0m1.212s
37
sys     0m0.036s$
38
</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
real    0m17.078s
51
user    0m16.921s
52
sys     0m0.072s
53
</pre>
54
55
h3. Binding with sha1.h from coreutils
56
57
file : _Hash3.hs_
58
59
TODO...