xorEncodeBytesToString method

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

bytes to string xor encryption

Implementation

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