BOI uses a simple XOR-Algorithm. Each byte of a packet is being XORed with the value of the previous byte. The first byte of every packet indicates its length. Furthermore the first byte of the very first packet sent after the connection was established is being XORed with the value 0xCD.
Example:
Let's say the client sends this packet right after connecting to the server.
Code:
0x06 0xA7 0x57 0x04 0x01 0x41
In the end the encrypted packet looks like this:
Code:
0xCB 0xA1 0xF0 0x53 0x05 0x40
Code:
0x03 0xAB 0x34
Code:
0x42 0xA8 0x9F
In C-Code the Encryption-Function would look like this:
Code:
char LastByte = 0xCD; Encrypt(char *src, char *dst, int len) { for (int i = 0; i < len; i++) { dst[i] = src[i] ^ LastByte; LastByte = src[i]; } }
Code:
char LastByte = 0xCD; Decrypt(char *src, char *dst, int len) { for (int i = 0; i < len; i++) { dst[i] = src[i] ^ LastByte; LastByte = dst[i]; } }