View Single Post
  #11  
Old 05-07-2008, 05:13 AM
mcox05
Fire Beetle
 
Join Date: Dec 2006
Posts: 21
Default

Quote:
Originally Posted by AndMetal View Post
I'm not 100% sure, but I think this is what you're looking for:

common/EQPacket.cpp:
Code:
  390 void EQProtocolPacket::ChatDecode(unsigned char *buffer, int size, int DecodeKey)
  391 {
  392 	if (buffer[1]!=0x01 && buffer[0]!=0x02 && buffer[0]!=0x1d) {
  393 		int Key=DecodeKey;
  394 		unsigned char *test=(unsigned char *)malloc(size);
  395 		buffer+=2;
  396 		size-=2;
  397 
  398         	int i;
  399 		for (i = 0 ; i+4 <= size ; i+=4)
  400 		{
  401 			int pt = (*(int*)&buffer[i])^(Key);
  402 			Key = (*(int*)&buffer[i]);
  403 			*(int*)&test[i]=pt;
  404 		}
  405 		unsigned char KC=Key&0xFF;
  406 		for ( ; i < size ; i++)
  407 		{
  408 			test[i]=buffer[i]^KC;
  409 		}
  410 		memcpy(buffer,test,size);
  411 		free(test);
  412 	}
  413 }
You are amazing my friend ... the ironic thing is that I just found this about 20 minutes ago. Seems that the answer to my question only leaves me with more questions since I have only programmed in Java/C#.

Question: It's using a decode key which, at a glance, isn't a predefined constant. What is the decode key they are using ... does it change constantly or do they have a constant being applied to the method call?

Anyways, thanks for the help. Great work!
Reply With Quote