![]() You then compare those 32-bit numbers to see if they are identical. You CRC each of the two files, which gives you two 32-bit numbers. ![]() How do you compare the two files? The answer is CRC. Each file is a rather large file (say 500 MB), and there is no network connection between the two machines. The first file is on Machine A and the other file is on Machine B. Suppose there are two files that need to be compared to determine if they are identical. Most of the time CRCs are used to compare data as an integrity check. This is rare, but not so rare that it won't happen. In other words two completely different pieces of data can have the same CRC. However, it is possible for spurious hits to happen. With that many CRC values it's not difficult for every piece of data being CRC'ed to get a unique CRC value. With a 32-bit CRC there are over 4 billion possible CRC values. But if you CRC data that differs (even by a single byte) then you should get two very different digital signatures. If you CRC the same data twice, you get the same digital signature. Secondly, if you CRC two different pieces of data you should get two very different CRC values. First, if you CRC the same data more than once, you must get the same CRC every time. The ideal CRC algorithm has several characteristics about it. There is no single CRC algorithm, there can be as many algorithms as there are programmers. ![]() As long as the data can be represented as a series of bytes, it can be CRC'ed. The "data" that is being CRC'ed can be any data of any length from a file, to a string, or even a block of memory. The most common CRC is CRC32, in which the "digital signature" is a 32-bit number. A CRC is a "digital signature" representing data. What is a CRCĬRC is an acronym for Cyclic Redundancy Checksum or Cyclic Redundancy Check (depending on who you ask). This article describes what a CRC is, how to generate them, what they can be used for, and lastly source code showing how it's done. So I decided to learn more about CRCs and write my own code. I did some checking on the web for sample CRC code, but found very few algorithms to help me. Recently I wrote a program in which I wanted to generate a CRC for a given file.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |