CRC32Stream.st
changeset 4238 ab8390ef187a
parent 3024 c7022e1963b0
child 4845 36770d6f14bf
--- a/CRC32Stream.st	Fri Dec 16 14:23:00 2016 +0100
+++ b/CRC32Stream.st	Tue Dec 20 22:39:17 2016 +0100
@@ -11,6 +11,8 @@
 "
 "{ Package: 'stx:libbasic2' }"
 
+"{ NameSpace: Smalltalk }"
+
 HashStream subclass:#CRC32Stream
 	instanceVariableNames:'crc generatorPolynom crcTable'
 	classVariableNames:'CrcTables'
@@ -39,15 +41,15 @@
     Standard CRC method as defined by ISO 3309 [ISO-3309] or ITU-T V.42 [ITU-T-V42].
     The default CRC polynomial employed is
 
-	x^32+x^26+x^23+x^22+x^16+x^12+x^11+x^10+x^8+x^7+x^5+x^4+x^2+x+1
-	(or 16r04C11DB7)
+        x^32+x^26+x^23+x^22+x^16+x^12+x^11+x^10+x^8+x^7+x^5+x^4+x^2+x+1
+        (or 16r04C11DB7)
 
     You can also create an instace performing the Castagnioli CRC-32C
     (used in iSCSI & SCTP, G.hn payload, SSE4.2):
 
-	self newCrc32c
+        self newCrc32c
 
-	x32 + x28 + x27 + x26 + x25 + x23 + x22 + x20 + x19 + x18 + x14 + x13 + x11 + x10 + x9 + x8 + x6 + 1
+        x32 + x28 + x27 + x26 + x25 + x23 + x22 + x20 + x19 + x18 + x14 + x13 + x11 + x10 + x9 + x8 + x6 + 1
 
     Only use CRC to protect against communication errors;
     do NOT use CRC for cryptography - use SHA1Stream or MD5Stream instead.
@@ -56,19 +58,20 @@
     directly affects png image processing.
 
     throughput:
-	157000 Kb/s on a 2.5Ghz 64X2 Athlon 4800+ (64bit)
-	150000 Kb/s on 2Ghz Duo
+        220 Mb/s on MacBook Pro (2.6Ghz I7)
+        157000 Kb/s on a 2.5Ghz 64X2 Athlon 4800+ (64bit)
+        150000 Kb/s on 2Ghz Duo
 
     [author:]
-	Stefan Vogel (stefan@zwerg)
+        Stefan Vogel (stefan@zwerg)
 
     [instance variables:]
 
     [class variables:]
 
     [see also:]
-	SHA1Stream
-	MD5Stream
+        SHA1Stream
+        MD5Stream
 
 "
 !
@@ -77,52 +80,52 @@
 "
 
   expect 60C1D0A0
-								[exBegin]
+                                                                [exBegin]
     self information:(CRC32Stream hashValueOf:'resume') hexPrintString
-								[exEnd]
+                                                                [exEnd]
 
   expect 16r60C1D0A0
-								[exBegin]
+                                                                [exBegin]
     self information:(CRC32Stream new
-			    nextPut:$r;
-			    nextPut:$e;
-			    nextPut:$s;
-			    nextPut:$u;
-			    nextPut:$m;
-			    nextPut:$e;
-			    hashValue) hexPrintString
-								[exEnd]
+                            nextPut:$r;
+                            nextPut:$e;
+                            nextPut:$s;
+                            nextPut:$u;
+                            nextPut:$m;
+                            nextPut:$e;
+                            hashValue) hexPrintString
+                                                                [exEnd]
 
   expect 16r70E46888:
-								[exBegin]
+                                                                [exBegin]
     self information:(CRC32Stream hashValueOf:#[1 2 3 4 5 6 7]) hexPrintString
-								[exEnd]
+                                                                [exEnd]
 
   expect 16r8CD04C73:
-								[exBegin]
+                                                                [exBegin]
     self information:((CRC32Stream hashValueOf:#[16rFF 16rFF 16rFF 16rFF 16rFF 16rFF 16rFF 16rFF 16rFF 16rFF
-	     16rFF 16rFF 16rFF 16rFF 16rFF 16rFF 16rFF 16rFF 16rFF 16rFF
-	     16rFF 16rFF 16rFF 16rFF 16rFF 16rFF 16rFF 16rFF 16rFF 16rFF
-	     16rFF 16rFF 16rFF 16rFF 16rFF 16rFF 16rFF 16rFF 16rFF 16rFF]) hexPrintString)
-								[exEnd]
+             16rFF 16rFF 16rFF 16rFF 16rFF 16rFF 16rFF 16rFF 16rFF 16rFF
+             16rFF 16rFF 16rFF 16rFF 16rFF 16rFF 16rFF 16rFF 16rFF 16rFF
+             16rFF 16rFF 16rFF 16rFF 16rFF 16rFF 16rFF 16rFF 16rFF 16rFF]) hexPrintString)
+                                                                [exEnd]
 
   expect 16r86D7D79A:
   timing throughput:
-								[exBegin]
+                                                                [exBegin]
     |hashStream n t|
 
     hashStream := CRC32Stream new.
     n := 1000000.
     t := Time millisecondsToRun:[
-	    n timesRepeat:[
-		hashStream nextPutAll:'12345678901234567890123456789012345678901234567890'.
-	    ].
-	 ].
+            n timesRepeat:[
+                hashStream nextPutAll:'12345678901234567890123456789012345678901234567890'.
+            ].
+         ].
     t := (t / 1000) asFloat.
     Transcript show:'crc32:'; showCR: hashStream hashValue hexPrintString.
     Transcript show:t; show:' seconds for '; show:(50*n/1024) asFloat; showCR:' Kb'.
     Transcript show:(n*50/1024 / t); showCR:' Kb/s'
-								[exEnd]
+                                                                [exEnd]
 
 "
 ! !
@@ -350,11 +353,11 @@
 !CRC32Stream class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic2/CRC32Stream.st,v 1.27 2013-07-02 11:55:39 stefan Exp $'
+    ^ '$Header$'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libbasic2/CRC32Stream.st,v 1.27 2013-07-02 11:55:39 stefan Exp $'
+    ^ '$Header$'
 ! !