简体   繁体   中英

When calculating a CRC, should the remainder be set to something if it becomes 0?

Are there CRC algorithms in which the remainder is checked for zero during the generation, and changed when that happens?

When calculating a CRC, if you start with an initial value (the CRC value, aka the remainder value) of 0, leading zeroes in the data being CRCd will not have an effect. So the CRC for "\0\0\0Hello" will be the same as "Hello".

https://xcore.github.io/doc_tips_and_tricks/crc.html#the-initial-value

This means that if, as the CRC is being calculated, the value becomes zero at some point, any zeroes immediately following that point will have no effect on the CRC. If one or more of the zeroes is lost, the CRC will not be changed.

I want to generate a CRC for some data, so that I can determine when a byte is lost. Is this an esoteric application of the CRC? Because when looking for examples of calculating a CRC, I have not found any examples where the CRC value is checked for 0 during the computation, and some non-zero bits fed in a that point. I would think that this would be the only way to be sure to detect a loss of one or more bits at a point in the data, if the CRC up to that point happened to be 0.

To detect and/or correct dropped bits, something like Marker Code or Watermark Code is needed.

https://link.springer.com/article/10.1007/BF03219806

https://ieeexplore.ieee.org/document/866775


Marker codes and Watermark codes are usually implemented in hardware, such as the read / write logic in a hard drive, and operate at the bit level and the media interface. Additional bits are intermixed with data bits to allow detection of lost synchronization or signal, which could otherwise lead to dropped or inserted bits. Here is a better link that describes this. The turbopaper.pdf file mentions LDPC, low density parity codes, which Wiki has an article for. Note that when receiving or reading data, the Marker | Watermark code is handled first at the hardware interface, and the LDPC (or CRC or Reed Solomon) is done after the hardware has detected no dropped or inserted bits.

http://www.inference.org.uk/ear23/turbopaper.pdf

https://en.wikipedia.org/wiki/Low-density_parity-check_code

If you did that, then it wouldn't be a CRC anymore. So, no. By definition there are no such CRC algorithms.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM