Beispiel #1
0
 public static BigInteger Getx(BigInteger Salt, byte[] LogonHash)
 {
     Sha1Hash h = new Sha1Hash();
     h.Update(Salt);
     h.Update(LogonHash);
     return new BigInteger(h.Final());
 }
Beispiel #2
0
        public BigInteger GetM(string Username, BigInteger s, BigInteger A, BigInteger B, BigInteger K)
        {
            Sha1Hash sha;

            sha = new Sha1Hash();
            byte[] hash = sha.Final(N);

            sha = new Sha1Hash();
            byte[] ghash = sha.Final(g);

            for (int i = 0; i < 20; ++i)
            {
                hash[i] ^= ghash[i];
            }

            // TODO: do t2 and t4 need to be BigInts?  Could we just use the byte[]?
            BigInteger t3 = new BigInteger(hash);

            sha = new Sha1Hash();
            sha.Update(Username);
            BigInteger t4 = new BigInteger(sha.Final());

            sha = new Sha1Hash();
            sha.Update(t3);
            sha.Update(t4);
            sha.Update(s);
            sha.Update(A);
            sha.Update(B);
            return(new BigInteger(sha.Final(K)));
        }
Beispiel #3
0
 public static byte[] GetM2(BigInteger A, BigInteger M, BigInteger K)
 {
     Sha1Hash h = new Sha1Hash();
     h.Update(A);
     h.Update(M);
     return h.Final(K);
 }
Beispiel #4
0
        public static BigInteger Getx(BigInteger Salt, byte[] LogonHash)
        {
            Sha1Hash h = new Sha1Hash();

            h.Update(Salt);
            h.Update(LogonHash);
            return(new BigInteger(h.Final()));
        }
Beispiel #5
0
        public static byte[] GetM2(BigInteger A, BigInteger M, BigInteger K)
        {
            Sha1Hash h = new Sha1Hash();

            h.Update(A);
            h.Update(M);
            return(h.Final(K));
        }
Beispiel #6
0
        // HandleLogonProof stuff
        public static BigInteger Getu(BigInteger A, BigInteger B)
        {
            Sha1Hash h = new Sha1Hash();

            h.Update(A);
            return(new BigInteger(h.Final(B)));
        }
Beispiel #7
0
 public static byte[] GetLogonHash(string Username, string Password)
 {
     Sha1Hash h = new Sha1Hash();
     string sI = String.Format("{0}:{1}", Username, Password.ToUpper());
     h.Update(sI);
     return h.Final();
 }
Beispiel #8
0
        public static byte[] GetLogonHash(string Username, string Password)
        {
            Sha1Hash h  = new Sha1Hash();
            string   sI = String.Format("{0}:{1}", Username, Password.ToUpper());

            h.Update(sI);
            return(h.Final());
        }
        public void DoLogonProof()
        {
            Sha1Hash sha;
            byte[] files_crc;

            // Generate CRC/hashes of the Game Files
            files_crc = GenerateCrc(crcsalt);

            // get crc_hash from files_crc
            sha = new Sha1Hash();
            sha.Update(A);
            sha.Update(files_crc);
            byte[] crc_hash = sha.Final();

            wout.Write((byte)RLOp.AUTH_LOGON_PROOF);
            wout.Write(A); // 32 bytes
            wout.Write(M); // 20 bytes
            wout.Write(crc_hash); // 20 bytes
            wout.Write((byte)0); // number of keys
            wout.Write((byte)0); // unk (1.11.x)
            wout.Flush();
        }
Beispiel #10
0
 // HandleLogonProof stuff
 public static BigInteger Getu(BigInteger A, BigInteger B)
 {
     Sha1Hash h = new Sha1Hash();
     h.Update(A);
     return new BigInteger(h.Final(B));
 }
