processBlocks method

  1. @override
Uint8List processBlocks(
  1. Uint8List data
)
override

Implementation

@override
Uint8List processBlocks(Uint8List data) {
  var out = _underlyingCipher.process(data);

  var ciphertext = isEncrypting! ? out : data;

  var hashInput = Uint8List(aad!.length + iv!.length + ciphertext.length + 8);

  var al = aad!.length * 8;
  hashInput.setAll(0, aad!);
  hashInput.setAll(aad!.length, iv!);
  hashInput.setAll(aad!.length + iv!.length, ciphertext);
  for (var i = hashInput.length - 1; i > (hashInput.length - 8); i--) {
    hashInput[i] = al % 256;
    al >>= 8;
  }

  _hash = _underlyingMac.process(hashInput);

  return out;
}