doFinal method
Finish the operation either appending or verifying the MAC at the end of the data.
Returns the number of bytes written to the output.
Implementation
@override
int doFinal(Uint8List out, int outOff) {
  var result = remainingInput.isNotEmpty
      ? processBlock(remainingInput, 0, out, outOff)
      : 0;
  var len = Uint8List.view((Uint32List(4)
        ..[2] = aad!.length * 8
        ..[0] = _processedBytes * 8)
      .buffer);
  len = Uint8List.fromList(len.reversed.toList());
  _gHASHBlock(_x, len);
  _xor(_x, _e0);
  if (forEncryption) {
    out.setAll(outOff + result, _x);
    result += _x.length;
  }
  validateMac();
  return result;
}