xorEncodeBytes method

List<int> xorEncodeBytes(
  1. List<int> bytes, {
  2. String? key,
})

bytes xor encryption

Implementation

List<int> xorEncodeBytes(List<int> bytes, {String? key}) {
  this.key = key ?? this.key;
  if (this.key != null && this.key!.isNotEmpty) {
    return _xor(bytes, utf8.encode(this.key!));
  } else {
    return _encrypt(bytes);
  }
}