my dog learned polymorphism
The moose likes I/O and Streams and the fly likes CheckSum Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » I/O and Streams
Bookmark "CheckSum" Watch "CheckSum" New topic


Sandya Bhaskara
Ranch Hand

Joined: Aug 20, 2004
Posts: 73
what is checksum?how java uses it for file compression??read some notes related to checksum but its confusing...can any1 explain it in detail?

Sandy<br />SCJP1.4 SCWCD1.4<br />SCBCD(preparing)
Ernest Friedman-Hill
author and iconoclast

Joined: Jul 08, 2003
Posts: 24199

A "checksum" is a function that you compute using all the bytes of a file, message, or other chunk of data. If you compute the checksum before transmitting (or saving, or compressing) some data, then compute it again after the transmission (or after loading, or decompressing) then the two values should match. If they do, you can be pretty sure the transmission happened with no errors. If they don't match, you know the received data is corrupt.

One very common checksum algorithm is called CRC, "cyclic redundancy check." There's a class that implements this algorithm, and the GZIP stream classes use it to check the validity of data they process.

[Jess in Action][AskingGoodQuestions]
I agree. Here's the link:
subject: CheckSum
It's not a secret anymore!