[HELP] GameServer Encrypt & Decrypt Class

03/21/2018 10:18 CorrM#1
Can someone give me GameServer Encrypt & Decrypt Class

i have one but it's for AuthProtocol

that's it

Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Cryptography
{
    /// <summary>
    /// AuthCryptographer
    /// Posted by unknownone
    /// http://www.elitepvpers.com/forum/co2-programming/200047-new-login-packet-client-5089-a.html#post1760129
    /// </summary>
    public class AuthProtocolCryptographer
    {
        internal class CryptCounter
        {
            UInt16 m_Counter = 0;

            public byte Key2
            {
                get { return (byte)(m_Counter >> 8); }
            }

            public byte Key1
            {
                get { return (byte)(m_Counter & 0xFF); }
            }

            public void Increment()
            {
                m_Counter++;
            }
        }

        private CryptCounter _decryptCounter;
        private CryptCounter _encryptCounter;
        private byte[] _cryptKey1;
        private byte[] _cryptKey2;
        private bool Client;

        public AuthProtocolCryptographer(bool Client)
        {
            this.Client = Client;
            _decryptCounter = new CryptCounter();
            _encryptCounter = new CryptCounter();
            _cryptKey1 = new byte[0x100];
            _cryptKey2 = new byte[0x100];
            byte i_key1 = 0x9D;
            byte i_key2 = 0x62;
            for (int i = 0; i < 0x100; i++)
            {
                _cryptKey1[i] = i_key1;
                _cryptKey2[i] = i_key2;
                i_key1 = (byte)((0x0F + (byte)(i_key1 * 0xFA)) * i_key1 + 0x13);
                i_key2 = (byte)((0x79 - (byte)(i_key2 * 0x5C)) * i_key2 + 0x6D);
            }
        }

        public void Encrypt(byte[] buffer)
        {
            if(Client)
                for (int i = 0; i < buffer.Length; i++)
                {
                    buffer[i] ^= (byte)(_cryptKey1[_encryptCounter.Key1]);
                    buffer[i] ^= (byte)(_cryptKey2[_encryptCounter.Key2]);
                    buffer[i] = (byte)(buffer[i] >> 4 | buffer[i] << 4);
                    buffer[i] ^= (byte)0xAB;
                    _encryptCounter.Increment();
                }
            else
                for (int i = 0; i < buffer.Length; i++)
                {
                    buffer[i] ^= (byte)0xAB;
                    buffer[i] = (byte)(buffer[i] >> 4 | buffer[i] << 4);
                    buffer[i] ^= (byte)(_cryptKey1[_encryptCounter.Key1]);
                    buffer[i] ^= (byte)(_cryptKey2[_encryptCounter.Key2]);
                    _encryptCounter.Increment();
                }

        }

        public void Decrypt(byte[] buffer)
        {
            if (Client)
                for (int i = 0; i < buffer.Length; i++)
                {
                    buffer[i] ^= (byte)(_cryptKey2[_decryptCounter.Key2]);
                    buffer[i] ^= (byte)(_cryptKey1[_decryptCounter.Key1]);
                    buffer[i] = (byte)(buffer[i] >> 4 | buffer[i] << 4);
                    buffer[i] ^= (byte)0xAB;
                    _decryptCounter.Increment();
                }
            else
                for (int i = 0; i < buffer.Length; i++)
                {
                    buffer[i] ^= (byte)0xAB;
                    buffer[i] = (byte)(buffer[i] >> 4 | buffer[i] << 4);
                    buffer[i] ^= (byte)(_cryptKey2[_decryptCounter.Key2]);
                    buffer[i] ^= (byte)(_cryptKey1[_decryptCounter.Key1]);
                    _decryptCounter.Increment();
                }
        }
    }
}
it's work, but i need for GameServer
03/21/2018 10:53 Xio.#2
Right... What patch? You know there are gazillions of public sources (that *all* have the auth/game crypto) right?

Afaik there are only a couple of different Game cryptos.

42xx had one version of xor, then 43xx had another, then 5018 implemented blowfish that's still used to date though with additional PW crypto and different keys.
03/21/2018 11:01 CorrM#3
Can Give Me All patch for this class .?

