Solved

Find how a checksum is computed

Posted on 2000-03-03
13
227 Views
Last Modified: 2011-09-20
I have some file which are in cleartext except for the checksum that is appended to the end.
As I have to modify the content of these files I must learn how the checksum  is calculated.
But though it is a simple algorithm (Even if the computer is slowed down  to 1/1000 of it's normal speed it is calculated instantly) I didn't manage to find it.
I can generate files that only differ on 2 or 3 bytes (plus the checksum).
Is there any tool to do this kind of work? Or a way to proceed?
0
Comment
Question by:Yonel
  • 4
  • 4
  • 3
  • +2
13 Comments
 
LVL 32

Expert Comment

by:jhance
ID: 2581787
In general a checksum is some calculation based on the contents of a data file or data stream to aid in error detection.  Checksums are not all that good at detecting errors and other means, like CRCs are much better.

Basically, it goes like this.

Say I have a file with the following in it:

ABCD

to compute an 8-bit checksum, we add the numeric values of the characters (shown in hexadecimal):

0x41 + 0x42 + 0x43 + 0x44 = 0x010A (or 266 indecimal).  Since we want an 8-bit only checksum, we just lop off the upper 8 bits and that leaves us with 0x0A.  So an 8-bit checksum for ABCD is 0x0A (or 10 in decimal).

The problem is that there are as many ways of computing a checksum as you can imagine.  You can do 8, 16, 24, 32, etc., bits of checksum.  You can truncate the upper bits or you can fold them back in.  It just depends.  A bit of detective work on your data file and some calculations will probably yield its secrets.
0
 

Author Comment

by:Yonel
ID: 2582990
Adjusted points to 80
0
 

Author Comment

by:Yonel
ID: 2582991
I'm sorry but, though I used the word checksum, that's not a sum. If it was so byte1 +byte2 +... I would have something like checksumbyte - byte1 - byte2- ... = 0. Which is not the case.
In fact the checksum is 2 byte-long and seems to be computed using XOR with a mask that varies.(That's what I didn't manage to unserstand)
Could this be a CRC algorithm? Where can I find a description of it so that I can test whether it's the one that's used in my files.
0
 
LVL 84

Expert Comment

by:ozo
ID: 2583124
It could be a 2 byte-long sum, but if it looks like an xor, it's prpbably a CRC.
Does an xor of a given bit in the input always xor the same bits in the output?
the mask that varies would probably look like it shifts whenever the input but shifts, and when a 1 bit is shifted out, a certain mask is xord back in.
0
 
LVL 32

Expert Comment

by:jhance
ID: 2583374
I mentioned that already.  Based on what you've said there is no way of telling.  

I'll point out that you asked what a checksum is and I've told you that.  I've also told you how one can be calculated.

You have given no details about your particular checksum.  
0
 
LVL 48

Expert Comment

by:dbrunton
ID: 2583484
To test for a simple additive checksum create two small files with contents as shown.

file 1

AB


file 2

BA


If your program gives the same number on these files then it is probably a checksum.  Anything else could be a strange checksum or a CRC.  CRCs can vary, there are  numerous ways of doing the calculation.  For sample CRC code and applications go to simtel and do a search.
0
Control application downtime with dependency maps

Visualize the interdependencies between application components better with Applications Manager's automated application discovery and dependency mapping feature. Resolve performance issues faster by quickly isolating problematic components.

 

Author Comment

by:Yonel
ID: 2583654
jhance, sorry but I can't take such an answer that says "it had already been said".

What describes ozo is truly what I get. So, as it seems to be a well known algorithm that procuces it, I'll take the answer telling me it's NAME(CRC?). (and optionally how it works or where I can find the information.)
0
 
LVL 5

Expert Comment

by:PC_User321
ID: 2583923
0
 
LVL 5

Expert Comment

by:PC_User321
ID: 2583943
There are many dfferent CRCs in use, and you can also invent your own.

If yours is a standard one then it could be CRC-16 or X25 standard.

If the reference above does not help, then you should, as another question, post several example of files with correct check bytes and invite the experts to work out the algorithm.  Or better still, give us the program that creates the checksummed file so that we can create our own examples.

0
 
LVL 5

Expert Comment

by:PC_User321
ID: 2584126
http://www.efg2.com/lab/Mathematics/CRC.htm

This program is an very easy way to check CRC-16.  You download the program and run it.  The source code is available, too.
0
 
LVL 5

Expert Comment

by:PC_User321
ID: 2584131
I should have said _generate_ CRC
0
 

Author Comment

by:Yonel
ID: 2584589
Ok. My program generates CRC-16.
I've understood how it works and thank everybody.

I would like jhance to post an answer so that I can give him the points as he thought of CRCs before the others.
0
 
LVL 32

Accepted Solution

by:
jhance earned 80 total points
ID: 2584659
Thanks.

Answer.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
M2 drive not showing up 16 99
Boot to external harddrive (has bootable windows 10 image on it) via USB 5 82
Best RAM for a PC 4 45
Uninterruptable power suggestions. 16 63
this article is a guided solution for most of the common server issues in server hardware tasks we are facing in our routine job works. the topics in the following article covered are, 1) dell hardware raidlevel (Perc) 2) adding HDD 3) how t…
What do we know about Legacy Video Conferencing? - Full IT support needed! - Complicated systems at outrageous prices! - Intense training required! Highfive believes we need to embrace a new alternative.
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

932 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now