mersenneforum.org  

Go Back   mersenneforum.org > Fun Stuff > Puzzles

Reply
 
Thread Tools
Old 2008-03-15, 05:59   #1
nibble4bits
 
nibble4bits's Avatar
 
Nov 2005

2×7×13 Posts
Default An odd checksum - others like it?

From HPI-fmt2.txt version 1.0 (HPI is a format for Total Annihilation):
Code:
CHECKSUM CALCULATION

The checksum in each HPIENTRY2 is calculated from the uncompressed file
data.

It's actually four checksums in one, each 8-bit byte being one of the
checksums.

The first one is the sum of all the unsigned bytes in the file.

The second one is the cumulative XOR of all the unsigned bytes
in the file.

The third one is the sum of all the unsigned bytes in the file, each
byte XOR'd with its offset before being added.

The fourth one is the cumulative XOR of all the unsigned bytes 
in the file, each byte XOR'd with its offset before being XOR'd.
Notice something 'funny' about the last one?

Hint: A 256-byte table would be my first optimization. Can you do better without a table?

Anyone have some good puzzles related to this? Like why they did that in the first place? Other odd algorythms that do something like that? I'm thinking we could come up with challenges where someone posts an example and we try to remake it using our imaginations.

Last fiddled with by nibble4bits on 2008-03-15 at 06:00
nibble4bits is offline   Reply With Quote
Old 2008-03-15, 17:55   #2
maxal
 
maxal's Avatar
 
Feb 2005

22·32·7 Posts
Default

Quote:
Originally Posted by nibble4bits View Post
The second one is the cumulative XOR of all the unsigned bytes in the file.

[...]

The fourth one is the cumulative XOR of all the unsigned bytes
in the file, each byte XOR'd with its offset before being XOR'd.

Notice something 'funny' about the last one?
Not funny but stupid. The forth byte is always equal to the second byte XOR some constant depending only on the length of the file, not its content.
maxal is offline   Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Checksum bug in new LLR Kosmaj 15k Search 2 2004-07-15 21:12

All times are UTC. The time now is 02:23.


Sat Jul 17 02:23:59 UTC 2021 up 50 days, 11 mins, 1 user, load averages: 1.47, 1.29, 1.25

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.

This forum has received and complied with 0 (zero) government requests for information.

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation.
A copy of the license is included in the FAQ.