Quake3World.com Forums
     Programming Discussion
        [Q4] Checksum calculation?


Post new topicReply to topic
Login | Profile | | FAQ | Search | IRC




Print view Previous topic | Next topic 
Topic Starter Topic: [Q4] Checksum calculation?

Timed Out
Timed Out
Joined: 02 Aug 2000
Posts: 38064
PostPosted: 05-27-2006 04:11 AM           Profile   Send private message  E-mail  Edit post Reply with quote


Trying to calculate the checksum for PK4s manually (in PHP) but can't find any information on the kind of crc check which Q4 performs.

It's not crc32, I get a different checksum than Q4 gets with the 'path' command on the same file.

Any ideas?



_________________
"Maybe you have some bird ideas. Maybe that’s the best you can do."
― Terry A. Davis


Top
                 

Gibblet
Gibblet
Joined: 09 Feb 2004
Posts: 24
PostPosted: 10-03-2006 06:20 AM           Profile Send private message  E-mail  Edit post Reply with quote


Maybe I replay a bit late, but the checksum used to identify PK4s is an MD5, which you can create in PHP using the md5_file( ) method.




Top
                 

Timed Out
Timed Out
Joined: 02 Aug 2000
Posts: 38064
PostPosted: 10-03-2006 06:22 AM           Profile   Send private message  E-mail  Edit post Reply with quote


The MD5 output I'm familiar with is a 128-bit hash, whereas the checksums listed for quake 4 are in the format 0xAC34CA, and soforth?



_________________
"Maybe you have some bird ideas. Maybe that’s the best you can do."
― Terry A. Davis


Top
                 

Gibblet
Gibblet
Joined: 09 Feb 2004
Posts: 24
PostPosted: 10-03-2006 06:42 AM           Profile Send private message  E-mail  Edit post Reply with quote


Sorry, I got sth wrong.

For ingame usage Q4 uses an 8 byte MD5 blockchecksum, which is build as:

val = digest[0] ^ digest[1] ^ digest[2] ^ digest[3];

(that's code from idlib, val & digest are unsigned long values).

E.g. a 32 byte MD5 0x0123456789ABCDEF0123456789ABCDEF will get split into

0x01234567, 0x89ABCDEF, 0x01234567, 0x89ABCDEF

These 4 parts will are used to calculate the resulting 8-byte blockchecksum using the OR operation.




Top
                 
Quake3World.com | Forum Index | Programming Discussion


Post new topic Reply to topic


cron
Quake3World.com
© ZeniMax. Zenimax, QUAKE III ARENA, Id Software and associated trademarks are trademarks of the ZeniMax group of companies. All rights reserved.
This is an unofficial fan website without any affiliation with or endorsement by ZeniMax.
All views and opinions expressed are those of the author.