encryptInPlace method
Encrypts data[start..end) in place; the length must be a multiple
of 16.
Implementation
void encryptInPlace(Uint8List data, [int start = 0, int? end]) {
final stop = RangeError.checkValidRange(start, end, data.length);
if ((stop - start) % 16 != 0) {
throw ArgumentError('CBC input must be a multiple of 16 bytes');
}
final prev = _prev;
for (var i = start; i < stop; i += 16) {
for (var j = 0; j < 16; j++) {
data[i + j] ^= prev[j];
}
_cipher.encryptBlock(data, i, data, i);
prev.setRange(0, 16, data, i);
}
}