Project

General

Profile

SHA-1 prototype » History » Version 7

Greg Burri, 11/19/2009 08:04 AM

1 1 Greg Burri
h1. SHA-1 prototype
2
3
directory : source:/prototypes/01_SHA1
4
5
h2. Goals
6
7
* Compute the SHA-1 of each part of a given file.
8
* Compute the SHA-1 of a stream.
9
* Find the fastest way to compute SHA1, should be at least 40 MB/s.
10
11 5 Greg Burri
h2. Speed measures against _sha1sum_
12 1 Greg Burri
13
file : @01.wmv@ : 17'639'245 byte ~ 17Mo (buffered)
14
Each measurement is pre-runned once to put the file in cache.
15
16
17
h3. _sha1sum_ from _GNU coreutils_ (Reference)
18
19
speed : 57 MB/s
20
21
<pre>
22
<gburri@overnux:~/code/lang/haskell/SHA1$> time sha1sum < 01.wmv
23
3aec84601612e8c604ac01971e0ecd9d536dbead  -
24
25
real    0m0.301s
26
user    0m0.276s
27
sys     0m0.020s
28
</pre>
29
30 5 Greg Burri
h3. QCryptographicHash (release -O2)
31 1 Greg Burri
32 4 Greg Burri
speed : 49 MB/s
33 1 Greg Burri
34
<pre>
35 4 Greg Burri
<flynux:~/code/projects/aybabtu/prototypes/01_SHA1 $> time ./qt_sha1 all 01.wmv 
36
3aec84601612e8c604ac01971e0ecd9d536dbead
37 2 Greg Burri
38 4 Greg Burri
real    0m0.340s
39 2 Greg Burri
user    0m0.324s
40 1 Greg Burri
sys     0m0.016s
41
</pre>
42 5 Greg Burri
43
44
h2. Speed measures against _Linus's sha1_
45
46
file : @test.bin@ : 754'856'284 byte ~ 720Mo (buffered)
47
Each measurement is pre-runned once to put the file in cache.
48
49
50
h3. _Linus's sha1_
51
52 7 Greg Burri
h4. Debug mode
53 5 Greg Burri
54
Speed : 69.3 MB/s
55
56
<pre>
57
$ time ./debug/01_SHA1.exe all ~/data.bin
58
ca6fa5e8eeb976193f81a01bf67e4bbf3f07357f
59
60
real    0m10.383s
61
user    0m0.015s
62
sys     0m0.000s
63
</pre>
64
65 7 Greg Burri
h4. Release mode (-02)
66 5 Greg Burri
67 6 Greg Burri
Speed : 165.1 MB/s
68 5 Greg Burri
69
<pre>
70
$ time ./release/01_SHA1.exe all ~/data.bin
71
ca6fa5e8eeb976193f81a01bf67e4bbf3f07357f
72
73
real    0m4.360s
74
user    0m0.000s
75
sys     0m0.015s
76
</pre>
77
78
h3. QCryptographicHash
79
80 7 Greg Burri
h4. Debug mode
81 5 Greg Burri
82
Speed :21 MB/s
83
84
<pre>
85
$ time ./debug/01_SHA1.exe all ~/data.bin
86
ca6fa5e8eeb976193f81a01bf67e4bbf3f07357f
87
88
real    0m34.223s
89
user    0m0.015s
90
sys     0m0.000s
91
</pre>
92
93 7 Greg Burri
h4. Release mode (-02)
94 5 Greg Burri
95
Speed : 164.4 MB/s
96
97
<pre>
98
$ time ./release/01_SHA1.exe all ~/data.bin.mkv
99
ca6fa5e8eeb976193f81a01bf67e4bbf3f07357f
100
101
real    0m4.380s
102
user    0m0.000s
103
sys     0m0.015s
104
</pre>
105 1 Greg Burri
106 6 Greg Burri
h2. Conclusions
107
108
* The Qt implementation is fast and can be used without problem.
109
* The Qt implementation in debug mode is *very* slow, be careful.