public static int GetUseTick(string info, string key, bool isdate) { int count = 0, error = 0; if (key.Length > 50) { string mw16 = MyEncrypt.GetMd5_16(info, true); string mw32 = MyEncrypt.GetMD5(info); string qian8 = key.Substring(0, 8); string num = MyEncrypt.FanZhuan(key.Substring(8, 4)); string zhong8 = key.Substring(12, 8); string date = MyEncrypt.DecryptB(MyEncrypt.FanZhuan(key.Substring(20, key.Length - 28))); mw16 = MyEncrypt.getRjCode(NumerStrToList(qian8), MyEncrypt.split(mw16)); mw32 = MyEncrypt.getRjCode(NumerStrToList(zhong8), MyEncrypt.split(mw32)); string str1 = mw16 + mw32; string str2 = key.Substring(key.Length - 8, 8); string today = DateTime.Now.Year + bu0(DateTime.Now.Month) + bu0(DateTime.Now.Day); Regex r = new Regex(@"^[0-9]*$"); int d1 = int.Parse(date); int d2 = int.Parse(today); if (!r.IsMatch(qian8)) { error++; } if (!r.IsMatch(zhong8)) { error++; } if (!r.IsMatch(date)) { error++; } if (!str1.Equals(str2)) { error++; } if (d1 > d2) { error++; } if (isdate && (d2 - d1) > 1) { error++; } if (error == 0) { num = MyEncrypt.CharToNumerStr(num); count = int.Parse(num); } else { count = count - error; } } return(count); }
public static string CreateKey(string info, string s) { string mw16 = MyEncrypt.GetMd5_16(info, true); string mw32 = MyEncrypt.GetMD5(info); List <int> i41 = MyEncrypt.GenerateNumber(4, 16); List <int> i42 = MyEncrypt.GenerateNumber(4, 32); mw16 = MyEncrypt.getRjCode(i41, MyEncrypt.split(mw16)); mw32 = MyEncrypt.getRjCode(i42, MyEncrypt.split(mw32)); string date = DateTime.Now.Year + bu0(DateTime.Now.Month) + bu0(DateTime.Now.Day); return(ListToString(i41) + MyEncrypt.FanZhuan(MyEncrypt.getNumChar(s)) + ListToString(i42) + MyEncrypt.FanZhuan(MyEncrypt.EncryptA(date)) + mw16 + mw32); }