doFinal method

  1. @override
int doFinal(
  1. Uint8List out,
  2. int outOff
)
override

Store the MAC of previously given data in buffer out starting at offset outOff. This method returns the size of the digest.

Implementation

@override
int doFinal(Uint8List out, int outOff) {
  var blockSize = _cipher.blockSize;

  Uint8List? lu;
  if (_bufOff == blockSize) {
    lu = _lu;
  } else {
    ISO7816d4Padding().addPadding(_buf, _bufOff);
    lu = _lu2;
  }

  for (var i = 0; i < _mac.length; i++) {
    _buf[i] ^= lu[i];
  }

  _cipher.processBlock(_buf, 0, _mac, 0);

  out.setRange(outOff, outOff + _macSize, _mac);

  reset();

  return _macSize;
}