changed:
authorStefan Vogel <sv@exept.de>
Fri, 13 May 2011 12:42:54 +0200
changeset 2569 abfbf6f1682b
parent 2568 4b0180395472
child 2570 55ce3e8bd7dc
changed: #documentation #initialize #testVector
CRC32Stream.st
--- a/CRC32Stream.st	Thu May 12 13:54:47 2011 +0200
+++ b/CRC32Stream.st	Fri May 13 12:42:54 2011 +0200
@@ -40,7 +40,7 @@
     The 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 16r82608EDB)
+        (or 16r04C11DB7)
 
     Use CRC to protect against communication errors;
     do NOT use CRC for cryptography - use SHA1Stream or MD5Stream instead.
@@ -134,6 +134,7 @@
         i := count.
         8 timesRepeat:[
             (i bitTest:1) ifTrue:[
+"/                i := 16r1EDC6F41 bitXor:(i bitShift:-1)
                 i := 16rEDB88320 bitXor:(i bitShift:-1)
             ] ifFalse:[
                 i := i bitShift:-1
@@ -153,6 +154,10 @@
     "define a testvector to test the implementation"
 
     ^ #(
+          ('' 0)
+
+          ('123456789' 16rCBF43926)
+
           (#[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
@@ -318,11 +323,11 @@
 !CRC32Stream class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic2/CRC32Stream.st,v 1.13 2011-05-10 14:27:15 stefan Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic2/CRC32Stream.st,v 1.14 2011-05-13 10:42:54 stefan Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libbasic2/CRC32Stream.st,v 1.13 2011-05-10 14:27:15 stefan Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic2/CRC32Stream.st,v 1.14 2011-05-13 10:42:54 stefan Exp $'
 ! !
 
 CRC32Stream initialize!