Beispiel #11
0
        public BigInteger GetM(string Username, BigInteger s, BigInteger A, BigInteger B, BigInteger K)
        {
            Sha1Hash sha;

            sha = new Sha1Hash();
            byte[] hash = sha.Final(N);

            sha = new Sha1Hash();
            byte[] ghash = sha.Final(g);

            for (int i = 0; i < 20; ++i)
                hash[i] ^= ghash[i];

            // TODO: do t2 and t4 need to be BigInts?  Could we just use the byte[]?
            BigInteger t3 = new BigInteger(hash);

            sha = new Sha1Hash();
            sha.Update(Username);
            BigInteger t4 = new BigInteger(sha.Final());

            sha = new Sha1Hash();
            sha.Update(t3);
            sha.Update(t4);
            sha.Update(s);
            sha.Update(A);
            sha.Update(B);
            return new BigInteger(sha.Final(K));
        }
Beispiel #12
0
        private byte[] GenerateCrc(byte[] crcsalt)
        {
            Sha1Hash sha;

            byte[] buffer1 = new byte[0x40];
            byte[] buffer2 = new byte[0x40];

            for (int i = 0; i < 0x40; ++i)
            {
                buffer1[i] = 0x36;
                buffer2[i] = 0x5c;
            }

            for (int i = 0; i < crcsalt.Length; ++i)
            {
                buffer1[i] ^= crcsalt[i];
                buffer2[i] ^= crcsalt[i];
            }

            sha = new Sha1Hash();
            sha.Update(buffer1);

            try
            {
                FileStream fs = new FileStream("hash.bin", FileMode.Open, FileAccess.Read);
                byte[] Buffer = new byte[fs.Length];
                fs.Read(Buffer, 0, (int)fs.Length);
                sha.Update(Buffer);
            }
            catch (Exception e)
            {
                BoogieCore.Log(LogType.Error, e.Message);
            }

            byte[] hash1 = sha.Final();

            sha = new Sha1Hash();
            sha.Update(buffer2);
            sha.Update(hash1);
            return sha.Final();
        }
        private void Handle_AuthRequest(WoWReader wr)
        {
            BoogieCore.Log(LogType.System, "WS: Recieved Authentication Challenge: Sending out response");
            ServerSeed = wr.ReadUInt32();
            ClientSeed = (UInt32)random.Next();

            Sha1Hash sha = new Sha1Hash();
            sha.Update(mUsername);
            sha.Update(0); // t
            sha.Update(ClientSeed);
            sha.Update(ServerSeed);
            sha.Update(Key);
            byte[] Digest = sha.Final();

            WoWWriter ww = new WoWWriter(OpCode.CMSG_AUTH_SESSION);
            ww.Write(BoogieCore.configFile.ReadInteger("WoW", "Build"));
            ww.Write((UInt32)0);
            ww.Write(mUsername);
            ww.Write(ClientSeed);
            ww.Write(Digest);

            StreamReader SR;
            WoWWriter buffer = new WoWWriter();
            SR = File.OpenText("Addons.txt");
            string Line = SR.ReadLine();

            while (Line != null)
            {
                string[] Fields = new string[3];
                string Name = null;
                UInt64 Checksum = 0;
                byte unk = 0x0;

                Fields = Line.Split(':');
                Name = Fields[0];
                Checksum = UInt64.Parse(Fields[1]);
                //unk = (Fields[2].ToCharArray())[0];

                if (Name != null && Checksum > 0)
                {
                    buffer.Write(Name);
                    buffer.Write(Checksum);
                    buffer.Write(unk);

                    //BoogieCore.Log("Adding addon {0} with the checksum {1}", Name, Checksum);
                }

                Line = SR.ReadLine();
            }

            SR.Close();

            byte[] buffer2 = Foole.Utils.Compression.Compress(buffer.ToArray());
            UInt32 Size = (UInt32)buffer.ToArray().Length;

            ww.Write(Size);
            ww.Write(buffer2);

            Send(ww);

            mCrypt.Init(Key);
        }