xor static method

Uint8List xor(
  1. List<int> a,
  2. List<int> b
)

XOR two byte arrays of the same length.

Implementation

static Uint8List xor(List<int> a, List<int> b) {
  if (a.length != b.length) {
    throw ArgumentError('Byte arrays must have the same length');
  }

  final result = Uint8List(a.length);
  for (var i = 0; i < a.length; i++) {
    result[i] = a[i] ^ b[i];
  }

  return result;
}