Hi!
I'm working on a little prog. that decrypts the L2 packages.
The decryption algorithm is (I think) good, because the first packet seems to be decrypted successfully, the problem is probably in the key update, which is made after every packet.
[Only registered and activated users can see links. Click Here To Register...]
You can see on this image that the decryption is good, and it doesn't screws up long strings (will be described below).
I noticed the error when I tried to decrypt Message packets.
[Only registered and activated users can see links. Click Here To Register...]
You can see on this image, that every 9. byte is wrong if you split the packets into 16 byte parts, which is the key length (and the error is the same in each packet). On the image, the opcode is separated in the first line, and the others is the data splitted 8 byte/row.
I use this algorithm to decrypt packets (c#):
As you see, the algorithm updates the bytes 9, 10, 11 and 12 (8...11 if zero based), exactly the ones, that is wrong in the decryption, and you can see, that if you decrypt the 9. byte of the packet, it's decrypted using the 9. byte of the key (buf[i] = ((byte)(temp2 ^ (this._key[i & 0x0F]) ^ temp));)
I made this algorithm based on the L2J source (gameserver/Crypt.java and gameserver/network/GameCrypt.java) and the LineAge Utils ([Only registered and activated users can see links. Click Here To Register...] it works on C4 and written in c#.
I try to decrypt Interlude packages, but the problem is the same on the locally installed L2J server and on an offmod server too.
I'm working on a little prog. that decrypts the L2 packages.
The decryption algorithm is (I think) good, because the first packet seems to be decrypted successfully, the problem is probably in the key update, which is made after every packet.
[Only registered and activated users can see links. Click Here To Register...]
You can see on this image that the decryption is good, and it doesn't screws up long strings (will be described below).
I noticed the error when I tried to decrypt Message packets.
[Only registered and activated users can see links. Click Here To Register...]
You can see on this image, that every 9. byte is wrong if you split the packets into 16 byte parts, which is the key length (and the error is the same in each packet). On the image, the opcode is separated in the first line, and the others is the data splitted 8 byte/row.
I use this algorithm to decrypt packets (c#):
Code:
public void Decrypt(byte[] buf) { int temp = 0; for (int i = 0; i < buf.Length; i++) { int temp2 = buf[i]; buf[i] = ((byte)(temp2 ^ (this._key[i & 0x0F]) ^ temp)); temp = temp2; } long old = ((uint)this._key[8] & 0x000000ff) | (((uint)this._key[9] << 8) & 0x0000ff00) | (((uint)this._key[10] << 16) & 0x00ff0000) | (((uint)this._key[11] << 24) & 0xff000000); old += buf.Length; this._key[8] = (byte)(old & 0xff); this._key[9] = (byte)(old >> 8 & 0xff); this._key[10] = (byte)(old >> 16 & 0xff); this._key[11] = (byte)(old >> 24 & 0xff); }
I made this algorithm based on the L2J source (gameserver/Crypt.java and gameserver/network/GameCrypt.java) and the LineAge Utils ([Only registered and activated users can see links. Click Here To Register...] it works on C4 and written in c#.
I try to decrypt Interlude packages, but the problem is the same on the locally installed L2J server and on an offmod server too.