--- a/SHA1Stream.st Mon Jan 09 21:18:47 2012 +0100
+++ b/SHA1Stream.st Mon Jan 09 21:18:59 2012 +0100
@@ -542,84 +542,6 @@
!SHA1Stream methodsFor:'writing'!
-nextPut:anObject
- "update our hash value for anObject.
- anObject may be a String, a Character, a Smallinteger or an Array of primitive
- types like ByteArray.
- "
-
- |ret|
-
-%{
- if (__isNonNilObject(__INST(hashContext)) &&
- __qClass(__INST(hashContext)) == @global(ByteArray) &&
- __byteArraySize(__INST(hashContext)) == sizeof(SHA1_CTX)
- ) {
- SHA1_CTX *ctx =
- (SHA1_CTX *)__ByteArrayInstPtr(__INST(hashContext))->ba_element;
-
- if (__isNonNilObject(anObject)) {
- OBJ cls =__qClass(anObject);
- INT mask = (INT)(__ClassInstPtr(cls)->c_flags) & __MASKSMALLINT(ARRAYMASK);
-
- if (cls == @global(String) || cls == @global(Symbol)) {
- /* String: omit leading '\0' */
-
- SHA1Update(ctx, __StringInstPtr(anObject)->s_element, __stringSize(anObject));
- } else if (mask != __MASKSMALLINT(POINTERARRAY) &&
- mask != __MASKSMALLINT(WKPOINTERARRAY) &&
- mask != __MASKSMALLINT(0)
- ) {
- /* Byte|Integer|.... Array */
-
- register int n;
- char *pFirst;
-
- n /* nInstVars */ = __intVal(__ClassInstPtr(cls)->c_ninstvars);
- n /* nInstBytes */ = OHDR_SIZE + __OBJS2BYTES__(n /* nInstVars */);
- pFirst = (char *)(__InstPtr(anObject)) + n /* nInstBytes */;
- n /* nbytes */ = __qSize(anObject) - n /* nInstBytes */;
- SHA1Update(ctx, pFirst, n);
- } else if (cls == @global(Character)) {
- /* Character */
-
- INT val = __intVal(_characterVal(anObject));
- if (val > 255) {
- /* Two byte character */
- short s = val;
- SHA1Update(ctx, (char *)&s, 2);
- } else {
- char c = val;
- SHA1Update(ctx, &c, 1);
- }
- } else {
- ret = false;
- }
- } else {
- if (anObject == nil) {
- ret = false;
- } else {
- /* SmallInteger */
- // cg: I hope, noone used that interface; it depended on the machines byteorder !
-#if 0
- INT i = __intVal(anObject);
- SHA1Update(ctx, (char *)&i, sizeof(INT));
-#else
- ret = false;
-#endif
- }
- }
- }
-%}.
-
- ret notNil ifTrue:[
- ^ self primitiveFailed
- ].
-
- "Created: / 17-03-1999 / 16:14:13 / stefan"
- "Modified: / 08-01-2012 / 01:48:44 / cg"
-!
-
nextPutBytes:count from:anObject startingAt:start
"update the hash value with count bytes from an object starting at index start.
The object must have non-pointer indexed instvars
@@ -689,11 +611,11 @@
!SHA1Stream class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/SHA1Stream.st,v 1.21 2012-01-08 00:57:43 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/SHA1Stream.st,v 1.22 2012-01-09 20:18:59 cg Exp $'
!
version_CVS
- ^ '$Header: /cvs/stx/stx/libbasic/SHA1Stream.st,v 1.21 2012-01-08 00:57:43 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/SHA1Stream.st,v 1.22 2012-01-09 20:18:59 cg Exp $'
! !
SHA1Stream initialize!