private static uint String2UInt32(string Str) { uint result; try { result = (uint)(ulong.Parse(Reg.GetMD5Hash(Str), NumberStyles.HexNumber) % 1000000uL); } catch { result = 0u; } return(result); }
public static bool ValidateRegCode2(string Username, string RegCode) { bool result; try { if (RegCode.IndexOf('-') > 0) { string[] strArray = RegCode.Split(new char[] { '-' }); if (strArray.Length != 2) { result = false; return(result); } string str = strArray[0]; string s = strArray[1]; uint num = Reg.String2UInt32(str); if (Reg.GetMD5Hash((uint.Parse(s) - num).ToString()).Equals("B1B77A53F0264B1D")) { Reg._RegOK = true; Reg.RegUser = Username; result = true; return(result); } } result = false; } catch (Exception exception) { MessageBox.Show(exception.Message); result = false; } return(result); }