Beispiel #1
0
        public static byte[] GetOld410Password(string password, byte[] seedBytes)
        {
            long[] array     = Crypt.Hash(password);
            string password2 = string.Format(CultureInfo.InvariantCulture, "{0,8:X}{1,8:X}", new object[]
            {
                array[0],
                array[1]
            });

            int[]  saltFromPassword = Crypt.getSaltFromPassword(password2);
            byte[] array2           = new byte[20];
            int    num = 0;

            for (int i = 0; i < 2; i++)
            {
                int num2 = saltFromPassword[i];
                for (int j = 3; j >= 0; j--)
                {
                    array2[j + num] = (byte)(num2 % 256);
                    num2          >>= 8;
                }
                num += 4;
            }
            SHA1 sHA = new SHA1CryptoServiceProvider();

            byte[] password3 = sHA.ComputeHash(array2, 0, 8);
            byte[] array3    = new byte[20];
            Crypt.XorScramble(seedBytes, 4, array3, 0, password3, 20);
            string text = Encoding.Default.GetString(array3).Substring(0, 8);

            long[] array4 = Crypt.Hash(password);
            long[] array5 = Crypt.Hash(text);
            long   max    = 1073741823L;

            byte[] array6 = new byte[20];
            int    num3   = 0;
            int    length = text.Length;
            int    num4   = 0;
            long   num5   = (array4[0] ^ array5[0]) % 1073741823L;
            long   num6   = (array4[1] ^ array5[1]) % 1073741823L;

            while (num3++ < length)
            {
                array6[num4++] = (byte)(Math.Floor(Crypt.rand(ref num5, ref num6, max) * 31.0) + 64.0);
            }
            byte b = (byte)Math.Floor(Crypt.rand(ref num5, ref num6, max) * 31.0);

            for (int k = 0; k < 8; k++)
            {
                byte[] array7;
                IntPtr intPtr;
                (array7 = array6)[(int)(intPtr = (IntPtr)k)] = (byte)(array7[(int)intPtr] ^ b);
            }
            return(array6);
        }
Beispiel #2
0
        public static string EncryptPassword(string password, string seed, bool new_ver)
        {
            long num = 1073741823L;

            if (!new_ver)
            {
                num = 33554431L;
            }
            if (password == null || password.Length == 0)
            {
                return(password);
            }
            long[] array  = Crypt.Hash(seed);
            long[] array2 = Crypt.Hash(password);
            long   num2   = (array[0] ^ array2[0]) % num;
            long   num3   = (array[1] ^ array2[1]) % num;

            if (!new_ver)
            {
                num3 = num2 / 2L;
            }
            char[] array3 = new char[seed.Length];
            for (int i = 0; i < seed.Length; i++)
            {
                double num4 = Crypt.rand(ref num2, ref num3, num);
                array3[i] = (char)(Math.Floor(num4 * 31.0) + 64.0);
            }
            if (new_ver)
            {
                char c = (char)Math.Floor(Crypt.rand(ref num2, ref num3, num) * 31.0);
                for (int j = 0; j < array3.Length; j++)
                {
                    char[] expr_C6_cp_0 = array3;
                    int    expr_C6_cp_1 = j;
                    expr_C6_cp_0[expr_C6_cp_1] ^= c;
                }
            }
            return(new string(array3));
        }
Beispiel #3
0
        public static string EncryptPassword(string password, string seed, bool new_ver)
        {
            long num = 1073741823L;

            if (!new_ver)
            {
                num = 33554431L;
            }
            if (password != null && password.Length != 0)
            {
                long[] array  = Crypt.Hash(seed);
                long[] array2 = Crypt.Hash(password);
                long   num2   = (array[0] ^ array2[0]) % num;
                long   num3   = (array[1] ^ array2[1]) % num;
                if (!new_ver)
                {
                    num3 = num2 / 2L;
                }
                char[] array3 = new char[seed.Length];
                for (int i = 0; i < seed.Length; i++)
                {
                    double num4 = Crypt.rand(ref num2, ref num3, num);
                    array3[i] = (char)(Math.Floor(num4 * 31.0) + 64.0);
                }
                if (new_ver)
                {
                    char c = (char)Math.Floor(Crypt.rand(ref num2, ref num3, num) * 31.0);
                    for (int j = 0; j < array3.Length; j++)
                    {
                        char[] array4;
                        IntPtr intPtr;
                        (array4 = array3)[(int)(intPtr = (IntPtr)j)] = (char)(array4[(int)intPtr] ^ c);
                    }
                }
                return(new string(array3));
            }
            return(password);
        }