i try to work in last patch servers.
can you help me about last patch cryptology and how to Decrypt :)
03/21/2018 16:25 Spirited#4
All known cryptography:
[Only registered and activated users can see links. Click Here To Register...]
We can't help you further due to the nature of the demand.
03/21/2018 23:50 CorrM#5
Quote:
Originally Posted by Spirited View Post
All known cryptography:
[Only registered and activated users can see links. Click Here To Register...]
We can't help you further due to the nature of the demand.
thank you Spirited <3.

but this is the packet i received when i connect to GameServer After Auth
Code:
F4-B3-97-71-3D-3F-D1-1C-49-67-20-7C-56-EF-BF-E1-EA-40-59-CB-E4-28-8A-AF-39-A7-F4-65-5F-1C-19-54-45-07-9E-7A-A5-E7-3E-5A-5D-DD-59-ED-F8-86-D4-0A-9B-81-20-B2-B0-AD-E9-B8-DB-04-85-89-13-9F-0C-D9-50-73-21-F3-B8-ED-09-DA-1D-85-F7-C4-6D-AD-3F-0D-4B-C4-B0-18-C2-70-4A-60-D4-BE-E0-5E-CA-65-57-48-E5-0C-FB-1C-58-00-6F-26-70-E5-AA-C2-13-7F-7F-E7-99-5B-4F-0A-89-6D-16-1C-71-8B-62-C0-E3-F8-0B-BD-CE-16-B3-B9-8E-03-49-EB-00-3E-81-1E-ED-42-F9-A6-C0-77-06-32-8C-BC-33-A1-33-EB-72-1D-A6-F1-07-69-70-C0-32-42-7A-4A-26-9B-BA-47-B9-CB-08-CE-C8-E7-4D-F2-65-0B-D0-EC-4B-7C-29-20-00-1F-49-30-62-4F-8E-25-C2-28-56-C5-CA-41-68-CA-73-46-7C-7B-89-92-45-A0-73-87-3E-CC-02-1C-C4-58-7A-2F-11-93-86-F0-83-F5-C7-8D-9B-5F-1A-55-2D-5F-11-00-CF-00-09-FD-77-2E-10-1F-67-1F-0C-E0-F9-C4-56-20-79-D2-69-C5-94-C4-83-F9-67-79-41-60-15-3D-E1-7B-4A-93-89-79-BF-1D-70-EA-65-9A-CE-D2-92-D3-9B-C4-2A-A3-EF-68-9A-7C-93-AF-16-FA-D4-A2-7A-3F-AE-0D-D4-11-0D-C7-9F-B2-B4-6C-B0-E4-A6-E1-DA-53-9B-DB-C3-79-CD-6D-FD-26-4E-58-B0-55-94-7E-EE-B2-E6-72-28
how can i detect the Cipher Type.
i'm good programmer but not good at Encryption :D
i maked some good stuf with Auth because i have AuthProtocolCryptographer
but now i not have For GameServer so some help in this point will be a big thing for me :* <3
03/22/2018 02:14 Spirited#6
You cannot detect the cipher type. If this is a new cipher, you must reverse engineer the client. Hence my reply of "We can't help you further due to the nature of the demand." I don't think anyone here works using the current client anymore. There's no need to.
03/22/2018 07:15 CorrM#7
Quote:
Originally Posted by Spirited View Post
You cannot detect the cipher type. If this is a new cipher, you must reverse engineer the client. Hence my reply of "We can't help you further due to the nature of the demand." I don't think anyone here works using the current client anymore. There's no need to.
Thank you for continue replay in this topic.

can you give me Last ver of the class and can give me some links for the type of class cipher type and how it's work, or example to decrypt Patcket.

i make proxy bot for Private Server not to original co so i think the last ver will work.

Thanks Spirited.
03/23/2018 22:57 CorrM#8
Any News .?
03/24/2018 01:54 Spirited#9
Quote:
Originally Posted by CorrM View Post
Any News .?
Nobody I know works with the current client, so unknown.
Unless someone speaks up, you're on your own.