Quote:
Originally Posted by ChingChong23
thats why you go byte & 0xff
take a look through here: 
|
Thanks I will definetly take a look through that source. I'n my auth cryption file I changed everything to use short variables as shown below
public void DecryptBackwards(short[] buffer)
{
for (int i = 0; i < buffer.length; i++)
{
buffer[i] ^= (short)(_cryptKey2[_decryptCounter.getKey2()] ^ _cryptKey1[_decryptCounter.getKey1()]) & 0xff;
buffer[i] = (short) ((short)(buffer[i] >> 4 | buffer[i] << 4) & 0xff);
buffer[i] ^= (short)0xAB;
_decryptCounter.Increment();
}
}
And this is what I used to convert bytearray to short array
public static short[] byteArrayToShortArray(byte[] buffer){
short[] array = new short[buffer.length];
for(short i = 0; i < buffer.length;i++){
array[i] = (short) (buffer[i] & 0xff);
}
return array;
}
This works perfectly to get the value of the auth packet, but I'm woundering how to forward the short array to the client, if I send the signed byte array with the negative values and such will the client still be able to use the bytes or do they have to be in the unsigned form?