Example #1
0
        private static uint String2UInt32(string Str)
        {
            uint result;

            try
            {
                result = (uint)(ulong.Parse(Reg.GetMD5Hash(Str), NumberStyles.HexNumber) % 1000000uL);
            }
            catch
            {
                result = 0u;
            }
            return(result);
        }
Example #2
0
        public static bool ValidateRegCode(string Username, string RegCode)
        {
            bool result;

            try
            {
                if (RegCode.Length == 19)
                {
                    char[] chArray = RegCode.ToCharArray();
                    if (chArray[4] != '-')
                    {
                        result = false;
                        return(result);
                    }
                    if (chArray[9] != '-')
                    {
                        result = false;
                        return(result);
                    }
                    if (chArray[14] != '-')
                    {
                        result = false;
                        return(result);
                    }
                    RegCode = RegCode.Replace("-", "");
                    ulong num  = Reg.Hash2UInt64(RegCode);
                    ulong num2 = Reg.Hash2UInt64(Reg.GetHash(Username));
                    if (Reg.GetHash((num - num2).ToString()).Equals("1FEDF23C6CB786AA"))
                    {
                        Reg._RegOK  = true;
                        Reg.RegUser = Username;
                        result      = true;
                        return(result);
                    }
                }
                result = false;
            }
            catch (Exception exception)
            {
                MessageBox.Show(exception.Message);
                result = false;
            }
            return(result);
        }
Example #3
0
        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);
        }