3 ms·
There are only a few examples of anything larger than CRC64 being characterized and they're not very useful. For the sake of the next person who has to maintai
by AlotOfReading 4y ago
There are only a few examples of anything larger than CRC64 being characterized and they're not very useful.
For the sake of the next person who has to maintain your code though, please choose algorithms that adequately communicate your intentions. Choose CRCs only if you need to detect random errors in a noisy channel with a small number of bits and use a length appropriate to the intended usage (i.e. almost certainly not CRC64).
- dragontamer 4y agoAnd when you choose SHA1, does it mean you understood that it's no longer secure? Or is it chosen because it was secure 20 years ago but the code is old and needs to be updated? CRC says that you never intended security from the start. It's timeless, aimed to prevent burst errors and random errors. -------- BTW, what is the guaranteed Hamming distance between SHA1? How good is SHA1 vs burst errors? What about random errors? Because the Hamming distances of CRC have been calculated and analyzed. We actually can determine, to an exact level, how good CRC codes are.
- dagenix 4y agoIf you are choosing between a CRC and SHA1, you probably need to reconsider your understanding of the problem you are trying to solve. Those algorithms solve different use cases.
- dragontamer 4y agoIf you are choosing SHA1, now that it is retired, you probably should think harder about the problem in general. CRC should be better for any error detection code issue. Faster to calculate, more studied guaranteed detection modes, and so forth. SHA1 has no error detection studies. It's designed as a cryptographic hash, to look random. As it so happens, it is more efficient to use other algorithms and do better than random if you have a better idea of how your error looks like. Real world errors are either random or bursty. CRC is designed for these cases. CRC detects the longest burst possible for it's bitsize.
- AlotOfReading 4y agoYou shouldn't choose SHA-1, that's the point of this announcement. Seeing it indicates both that there was the potential for malicious input and that the code is old. The appropriate mitigation is to move to a secure hash, not CRCs. You may not know the bounds and distances exactly, but you know them probabilistically. Bit errors almost always map to a different hash. The same is true of CRCs over a large enough input as an aside.
- benlivengood 4y agohttps://eprint.iacr.org/2019/078 https://eprint.iacr.org/2019/078 is a good overview of the statistical properties of SHA hashes. Basically after ~10 rounds the output is always indistinguishable from randomness which means hamming distance is what you'd expect (about half the bits differ) between the hashes of any two bitstreams.
- dragontamer 4y agoCRC does better than random vs burst errors. And vs random errors is indistinguishable from any other methodology. If you are only worried about random errors, might as well use chksum.