- Joined
- Oct 27, 2008
- Messages
- 165
- Reaction score
- 89
Here is what i have:
for example on connect it will send soomething like this:
Code:
The public key comes from the server:
05 00 FF FF 5C 2A B7
05 00 ->Packet length
FF FF ->Header
5C 2A ->Public Key(Big Endian(it is: 2A 5C))
B7 ->z
Client/Server will use the public key to Encrypt the messages that will be sent to the Server/Client.
Client/Server packet after:
Packet = Length + encrypted message
Every time Update your public key when receiving a message like this:
05 00 FF FF 5C 2A B7 (with FF FF header/opcode)
Code:
key (size =0F(from 0 to F))
3F 12 56 44 9A BB 33 44 3F 12 56 44 9A BB 33 44
MSG = msglength+header+PublicKey+z
length = message length(2 bytes)
header = still dont know(2 bytes)
Public key = comes from server(2 bytes)(you can make it 1 byte and rest is z)
z = 1byte still dont know
Decrypt:
WORD x = Public key//THIS COMES FROM SERVER
for(int i = 0; i < msg.length; i++){
x = x & 0x0F;
msg[i] = msg[i] ^key[x];
x=x+1;
}
Code:
The public key comes from the server:
05 00 FF FF 5C 2A B7
05 00 ->Packet length
FF FF ->Header
5C 2A ->Public Key(Big Endian(it is: 2A 5C))
B7 ->z
Client/Server will use the public key to Encrypt the messages that will be sent to the Server/Client.
Client/Server packet after:
Packet = Length + encrypted message
Every time Update your public key when receiving a message like this:
05 00 FF FF 5C 2A B7 (with FF FF header/opcode)
Last edited: