From a PM i got a while back:
I seem to receive this question a lot lol. Anyway, I never finished decrypting the opcode encryption on the outbound packets. However the inbound encryption is very simple:
As soon as you enter the game with a character, you will receive a packet that's 32k~ish in length. As soon as you've received this packet (which contains the outbound opcode encryption information) the inbound traffic's encryption changes. This 32k packet itself, and any inbound traffic after receiving it is encrypted as follows
(C# function for mapleshark, you can put this in MapleAES.cs)
PHP Code:
public void SimpleSubtractDecode(byte[] pData)
{
uint dwKey = mIV == null ? 0 : (uint)(mIV[0] | mIV[1] << 8 | mIV[2] << 16 | mIV[3] << 24);
uint nRes = dwKey;
for (uint i = 0; i < pData.Length; ++i)
{
pData[i] = (byte)(pData[i] - dwKey);
nRes = i + 1;
}
}
(Ignore the ugly name shit)
Instead of decrypting using AES, you use this function instead. After this function, just like with the AES decrypts, you generate a new IV.