What is a checksum, how does it differ from a CRC, and where can I get source code for CRC-16/CRC-32?
Checksums and Cyclic Redundancy Checks (CRCs) are methods used to verify the integrity of data by computing some extra bits and transmitting them along with the data. The receiver applies the same algorithm to regenerate the extra information and verify that it is correct. Note that this is not a cryptographic signature, and can not be used to verify the identity of the sender, since the algorithms used are well known, though much debated. The reliability of the check depends heavily on the exact algorithm, of which the most important are the one’s complement checksum, HDLC-CRC-16, CRC-16, and CRC-32. Since these checks are performed quite often (every TCP/IP packet is checksummed), the relative performance of otherwise identical algorithms is also of interest. The one’s complement checksum, used extensively by TCP/IP, is computed by splitting the packet into 16-bit words, adding them all together using one’s complement math, and complementing the result. One’s complement math is almos