What is a CheckSum?

Everything else that doesn't fall into one of the other PB categories.
User avatar
Rook Zimbabwe
Addict
Addict
Posts: 4322
Joined: Tue Jan 02, 2007 8:16 pm
Location: Cypress TX
Contact:

What is a CheckSum?

Post by Rook Zimbabwe »

OK ignorance here... I have applied them foryears... but I still dont know:

What EXACTLY is a "checksum?" :mrgreen:
Binarily speaking... it takes 10 to Tango!!!

Image
http://www.bluemesapc.com/
User avatar
Kaeru Gaman
Addict
Addict
Posts: 4826
Joined: Sun Mar 19, 2006 1:57 pm
Location: Germany

Re: What is a CheckSum?

Post by Kaeru Gaman »

a CHECKSUM is a result calculated out of of a row of values to check if all the values are correct.

there is no "this is a checksum" formula, because there are a bunch of different algorithms to calculate a checksum.
oh... and have a nice day.
User avatar
netmaestro
PureBasic Bullfrog
PureBasic Bullfrog
Posts: 8453
Joined: Wed Jul 06, 2005 5:42 am
Location: Fort Nelson, BC, Canada

Re: What is a CheckSum?

Post by netmaestro »

It's a hash done on a file and sent with it, so when it arrives at its destination over a network the receiver can rerun the hash and check the result. If it's the same, no corruption happened and the file is complete. Usually crc32 is used for this.
BERESHEIT
SFSxOI
Addict
Addict
Posts: 2970
Joined: Sat Dec 31, 2005 5:24 pm
Location: Where ya would never look.....

Re: What is a CheckSum?

Post by SFSxOI »

Isn't that also the MD5 hash thats used to verify a file integrity?

(silly, everyone knows what a checksum is - when someone asks you if several items are all working you say "i'll checksum and find out." :) )
Last edited by SFSxOI on Sat Oct 31, 2009 12:59 am, edited 1 time in total.
The advantage of a 64 bit operating system over a 32 bit operating system comes down to only being twice the headache.
gnasen
Enthusiast
Enthusiast
Posts: 282
Joined: Wed Sep 24, 2008 12:21 am

Re: What is a CheckSum?

Post by gnasen »

A very important fact for a good checksum is, that small changes in the source result in great changes in the hash.
For example is the sum of all byte-valus a checksum, but if you increase one byte and decrease another one, the hash does not change.
However there is no guarantee that two different sources have different checksums, but the possibility that it could happen should be very small.
pb 5.11
User avatar
Demivec
Addict
Addict
Posts: 4283
Joined: Mon Jul 25, 2005 3:51 pm
Location: Utah, USA

Re: What is a CheckSum?

Post by Demivec »

gnasen wrote:A very important fact for a good checksum is, that small changes in the source result in great changes in the hash.
For example is the sum of all byte-valus a checksum, but if you increase one byte and decrease another one, the hash does not change.
However there is no guarantee that two different sources have different checksums, but the possibility that it could happen should be very small.
Another case of a small change that should result in a large difference for a checksum is the number of bytes. This allows a checksum to create a difference between one collection of zeroes and another collection of zeroes if the item count is different (10 zero's versus 11 zero's).
User avatar
Kaeru Gaman
Addict
Addict
Posts: 4826
Joined: Sun Mar 19, 2006 1:57 pm
Location: Germany

Re: What is a CheckSum?

Post by Kaeru Gaman »

I remember an input helper from the old C64 days...
they had large ASM Listings in the Magazine "64er", endless rows of bytesize numbers.
yes, we were lucid enough to hack in such listings back in those days...
they put 16 numbers in one line, followed by a checksum.
the checksum was built by adding the next value and then leftshift the sum and so on.
the leftshift made sure that the checksum was different when two values were exchanged.
oh... and have a nice day.
User avatar
Rook Zimbabwe
Addict
Addict
Posts: 4322
Joined: Tue Jan 02, 2007 8:16 pm
Location: Cypress TX
Contact:

Re: What is a CheckSum?

Post by Rook Zimbabwe »

They did something like that in ANTIC as well... Ah, me old Atari 800XL (Still have it in a box in the garage!) :mrgreen:

