[RELEASE] Packet Encryption/Decryption Algorithm

08/08/2012 18:05 suiluJ.#1
Hey,

Maybe it's useful for someone here, these are the current algorithms for encrypting / decrypting the Packets.

Encrypt:
Code:
void Packet::Encrypt()
{
    if(this->size > 4)
    {
	int  a = 4;
	BYTE b;

	int i;
        for (i = 0; i < (this->size - 4) / 3 - 1; i++)
        {
			b		            = this->data[a];
			this->data[a]	    = this->data[a + 3];
			this->data[a + 3]   = b;
			this->data[a]	   ^= 4;
			this->data[a + 1]  ^= 4;
			this->data[a + 2]  ^= 4;
			a				   += 3;
        }
     }
}
Decrypt:
Code:
void Packet::Decrypt()
{
    if (this->size > 4)
    {
        int  a = 4 + 3 * ((this->size - 4) / 3 - 1);
	BYTE b;

	int i;
        for (i = 0; i < (this->size - 4) / 3 - 1; i++)
        {
			b		            = this->data[a];
			this->data[a]	    = this->data[a - 3];
			this->data[a - 3]   = b;
			this->data[a]	   ^= 4;
			this->data[a - 1]  ^= 4;
			this->data[a - 2]  ^= 4;
			a				   -= 3;
        }
    }
}
08/08/2012 23:43 Mi4uric3#2
Da ist die Encryption-Routine für die control.ini ja komplizierter..
08/09/2012 09:11 nico_w#3
They don't use any keys? :O
08/09/2012 16:23 suiluJ.#4
Quote:
Originally Posted by nico_w View Post
They don't use any keys? :O
no, they don't.

But some packets are multiple packets in one (these packets are compressed).
09/18/2012 10:32 gebo93#5
How to use it ? Im newbie
09/19/2012 09:45 Mi4uric3#6
Quote:
Originally Posted by gebo93 View Post
How to use it ? Im newbie
Its not useful for you then.