What the difference between CRC and checksum?

前端 未结 4 1702
一整个雨季
一整个雨季 2020-12-28 13:01

What the difference between CRC and checksum?

相关标签:
4条回答
  • 2020-12-28 13:46

    CRC (Cyclic Redundancy Check) is a type of checksum, specifically a position dependent checksum algorithm (among others, such as Fletcher's checksum, Adler-32). As their name suggest, these detect positional changes as well, which makes them more robust - thus more widely used - than other checksum methods.

    0 讨论(0)
  • 2020-12-28 13:46

    CRC refers to a specific checksum algorithm. Other types of checksums are XOR, modulus, and all the various cryptographic hashes.

    0 讨论(0)
  • 2020-12-28 13:56

    Jeff Atwood (founder of Stack Overflow) wrote in his Checksums and Hashes blog post:

    I learned to appreciate the value of the Cyclic Redundancy Check (CRC) algorithm in my 8-bit, 300 baud file transferring days. If the CRC of the local file matched the CRC stored in the file (or on the server), I had a valid download. I also learned a little bit about the pigeonhole principle when I downloaded a file with a matching CRC that was corrupt!

     

    A checksum is an error-detection scheme that typically refers to a cryptographic hash function, though it also includes CRC. Here are three different types of checksum:

    Cyclic Redundancy Checks like CRC32 are fast but collision-prone. They are not robust to collision attacks, meaning that somebody can take a given CRC and easily a second input that matches it.

    Cryptographic hash functions like MD5 (weaker), SHA1 (weak), and SHA256 (strong) are specifically designed to be resistant to collision attacks. They are preferable to CRCs in every situation except speed; use the strongest algorithm you can computationally afford.

    Key derivation functions like PBKDF2 and bcrypt are designed for passwords. They are checksums that are expensive to compute so that they're robust to brute-force attacks.

    See also this Crypto.SE question on CRC vs SHA1. Wikipedia has a hash function security summary page that discusses collision-proneness of various cryptographic hashes.

    0 讨论(0)
  • 2020-12-28 13:58

    Check out HowStuffWorks for a good description of both and how they differ.

    From the page:

    Cyclic Redundancy Check (CRC)

    CRCs are similar in concept to checksums, but they use polynomial division to determine the value of the CRC

    More info is given at the link above including an example of how a checksum is calculated.

    0 讨论(0)
提交回复
热议问题