This content has been marked as final. Show 3 replies
update expects a call to doFinal to finalise the operation. Update can produce output and does not require the input to be block alligned. It will perform as much of the operation as possible and store any remaining input until the next call to either update or doFinal. The padding will be applied when doFinal is called since the padding goes on the end.
If you use one of the NO_PAD algorithms and you've got data that isn't a block multiple in length, then you have to manually add the padding as the last part of the data processed. You can do that in the last update (and have a doFinal that processes 0 bytes), in the doFinal, or split across the last update and the doFinal.
If you're using an algorithm that pads, see safarmer's response.