On CPUs that support the CRC32 instruction, computing this relatively strong checksum is even cheaper than computing Adler-32 checksums. This hardware support changes things significantly. This particular CRC is now implemented in hardware in Intel CPUs as part of the SSE4.2 extensions. In particular, the CRC known as CRC32C (Castagnoli) has been found to be particularly strong for communication applications. They have been well studied by mathematicians and can be easily implemented in hardware. Fletcher's checksum is slightly stronger, while being slightly slower to compute.Ĭyclic redundancy checks (CRCs) are functions that are a good middle ground. Unfortunately, it is particularly weak for very short messages (see the rationale for switching the SCTP protocol from Adler-32 to CRC32C). Adler-32 is 32 bits/4 bytes long, and is stronger, while still being very efficient to compute in software. Long, and is very fast but also very weak, leading to undetected errors. The Internet checksum, used for IPv4, TCP and UDP headers, is 16 bits/2 bytes On the "fast" end of the spectrum are functions designed to be easily computable in software. Cheaper functions are needed for high throughput applications. They are computationally expensive, which means they should only be used when reliability is a necessity and the computational cost is acceptable. This article discusses checksums in general, then provides an implementation and some performance advice.Īt the very robust end of the spectrum are cryptographic hash functions, which are typically quite large (16 bytes or more). Each checksum function has slightly different speed or robustness properties, so which one should you use? In my opinion, new applications should use the CRC32C algorithm, as it is very robust and supported in hardware in newer Intel CPUs. A checksum is a function that computes an integer value from a string of bytes that is used to detect errors.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |