hashValueOf - generalized
authorpenk
Fri, 07 Feb 2003 12:28:51 +0100
changeset 7014 c443479ee603
parent 7013 993d318775b7
child 7015 862174119468
hashValueOf - generalized
HashStream.st
--- a/HashStream.st	Fri Feb 07 12:28:02 2003 +0100
+++ b/HashStream.st	Fri Feb 07 12:28:51 2003 +0100
@@ -10,11 +10,14 @@
  hereby transferred.
 "
 
+
+"{ Package: 'stx:libbasic' }"
+
 Stream subclass:#HashStream
-        instanceVariableNames:''
-        classVariableNames:''
-        poolDictionaries:''
-        category:'System-Crypt-Streams'
+	instanceVariableNames:''
+	classVariableNames:''
+	poolDictionaries:''
+	category:'System-Crypt-Streams'
 !
 
 !HashStream class methodsFor:'documentation'!
@@ -49,18 +52,35 @@
 
 !HashStream class methodsFor:'instance creation'!
 
+hashValueOf:aStringOrByteArry
+    ^ self hashValueOfStream:(aStringOrByteArry readStream)
+
+    "
+     MD5Stream hashValueOf:'BlaBlaBla'
+    "
+!
+
 hashValueOfFile:aFilename
-    |hashStream inStream|
+    ^ self hashValueOfStream:(aFilename asFilename readStream)
+
+    "
+     MD5Stream hashValueOfFile:'Makefile'
+    "
+!
+
+hashValueOfStream:inStream
+    |hashStream|
 
     hashStream := self new.
-    inStream := aFilename asFilename readStream binary.
+    inStream binary.
     inStream copyToEndInto:hashStream.
     inStream close.
         
     ^ hashStream hashValue
 
     "
-     MD5Stream hashValueOfFile:'Makefile'
+     MD5Stream hashValueOfStream:('Makefile' asFilename readStream)
+     MD5Stream hashValueOfStream:('BlaBla' readStream)
     "
 !
 
@@ -167,5 +187,5 @@
 !HashStream class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/HashStream.st,v 1.1 2002-11-18 12:41:58 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/HashStream.st,v 1.2 2003-02-07 11:28:51 penk Exp $'
 ! !