Author | Message | Time |
---|---|---|
tinman | Anyone know how? i tried throwing every bytes of the map file into the crc32 function and end up with different crc32 value when compared with the packets log. ??? i suppose i should start reading from a specified offset? | September 12, 2007, 9:14 AM |
UserLoser | [quote author=tinman link=topic=17018.msg172671#msg172671 date=1189588444] Anyone know how? i tried throwing every bytes of the map file into the crc32 function and end up with different crc32 value when compared with the packets log. ??? i suppose i should start reading from a specified offset? [/quote] Try all the data after the map header block | September 13, 2007, 4:12 AM |
tinman | is the header = first 512 byte? i cant seems to get the correct crc32 checksum :/ | September 13, 2007, 12:15 PM |
LockesRabb | [quote author=tinman link=topic=17018.msg172705#msg172705 date=1189685703] is the header = first 512 byte? i cant seems to get the correct crc32 checksum :/ [/quote] While I'm out of my depth here, I have an idea you could try, use it or ignore it as the babbling of someone who doesn't know what he's talking about. Your choice. :) Couldn't you basically save the correct crc32 checksum to a variable, then basically brute force the map? Basically, write a program that starts with the first byte reading until the last byte, and calculates the crc32 checksum, compares it to the correct one, if it's not the same, it moves on to the second byte, then the third, until it has reached the last byte. Chances are, if UserLoser is right, that you just need to read everything after the header, the program will eventually reach the end of the header, and it'll score a match, and it can then display a message telling you exactly where the end of the header is. | September 13, 2007, 6:42 PM |
tinman | [quote author=Don Cullen link=topic=17018.msg172711#msg172711 date=1189708954] [quote author=tinman link=topic=17018.msg172705#msg172705 date=1189685703] is the header = first 512 byte? i cant seems to get the correct crc32 checksum :/ [/quote] While I'm out of my depth here, I have an idea you could try, use it or ignore it as the babbling of someone who doesn't know what he's talking about. Your choice. :) Couldn't you basically save the correct crc32 checksum to a variable, then basically brute force the map? Basically, write a program that starts with the first byte reading until the last byte, and calculates the crc32 checksum, compares it to the correct one, if it's not the same, it moves on to the second byte, then the third, until it has reached the last byte. Chances are, if UserLoser is right, that you just need to read everything after the header, the program will eventually reach the end of the header, and it'll score a match, and it can then display a message telling you exactly where the end of the header is. [/quote] I did written a script to do the job... it is now at offset 2074. still no luck :< | September 13, 2007, 9:41 PM |
UserLoser | Post your CRC32 function, maybe you're doing something wrong there? | September 14, 2007, 3:29 AM |
tinman | i'm using the php crc32 since my script is written in php. [code] <?PHP set_time_limit(0); //return the filesize in big endian format function getMapSize($mappath) { $filesize = filesize($mappath); $part1 = ($filesize ) & 0xFF; $part2 = ($filesize >> 8) & 0xFF; return chr($part1).chr($part2); } $mappath = 'treetag.w3x'; $BE_filesize = getMapSize($mappath); echo 'Map filezie:' . filesize($mappath) . "\r\n"; $map_crc32 = "\xf9\x0d\x49\xe5"; $map_crc32 = ( ord($map_crc32[0]) ) + ( ord($map_crc32[1]) << 8) + ( ord($map_crc32[2]) << 16) + ( ord($map_crc32[3]) << 24); $map = file_get_contents($mappath); $map_len = strlen($map); $content = ''; $map_crc32= sprintf("%u", $map_crc32); for($i = 0; $i < $map_len; $i++) { for($x=$i; $x < $map_len; $x++) { $content .= $map[$x]; } $checksum = sprintf("%u", crc32($content)); echo "Current offset: " . $i . "\n"; echo "Suppose to be: ".$map_crc32."\n"; echo "Computed value: ".$checksum."\n"; if($map_crc32 == $checksum) { echo "1.Matching found at offset $i\n"; exit; } echo "\n\n"; $content = ''; $checksum = ''; } [/code] | September 14, 2007, 4:56 AM |
Camel | There are a large number of standard variants on the CRC family. Are you sure the one Blizzard uses is one of the standards, and the one that PHP provides? | September 16, 2007, 8:56 PM |
Kp | Remember that Blizzard has a long history of taking a standard algorithm and getting it slightly wrong. | September 16, 2007, 9:36 PM |
tinman | the crc32 function generate the correct results for other packets that logged by me... so i assume they are both using the same crc32 function as php. maybe i should try different variants / find out whats wrong with the crc32 function in war3. | September 16, 2007, 11:03 PM |