SHA-1 prototype (oldHaskell) » History » Version 3
Greg Burri, 03/27/2009 02:48 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 | speed : 173 MB/s |
||
15 | |||
16 | <pre> |
||
17 | <gburri@overnux:~/code/lang/haskell/SHA1$> time sha1sum < 01.wmv |
||
18 | 3aec84601612e8c604ac01971e0ecd9d536dbead - |
||
19 | |||
20 | real 0m0.098s |
||
21 | user 0m0.092s |
||
22 | sys 0m0.004s |
||
23 | </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 | speed : 18 times slower (13 MB/s) |
||
29 | |||
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 | real 0m1.244s |
||
35 | user 0m1.212s |
||
36 | sys 0m0.036s$ |
||
37 | </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 | real 0m17.078s |
||
50 | user 0m16.921s |
||
51 | sys 0m0.072s |
||
52 | </pre> |
||
53 | |||
54 | h3. Binding with sha1.h from coreutils |
||
55 | |||
56 | file : _Hash3.hs_ |
||
57 | |||
58 | TODO... |