xor static method

Implementation

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

  final ret = Uint8List(a.length);

  final aIter = a.iterator;
  final bIter = b.iterator;
  for (int i = 0; i < ret.length; i++) {
    aIter.moveNext();
    bIter.moveNext();
    ret[i] = aIter.current ^ bIter.current;
  }

  return ret;
}