乱码加密解密
加密后
乱码加密解密 加密后 /// <summary> /// 加密 /// </summary> /// <param name="str"></param> /// <param name="key">数值1-1024</param> /// <returns>加密后文件是乱码的</returns> public static string MakePasswordText(string str, int key) { //string str = "ABCED"; string s = ""; foreach (char ch in str) { s += (char)((int)ch + key); } return s; } 解密后 /// <summary> /// 解密 /// </summary> /// <param name="str"></param> /// <param name="key"></param> /// <returns></returns> public static string JMText(string str, int key) { //string str = "ABCED"; string s = ""; foreach (char ch in str) { s += (char)((int)ch - key); } return s; }
解密后