Project

General

Profile

SHA-1 prototype (oldHaskell) » History » Revision 4

Revision 3 (Greg Burri, 03/27/2009 02:48 PM) → Revision 4/6 (Greg Burri, 03/29/2009 07:42 PM)

h1. SHA-1 prototype 

 h2. Goals 

 * Compute the SHA-1 of each part of a given file. 
 * Compute the SHA-1 of a stream. 

 h2. Speed measures 

 file : @01.wmv@ : 17'639'245 byte ~ 17Mo 

 h3. sha1sum from GNU coreutils (Reference) 

 speed : 57 173 MB/s 

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

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

 h3. "SHA 1.2.0":http://hackage.haskell.org/cgi-bin/hackage-scripts/package/SHA-1.2.0 

 file : _Hash.hs_ 
 speed : 4 18 times slower (14 (13 MB/s) 

 <pre> 
 <gburri@overnux:~/code/lang/haskell/SHA1$> ghc --make -O2 Hash.hs -o hash && time ./hash 01.wmv 
 [0 - 3aec84601612e8c604ac01971e0ecd9d536dbead] 

 real      0m1.214s 0m1.244s 
 user      0m1.200s 0m1.212s 
 sys       0m0.012s$ 0m0.036s$ 
 </pre> 


 h3. "Crypto 4.2.0":http://hackage.haskell.org/cgi-bin/hackage-scripts/package/Crypto-4.2.0 

 file : _Hash2.hs_ 
 speed : 267 times slower (1 MB/s) : 

 <pre> 
 <gburri@overnux:~/code/lang/haskell/SHA1$> ghc --make -O2 Hash2.hs -o hash2 && time ./hash2 01.wmv 
 [0 - Word160 988578912 370337990 78381463 504286621 1399701165] 

 real      0m7.628s 0m17.078s 
 user      0m7.576s 0m16.921s 
 sys       0m0.028s 0m0.072s 
 </pre> 

 h3. Binding with sha1.h from coreutils 

 file : _Hash3.hs_ 

 TODO...