Project

General

Profile

SHA-1 prototype » History » Revision 6

Revision 5 (Greg Burri, 11/18/2009 08:52 PM) → Revision 6/7 (Greg Burri, 11/18/2009 08:54 PM)

h1. SHA-1 prototype 

 directory : source:/prototypes/01_SHA1 

 h2. Goals 

 * Compute the SHA-1 of each part of a given file. 
 * Compute the SHA-1 of a stream. 
 * Find the fastest way to compute SHA1, should be at least 40 MB/s. 

 h2. Speed measures against _sha1sum_ 

 file : @01.wmv@ : 17'639'245 byte ~ 17Mo (buffered) 
 Each measurement is pre-runned once to put the file in cache. 


 h3. _sha1sum_ from _GNU coreutils_ (Reference) 

 speed : 57 MB/s 

 <pre> 
 <gburri@overnux:~/code/lang/haskell/SHA1$> time sha1sum < 01.wmv 
 3aec84601612e8c604ac01971e0ecd9d536dbead    - 

 real      0m0.301s 
 user      0m0.276s 
 sys       0m0.020s 
 </pre> 

 h3. QCryptographicHash (release -O2) 

 speed : 49 MB/s 

 <pre> 
 <flynux:~/code/projects/aybabtu/prototypes/01_SHA1 $> time ./qt_sha1 all 01.wmv  
 3aec84601612e8c604ac01971e0ecd9d536dbead 

 real      0m0.340s 
 user      0m0.324s 
 sys       0m0.016s 
 </pre> 


 h2. Speed measures against _Linus's sha1_ 

 file : @test.bin@ : 754'856'284 byte ~ 720Mo (buffered) 
 Each measurement is pre-runned once to put the file in cache. 


 h3. _Linus's sha1_ 

 h2. Debug mode 

 Speed : 69.3 MB/s 

 <pre> 
 $ time ./debug/01_SHA1.exe all ~/data.bin 
 ca6fa5e8eeb976193f81a01bf67e4bbf3f07357f 

 real      0m10.383s 
 user      0m0.015s 
 sys       0m0.000s 
 </pre> 

 h2. Release mode (-02) 

 Speed : 165.1 MB/s 

 <pre> 
 $ time ./release/01_SHA1.exe all ~/data.bin 
 ca6fa5e8eeb976193f81a01bf67e4bbf3f07357f 

 real      0m4.360s 
 user      0m0.000s 
 sys       0m0.015s 
 </pre> 

 h3. QCryptographicHash 

 h2. Debug mode 

 Speed :21 MB/s 

 <pre> 
 $ time ./debug/01_SHA1.exe all ~/data.bin 
 ca6fa5e8eeb976193f81a01bf67e4bbf3f07357f 

 real      0m34.223s 
 user      0m0.015s 
 sys       0m0.000s 
 </pre> 

 h2. Release mode (-02) 

 Speed : 164.4 MB/s 

 <pre> 
 $ time ./release/01_SHA1.exe all ~/data.bin.mkv 
 ca6fa5e8eeb976193f81a01bf67e4bbf3f07357f 

 real      0m4.380s 
 user      0m0.000s 
 sys       0m0.015s 
 </pre> 

 h2. Conclusions 

 * The Qt implementation is fast and can be used without problem. 
 * The Qt implementation in debug mode is *very* slow, be careful.