xorToByteData static method

void xorToByteData(
  1. ByteData a,
  2. Iterable<int> b
)

Implementation

static void xorToByteData(ByteData a, Iterable<int> b) {
  if (a.lengthInBytes != b.length) {
    throw Exception('Lengths of a and b do not match');
  }

  int length = a.lengthInBytes;

  final bIter = b.iterator;
  for (int i = 0; i < length; i++) {
    bIter.moveNext();
    a.setUint8(i, a.getUint8(i) ^ bIter.current);
  }
}