process method
Process a whole block of blockSize bytes stored in data
at once, returning the result in a
byte array.
This call is equivalent to processBlock but it allocates the array under the hood.
Implementation
@override
Uint8List process(Uint8List data) {
if (isEncrypting!) {
var ciphertext = processBlocks(data);
var tag = finalizeTag();
var out = Uint8List(ciphertext.length + tag.length);
out.setAll(0, ciphertext);
out.setAll(ciphertext.length, tag);
return out;
} else {
var ciphertext = Uint8List.view(
data.buffer, data.offsetInBytes, data.length - tagLength);
var inTag =
Uint8List.view(data.buffer, data.offsetInBytes + ciphertext.length);
var plaintext = processBlocks(ciphertext);
var tag = finalizeTag();
if (!_compareList(inTag, tag)) {
throw 'Auth error';
}
return plaintext;
}
}