public override int ReadFrom(byte[] Buffer, int StartIndex = 0)
        {
            int cursor = StartIndex;

            cursor += base.ReadFrom(Buffer, cursor);

            // passwordlen, always 0x10 = 16
            cursor += TypeSizes.SHORT;

            PasswordHash pwHashOld = new PasswordHash();
            pwHashOld.HASH1 = BitConverter.ToUInt32(Buffer, cursor);
            cursor += TypeSizes.INT;

            pwHashOld.HASH2 = BitConverter.ToUInt32(Buffer, cursor);
            cursor += TypeSizes.INT;

            pwHashOld.HASH3 = BitConverter.ToUInt32(Buffer, cursor);
            cursor += TypeSizes.INT;

            pwHashOld.HASH4 = BitConverter.ToUInt32(Buffer, cursor);
            cursor += TypeSizes.INT;

            PasswordHashOld = pwHashOld;

            // passwordlen, always 0x10 = 16
            cursor += TypeSizes.SHORT;

            PasswordHash pwHashNew = new PasswordHash();
            pwHashNew.HASH1 = BitConverter.ToUInt32(Buffer, cursor);
            cursor += TypeSizes.INT;

            pwHashNew.HASH2 = BitConverter.ToUInt32(Buffer, cursor);
            cursor += TypeSizes.INT;

            pwHashNew.HASH3 = BitConverter.ToUInt32(Buffer, cursor);
            cursor += TypeSizes.INT;

            pwHashNew.HASH4 = BitConverter.ToUInt32(Buffer, cursor);
            cursor += TypeSizes.INT;

            PasswordHashNew = pwHashNew;

            return cursor - StartIndex;
        }
Example #2
0
        public override int ReadFrom(byte[] Buffer, int StartIndex = 0)
        {
            int cursor = StartIndex;

            cursor += base.ReadFrom(Buffer, cursor);

            MajorClientVersion = Buffer[cursor];
            cursor++;

            MinorClientVersion = Buffer[cursor];
            cursor++;

            WindowsType = BitConverter.ToUInt32(Buffer, cursor);
            cursor += TypeSizes.INT;

            WindowsMajorVersion = BitConverter.ToUInt32(Buffer, cursor);
            cursor += TypeSizes.INT;

            WindowsMinorVersion = BitConverter.ToUInt32(Buffer, cursor);
            cursor += TypeSizes.INT;

            RamSize = BitConverter.ToUInt32(Buffer, cursor);
            cursor += TypeSizes.INT;

            CpuType = BitConverter.ToUInt16(Buffer, cursor);
            cursor += TypeSizes.SHORT;

            ClientExecutableCRC = BitConverter.ToUInt16(Buffer, cursor);
            cursor += TypeSizes.SHORT;

            HorizontalSystemResolution = BitConverter.ToUInt16(Buffer, cursor);
            cursor += TypeSizes.SHORT;

            VerticalSystemResolution = BitConverter.ToUInt16(Buffer, cursor);
            cursor += TypeSizes.SHORT;

            Display = BitConverter.ToUInt32(Buffer, cursor);
            cursor += TypeSizes.INT;

            Bandwidth = BitConverter.ToUInt32(Buffer, cursor);
            cursor += TypeSizes.INT;

            ColorDepth = Buffer[cursor];
            cursor++;

            PartnerNr = Buffer[cursor];
            cursor++;

            Unused = BitConverter.ToUInt16(Buffer, cursor);
            cursor += TypeSizes.SHORT;

            ushort len = BitConverter.ToUInt16(Buffer, cursor);
            cursor += TypeSizes.SHORT;

            Username = Encoding.Default.GetString(Buffer, cursor, len);
            cursor += len;

            // passwordlen, always 0x10 = 16
            cursor += TypeSizes.SHORT;

            PasswordHash hash = new PasswordHash();
            hash.HASH1 = BitConverter.ToUInt32(Buffer, cursor);
            cursor += TypeSizes.INT;

            hash.HASH2 = BitConverter.ToUInt32(Buffer, cursor);
            cursor += TypeSizes.INT;

            hash.HASH3 = BitConverter.ToUInt32(Buffer, cursor);
            cursor += TypeSizes.INT;

            hash.HASH4 = BitConverter.ToUInt32(Buffer, cursor);
            cursor += TypeSizes.INT;

            PasswordHash = hash;

            return cursor - StartIndex;
        }
        public ChangePasswordMessage(string PasswordOld, string PasswordNew) 
            : base(MessageTypeGameMode.ChangePassword)
        {           
            byte[] md5hashOld = MeridianMD5.ComputeMD5(PasswordOld);
            byte[] md5hashNew = MeridianMD5.ComputeMD5(PasswordNew);

            PasswordHash pwHashOld = new PasswordHash();
            pwHashOld.HASH1 = BitConverter.ToUInt32(md5hashOld, 0);
            pwHashOld.HASH2 = BitConverter.ToUInt32(md5hashOld, 4);
            pwHashOld.HASH3 = BitConverter.ToUInt32(md5hashOld, 8);
            pwHashOld.HASH4 = BitConverter.ToUInt32(md5hashOld, 12);
            
            PasswordHash pwHashNew = new PasswordHash();
            pwHashNew.HASH1 = BitConverter.ToUInt32(md5hashNew, 0);
            pwHashNew.HASH2 = BitConverter.ToUInt32(md5hashNew, 4);
            pwHashNew.HASH3 = BitConverter.ToUInt32(md5hashNew, 8);
            pwHashNew.HASH4 = BitConverter.ToUInt32(md5hashNew, 12);
            
            this.PasswordHashOld = pwHashOld;
            this.PasswordHashNew = pwHashNew;
        }