Friday, July 21, 2006

GeekSpeak: Checksums

Here's something interesting to the techies. In my quest for learning new things, I did a little research about what a CRC (cyclic redundancy check) is. Since I found the subject interesting, I thought I would share a little about it here.

A CRC is a type of
checksum, and is a way of attempting to ensure that data (e.g., a computer file, or stream of data over a network) has not become corrupted since it was first created. (And data can easily become corrupted because computers often misunderstand the messages they're being sent.)

A simple checksum works like this: you (or, more realistically, a computer program) goes through the file (or a specific chunk of data) and adds up the values of each of the bytes. The total is the checksum. If part of the file was changed, the total would typically change as well. This is actually a very easy algorithm to implement. For example:

Say you wanted to send your friend the following word: hello

The computer translates each letter into the following values: 104 101 108 108 111

The checksum would, therefore, be: 104 + 101 + 108 + 108 + 111 = 532

But, what if an error caused the 'o' to get lost along the way? hell

The new checksum would be: 104 + 101 + 108 + 111 = 421

If your friend's computer did a checksum and compared it with yours, it would discover the error and ask your computer to re-transmit the word--and it is unlikely that this time it would have an error.

Piece of cake! The downside is that there is a good chance the checksum will not catch certain kinds of errors. (For example, if a byte of data with a value of 0 get inserted, it will not increase the value of the checksum, even though the file size has increased by one byte.) Thus, a more robust--and complicated--technique is usually employed. Next time I'll talk about the CRC method of error-checking.

1 comment:

eotijqgoadflmvkad;lmf;lwetopirgopijadfpoiad;lfm said...

i thought you said that you didn't have time to blog?

/* ------ Google Analytics tracking code follows ------ */ /* ------ End of Google Analytics tracking code ------ */