processBlock method
Process a whole block of data given by inp
and starting at offset
inpOff
.
The resulting cipher text is put in out
beginning at position outOff
.
This method returns the total bytes processed (which is the same as the block size of the algorithm).
Implementation
@override
int processBlock(Uint8List inp, int inpOff, Uint8List out, int outOff) {
var length =
blockSize < inp.length - inpOff ? blockSize : inp.length - inpOff;
var i = Uint8List(blockSize);
i.setAll(0, inp.skip(inpOff).take(length));
_processedBytes += length;
_getNextCTRBlock(_e);
var o = Uint8List.fromList(i);
_xor(o, _e);
if (length < blockSize) o.fillRange(length, blockSize, 0);
out.setRange(outOff, outOff + length, o);
var c = forEncryption ? o : i;
_gHASHBlock(_x, c);
return length;
}