Post Pacific  

Go Back   Post Pacific > Lineage 2 > Lineage 2 Help

Notices

 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
Old 14.03.2006, 18:12   #3
aralyon
Архивный участник
 
Join Date: Sep 2005
Posts: 72
Default

I'm using this java code (extracted from l2j and compiled under .net as J#)
Code:
public long decrypt(ubyte[] raw)
	{
		if (_key == null)
		{
			return 0;
		}

		int temp = 0;
		int j = 0;
		for (int i = 0; i < raw.length; i++)
		{
			int temp2 = raw[i] & 0xff;
			raw[i] = (ubyte)(temp2 ^ (_key[j++] & 0xff) ^ temp);
			temp = temp2;
			if (j > 7)
			{
				j = 0;
			}
		}

		long old = _key[0] & 0xff;
		old |= _key[1] << 8 & 0xff00;
		old |= _key[2] << 0x10 & 0xff0000;
		old |= _key[3] << 0x18 & 0xff000000;

		old += raw.length;

		_key[0] = (ubyte)(old & 0xff);
		_key[1] = (ubyte)(old >> 0x08 & 0xff);
		_key[2] = (ubyte)(old >> 0x10 & 0xff);
		_key[3] = (ubyte)(old >> 0x18 & 0xff);

		return 1;
	}
It looks same as that C++ code :?
As I wrote, it's ok with l2j, but there are some bad bytes (just some, most are ok) if I use it with normal server
aralyon is offline  
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 02:13.