decodeString method
Decodes a string into the original one via RC4 encryption.
Please note that the method uses UTF-8 text encoding when converting strings to binary data. If you want to use another string encoding, please convert your string into bytes using your own encoding and pass your data to RC4.decodeBytes.
encodeBase64
represents if the input is base64 encoded.
Implementation
String decodeString(String message,
[bool encodedBase64 = true, allowMalformed = false]) {
if (encodedBase64) {
var bytes = base64.decode(message);
var crypted = _crypt(bytes);
return utf8.decode(crypted, allowMalformed: allowMalformed);
}
var decrypted = _crypt(utf8.encode(message));
return utf8.decode(decrypted, allowMalformed: allowMalformed);
}