private static string UnEncryptString01(string CallPassword, string d) { if (CallPassword != GetCallCert()) { return(""); } if ((d == null) || (d == "")) { return(""); } int i; ReplaceKey_01 rk = new ReplaceKey_01(); for (i = 51; i >= 0; i--) { d = d.Replace(rk.Key[1, i], rk.Key[0, i]); } int len, Key = int.Parse(d.Substring(0, 3)); d = d.Substring(3, d.Length - 3); len = d.Length / 3; byte[] Byte = new byte[len]; for (i = 0; i < len; i++) { Byte[i] = (byte)(int.Parse(d.Substring(i * 3, 3)) - Key); } return(Shove._String.Decompress(Byte)); }
private static string EncryptString01(string CallPassword, string s) { if (CallPassword != GetCallCert()) { return(""); } if (s == "") { return(""); } byte[] Byte = Shove._String.Compress(s); int len = Byte.Length; int Key = (System.DateTime.Now.Millisecond + 200) / 2; string d = Key.ToString().PadLeft(3, '0'); for (int i = 0; i < len; i++) { d += ((int)Byte[i] + Key).ToString().PadLeft(3, '0'); } ReplaceKey_01 rk = new ReplaceKey_01(); for (int i = 0; i < 52; i++) { d = d.Replace(rk.Key[0, i], rk.Key[1, i]); } return(d); }
private static string UnEncryptString03(string CallPassword, string d) { if (CallPassword != GetCallCert()) { return(""); } if ((d == null) || (d == "") || (d.Length < 2) || (!d.StartsWith("03"))) { return(""); } d = d.Substring(2, d.Length - 2); int i; ReplaceKey_01 rk = new ReplaceKey_01(); for (i = 51; i >= 0; i--) { d = d.Replace(rk.Key[1, i], rk.Key[0, i]); } int len, Key = int.Parse(d.Substring(0, 3)); int[] Keys = new int[3]; Keys[0] = Key / 100; Keys[1] = (Key % 100) / 10; Keys[2] = (Key % 10); d = d.Substring(3, d.Length - 3); len = d.Length / 3; byte[] Byte = new byte[len]; for (i = 0; i < len; i++) { Byte[i] = (byte)(int.Parse(d.Substring(i * 3, 3)) - Keys[i % 3]); } return(System.Text.Encoding.UTF8.GetString(Byte)); }
private static string EncryptString03(string CallPassword, string s) { if (CallPassword != GetCallCert()) { return(""); } if (s == "") { return(""); } byte[] Byte = System.Text.Encoding.UTF8.GetBytes(s); int len = Byte.Length; int Key = (System.DateTime.Now.Millisecond + 200) / 2; int[] Keys = new int[3]; Keys[0] = Key / 100; Keys[1] = (Key % 100) / 10; Keys[2] = (Key % 10); string d = Key.ToString().PadLeft(3, '0'); for (int i = 0; i < len; i++) { int t = Byte[i]; t += Keys[i % 3]; d += t.ToString().PadLeft(3, '0'); } ReplaceKey_01 rk = new ReplaceKey_01(); for (int i = 0; i < 52; i++) { d = d.Replace(rk.Key[0, i], rk.Key[1, i]); } return("03" + d); }