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?
[Q4] Checksum calculation?
[Q4] Checksum calculation?
"Maybe you have some bird ideas. Maybe that’s the best you can do."
― Terry A. Davis
― Terry A. Davis
-
- Posts: 13
- Joined: Mon Feb 09, 2004 8:00 am
-
- Posts: 13
- Joined: Mon Feb 09, 2004 8:00 am
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.
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.