예제 #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);
        }
예제 #2
0
        public static byte[] Get410Password(string password, byte[] seedBytes)
        {
            SHA1 sHA = new SHA1CryptoServiceProvider();

            password = password.Replace(" ", "").Replace("\t", "");
            byte[]       bytes        = Encoding.Default.GetBytes(password);
            byte[]       array        = sHA.ComputeHash(bytes);
            CryptoStream cryptoStream = new CryptoStream(Stream.Null, sHA, (CryptoStreamMode)1);

            cryptoStream.Write(seedBytes, 0, 4);
            cryptoStream.Write(array, 0, 20);
            cryptoStream.Close();
            byte[] hash   = sHA.Hash;
            byte[] array2 = new byte[20];
            Crypt.XorScramble(seedBytes, 4, array2, 0, hash, 20);
            byte[] array3 = new byte[20];
            Crypt.XorScramble(array2, 0, array3, 0, array, 20);
            return(array3);
        }