--- a/SHA1Stream.st Thu Mar 01 20:44:24 2018 +0100
+++ b/SHA1Stream.st Fri Mar 02 17:09:11 2018 +0100
@@ -1,3 +1,5 @@
+"{ Encoding: utf8 }"
+
"
COPYRIGHT (c) 1999-2013 by eXept Software AG
All Rights Reserved
@@ -518,6 +520,39 @@
"Created: / 18-03-1999 / 07:59:02 / stefan"
"Modified: / 12-01-2012 / 12:21:23 / cg"
+!
+
+seedWith:fiveWordVector
+ "seed the stream with 5*16 (for testing)"
+
+ |seedA seedB seedC seedD seedE|
+
+ seedA := fiveWordVector at:1.
+ seedB := fiveWordVector at:1.
+ seedC := fiveWordVector at:1.
+ seedD := fiveWordVector at:1.
+ seedE := fiveWordVector at:1.
+ self reset.
+%{
+ if (__isByteArray(__INST(hashContext))
+ && (__byteArraySize(__INST(hashContext)) == sizeof(SHA1_CTX))
+ && __isSmallInteger(seedA)
+ && __isSmallInteger(seedB)
+ && __isSmallInteger(seedC)
+ && __isSmallInteger(seedD)
+ && __isSmallInteger(seedE)
+ ) {
+ SHA1_CTX *ctx = (SHA1_CTX *)__ByteArrayInstPtr(__INST(hashContext))->ba_element;
+
+ ctx->state[0] = __intVal(seedA);
+ ctx->state[1] = __intVal(seedB);
+ ctx->state[2] = __intVal(seedC);
+ ctx->state[3] = __intVal(seedD);
+ ctx->state[4] = __intVal(seedE);
+ RETURN(self);
+ }
+%}.
+ ^ self primitiveFailed
! !
!SHA1Stream methodsFor:'queries'!