Exemple #1
0
        public static string GetString(string key, string defaultValue = default(string))
        {
            var result = PlayerPrefs.GetString(MD5Util.GetMd5(key));

            return(string.IsNullOrEmpty(result) ? defaultValue : AESUtil.Decrypt(result, AESKey.DefaultKey, AESKey.DefaultIV));
        }
Exemple #2
0
 public static void SetString(string key, string value)
 {
     PlayerPrefs.SetString(MD5Util.GetMd5(key), AESUtil.Encrypt(value, AESKey.DefaultKey, AESKey.DefaultIV));
 }
Exemple #3
0
        public static void WriteAllBytes(string path, byte[] bytes, string key, string iv)
        {
            var bs = AESUtil.Encrypt(bytes, key, iv);

            File.WriteAllBytes(path, bs);
        }
Exemple #4
0
        public static byte[] ReadAllBytes(string path, string key, string iv)
        {
            var text = File.ReadAllBytes(path);

            return(AESUtil.Decrypt(text, key, iv));
        }
Exemple #5
0
        public static void WriteAllText(string path, string text, string key, string iv)
        {
            var bs = AESUtil.Encrypt(text, key, iv);

            File.WriteAllText(path, bs);
        }
Exemple #6
0
        public static string ReadAllText(string path, string key, string iv)
        {
            var text = File.ReadAllText(path);

            return(AESUtil.Decrypt(text, key, iv));
        }