xorEncodeStringToBytes method

List<int> xorEncodeStringToBytes(
  1. String content, {
  2. String? secretKey,
})

string to bytes xor encryption

Implementation

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