HashStream.st
changeset 19644 b1ca9bfcb4ac
parent 19439 6015d8264192
child 19659 0f585374259a
child 21394 52c5888621c2
equal deleted inserted replaced
19643:98714992ae69 19644:b1ca9bfcb4ac
   184     "Modified (comment): / 09-01-2012 / 21:49:59 / cg"
   184     "Modified (comment): / 09-01-2012 / 21:49:59 / cg"
   185 ! !
   185 ! !
   186 
   186 
   187 !HashStream class methodsFor:'utilities'!
   187 !HashStream class methodsFor:'utilities'!
   188 
   188 
   189 cryptBlock:aStringOrByteArray from:srcIdx into:resultOrNil startingAt:dstIdx encrypt:encryptMode
   189 cryptBlock:aStringOrByteArray from:srcIdx to:srcEndOrNil into:resultOrNil startingAt:dstIdx encrypt:encryptMode
   190     "one-way encryption of aStringOrByteArray.
   190     "one-way encryption of aStringOrByteArray.
   191      Used when a HashStream is used as the block copher with OFB or CTR mode.
   191      Used when a HashStream is used as the block cipher with OFB or CTR mode.
   192 
   192 
   193      encryptMode is ignored here."
   193      encryptMode is ignored here."
   194 
   194 
   195     |hashValue|
   195     |hashValue|
   196 
   196 
   197     srcIdx == 1 ifTrue:[
   197     (srcIdx == 1 and:[srcEndOrNil isNil]) ifTrue:[
   198         hashValue := self hashValueOf:aStringOrByteArray.
   198         hashValue := self hashValueOf:aStringOrByteArray.
   199     ] ifFalse:[
   199     ] ifFalse:[
   200         |bytesToEncrypt|
   200         |bytesToEncrypt|
   201 
   201 
   202         bytesToEncrypt := aStringOrByteArray copyFrom:srcIdx to:srcIdx+self hashSize-1.
   202         bytesToEncrypt := aStringOrByteArray copyFrom:srcIdx to:srcIdx+self hashSize-1.