SHA1Stream.st
branchjv
changeset 19412 1e842c25e51e
parent 19167 699eef1bc815
parent 19400 730bc6efb733
child 21246 958aa6e341d4
equal deleted inserted replaced
19411:05866fa42fc5 19412:1e842c25e51e
   548     "Modified: / 18.3.1999 / 08:00:54 / stefan"
   548     "Modified: / 18.3.1999 / 08:00:54 / stefan"
   549 ! !
   549 ! !
   550 
   550 
   551 !SHA1Stream methodsFor:'writing'!
   551 !SHA1Stream methodsFor:'writing'!
   552 
   552 
       
   553 nextPutByte:anInteger
       
   554     "update the hash value with anInteger <= 255."
       
   555 
       
   556 %{
       
   557    if (__isSmallInteger(anInteger) && __intVal(anInteger) <= 255
       
   558        && __isByteArray(__INST(hashContext))
       
   559        && __byteArraySize(__INST(hashContext)) == sizeof(SHA1_CTX)
       
   560    ) {
       
   561         SHA1_CTX *ctx = (SHA1_CTX *)__ByteArrayInstPtr(__INST(hashContext))->ba_element;
       
   562         unsigned char value = __intVal(anInteger);
       
   563 
       
   564         SHA1Update(ctx, &value, 1);
       
   565         RETURN(self);
       
   566     }
       
   567 bad: ;
       
   568 %}.
       
   569 
       
   570     ^ self primitiveFailed
       
   571 !
       
   572 
   553 nextPutBytes:count from:anObject startingAt:start
   573 nextPutBytes:count from:anObject startingAt:start
   554     "update the hash value with count bytes from an object starting at index start.
   574     "update the hash value with count bytes from an object starting at index start.
   555      The object must have non-pointer indexed instvars
   575      The object must have non-pointer indexed instvars
   556      (i.e. be a ByteArray, String, Float- or DoubleArray),
   576      (i.e. be a ByteArray, String, Float- or DoubleArray),
   557      or an externalBytes object (with known size)"
   577      or an externalBytes object (with known size)"