Yes I know there have been posted some threads about this soon and they all helped me alot so far but im still to retarded to figure out the Length Hash which is written in every packet the client sends to the server.
I already know that you have to xor the CRC32 checksum of the size (which is written after the length hash) with the Session Key to get the Length Hash but the Length Hash i create is never the same as the one of the client.
Heres an Example:
Code:
Session ID Packet: 5E0800000000000000486EA319
Chat Packet: 5EFD5E7B9F0F00000034442A30FFFFFFFF0000FF00030000006D7568
Session ID: 19 A3 6E 48
Size: 00 00 00 0F
Length Hash: 9F 7B 5E FD
I never get this Length Hash. I really dont know what im doing wrong. Maybe someone could help me out and explain how everything works =)
btw: is the Session ID the same as the Session Key?
There are multiple things to check:
-Do you use the correct endianess? (Its little-endian for Flyff) Try to switch the endianess for your calculation.
-Does your CRC32 algo invert the result? Just Xor the result with 0xFFFFFFFF (== -1).
-Do you have the correct CRC32 algorithm? Unfortunatly there are differen't versions. If im not wrong it was CRC-32-IEEE_802.3 reversed (0xEDB88320)
For everybody else, if you don't know what this all is about read [Only registered and activated users can see links. ] post.
There are multiple things to check:
-Do you use the correct endianess? (Its little-endian for Flyff) Try to switch the endianess for your calculation.
-Does your CRC32 algo invert the result? Just Xor the result with 0xFFFFFFFF (== -1).
-Do you have the correct CRC32 algorithm? Unfortunatly there are differen't versions. If im not wrong it was CRC-32-IEEE_802.3 reversed (0xEDB88320)
For everybody else, if you don't know what this all is about read [Only registered and activated users can see links. ] post.
I use the correct endianess and crc32 function .. but i still dont get the same hash .. even when i xor the crc32 hash with 0xFFFFFFFF.
Could you maybe explain what you do on the example above?
Here is a demonstration of how to calculate the correct packet
Code:
from struct import pack, unpack
from binascii import crc32
def Main():
key = unpack ( '<L', '\x48\x6e\xa3\x19' ) [ 0 ]
data = '\xff\xff\xff\xff\x00\x00\xff\x00\x03\x00\x00\x00\x6d\x75\x68'
result = pack ( '<BLLL',
0x5e, # Protocol byte
~crc32 ( pack ( '<L', len ( data ) ) ) ^ key, # Checksum of length
len ( data ), # Length
~crc32 ( data ) ^ key # Checksum of data
) + data
for x in result: print '%02x' % ord ( x ),
print
if ( __name__ == '__main__' ):
Main ()