HashStream.st
changeset 12753 3e6acf834564
parent 12418 720aa584e5cf
child 13366 0e1bdf4f4156
--- a/HashStream.st	Thu Mar 04 15:33:51 2010 +0100
+++ b/HashStream.st	Thu Mar 04 15:34:21 2010 +0100
@@ -93,20 +93,25 @@
     "test against testVector"
 
     self testVector do:[:pair |
-        |data expectedHash hashStream|
+        |data expectedHash expectedHashBytes hashStream|
 
         data := pair first.
         expectedHash := pair second.
+        expectedHash isString ifTrue:[
+            expectedHashBytes := ByteArray fromHexString:expectedHash
+        ] ifFalse:[
+            expectedHashBytes := expectedHash
+        ].
 
         self canStream ifTrue:[
             hashStream := self new.
             hashStream nextPut:data.
-            hashStream hashValue ~= expectedHash ifTrue:[
+            hashStream hashValue ~= expectedHashBytes ifTrue:[
                 self error:'Test failed'
             ].
         ].
         "/ non-stream interface must be implemented by all
-        (self hashValueOf:data) ~= expectedHash ifTrue:[
+        (self hashValueOf:data) ~= expectedHashBytes ifTrue:[
             self error:'Test failed'
         ].
     ].
@@ -322,9 +327,9 @@
 !HashStream class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/HashStream.st,v 1.12 2009-11-02 18:40:24 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/HashStream.st,v 1.13 2010-03-04 14:34:21 cg Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libbasic/HashStream.st,v 1.12 2009-11-02 18:40:24 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/HashStream.st,v 1.13 2010-03-04 14:34:21 cg Exp $'
 ! !