processData method

int processData(
  1. Uint8List buff,
  2. int start,
  3. int len
)

Implementation

int processData(Uint8List buff, int start, int len) {
  if (!encrypt) _macGen.update(buff, 0, len);

  for (int j = start; j < start + len; j += 16) {
    int loopCount = j + 16 <= start + len ? 16 : start + len - j;
    AesCipherUtil.prepareBuffAESIVBytes(iv, nonce);
    aesEngine?.processBlock(iv, 0, counterBlock, 0);
    for (int k = 0; k < loopCount; ++k) {
      buff[j + k] ^= counterBlock[k];
    }
    ++nonce;
  }

  if (encrypt) _macGen.update(buff, 0, len);

  mac = Uint8List(_macGen.macSize);
  _macGen.doFinal(mac, 0);
  mac = mac.sublist(0, 10);
  _macGen.reset();

  return len;
}