xorEncodeBytesToString method

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

bytes to string xor encryption

Implementation

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