- Home /
ICryptoTransform can not work on the Android phone
public static string Encrypt(string data, string secret) {
TripleDESCryptoServiceProvider des = new TripleDESCryptoServiceProvider();
MD5 md5 = MD5.Create();
string key = GetMd5Hash(md5, secret);
byte[] finalKey = System.Text.Encoding.UTF8.GetBytes(key);
des.Mode = CipherMode.ECB;
des.Key = finalKey;
des.Padding = PaddingMode.PKCS7;
ICryptoTransform DESEncrypt = des.CreateEncryptor();
Byte[] Buffer = ASCIIEncoding.ASCII.GetBytes(data);
return (Convert.ToBase64String(DESEncrypt.TransformFinalBlock(Buffer, 0, Buffer.Length)));
}
The encryption code works fine on Unity 5.1 and Android as well, when i changed my Unity version to 5.3, it works on the PC(I can get the encrypt result and print it in editor) but failed on Android, i tried to do debug on Android, it doesn't return a result because the script was stop in the ICryptoTransform DESEncrypt = des.CreateEncryptor(); line. Is that an Unity bug ? because it works fine in the older version, and also can work on the PC in Unity 5.3 version but fail on Android. Thanks for the help
Your answer

Follow this Question
Related Questions
iOS FPS Kit 0 Answers
HELP Build error for Android Unity 2018.2.21f1 in Google Services 0 Answers
Error Code BCE0044 1 Answer
FPS Gun Script Definition error 1 Answer
Strange things appear on Android Build. 0 Answers