OK my idea goes out the window, but maybe with a modification?
Binarily speaking... it takes 10 to Tango!!!

Image
http://www.bluemesapc.com/
User avatar
DoubleDutch
Addict
Addict
Posts: 3220
Joined: Thu Aug 07, 2003 7:01 pm
Location: United Kingdom
Contact:

Re: What is a CheckSum?

Post by DoubleDutch »

Ahh, Antic & Analog magazine! Those were the days. :D Compute! and Byte were good too.
https://deluxepixel.com <- My Business website
https://reportcomplete.com <- School end of term reports system
Thorium
Addict
Addict
Posts: 1314
Joined: Sat Aug 15, 2009 6:59 pm

Re: What is a CheckSum?

Post by Thorium »

Additional info: A checksum don't have do be a real sum. The name implys that it's a value obtained by adding numbers together. But thats not the reality. It was back in the day that a checksum was realy a number added together from other numbers. Today a checksum can be obtained with any kind of operations, there is no rule. It's likly a division and shifting.
Kaeru Gaman wrote:I remember an input helper from the old C64 days...
they had large ASM Listings in the Magazine "64er", endless rows of bytesize numbers.
yes, we were lucid enough to hack in such listings back in those days...
they put 16 numbers in one line, followed by a checksum.
the checksum was built by adding the next value and then leftshift the sum and so on.
the leftshift made sure that the checksum was different when two values were exchanged.
Yes, i remember that. The program that does the checksum calculation was called "check summer". ^^
User avatar
Rook Zimbabwe
Addict
Addict
Posts: 4322
Joined: Tue Jan 02, 2007 8:16 pm
Location: Cypress TX
Contact:

Re: What is a CheckSum?

Post by Rook Zimbabwe »

So let me put it this way...

If you knew the formula for the checksum... could you take JUST that checksum generated and apply said formula in reverse to regenerate the file that created the checksum?
Binarily speaking... it takes 10 to Tango!!!

Image
http://www.bluemesapc.com/
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Re: What is a CheckSum?

Post by srod »

Most, if not all, checksum calculations do not generate absolutely unique values and so no it will not, in general, be possible to 'invert' such a calculation.
I may look like a mule, but I'm not a complete ass.
Thorium
Addict
Addict
Posts: 1314
Joined: Sat Aug 15, 2009 6:59 pm

Re: What is a CheckSum?

Post by Thorium »

Rook Zimbabwe wrote:So let me put it this way...

If you knew the formula for the checksum... could you take JUST that checksum generated and apply said formula in reverse to regenerate the file that created the checksum?
No. Because the checksum don't contain all informations about the file. It's just a hash.
There was as guy who tried to do that and called his program Hash Zip, of course it's not stable and will never be. A hash is allways lossy.
PB
PureBasic Expert
PureBasic Expert
Posts: 7581
Joined: Fri Apr 25, 2003 5:24 pm

Re: What is a CheckSum?

Post by PB »

> I remember an input helper from the old C64 days...
> they had large ASM Listings in the Magazine "64er"

Another great C64 magazine was Compute!'s Gazette, which had an app called The Automatic Proofreader:

http://www.jbrain.com/pub/cbm/mags/cg/A ... ader2A.jpg

It did checksums of each BASIC line that you typed in, so that you didn't make typos.

> If you knew the formula for the checksum... could you take JUST that checksum generated and apply said
> formula in reverse to regenerate the file that created the checksum?

Of course not. A checksum is very small (eg. an MD5 checksum is only 35 characters). How would you turn those 35 characters back into a 100 KB exe? ;)
I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.
User avatar
Rook Zimbabwe
Addict
Addict
Posts: 4322
Joined: Tue Jan 02, 2007 8:16 pm
Location: Cypress TX
Contact:

Re: What is a CheckSum?

Post by Rook Zimbabwe »

Well a couple of years ago a group did an allegedy unique version fo DOOM using some obscure formula... I can't find any ifo on it anymore... perhaps it was a sham!


Also (as an aside and off topic a bit: http://www.wolf5k.com/ (5k JAVA wolfenstein!)
Binarily speaking... it takes 10 to Tango!!!

Image
http://www.bluemesapc.com/
Post Reply