decrypt static method
Decrypt a Base64-encoded ciphertext with key using XOR.
Implementation
static String decrypt(String ciphertext, String key) {
if (key.isEmpty) throw ArgumentError('Key must not be empty');
final data = base64.decode(ciphertext);
final keyBytes = utf8.encode(key);
final result = Uint8List(data.length);
for (var i = 0; i < data.length; i++) {
result[i] = data[i] ^ keyBytes[i % keyBytes.length];
}
return utf8.decode(result);
}