简体   繁体   中英

CRC32 correction algorithm C

I've been looking for a CRC32 algorithm, but all I find just give me Checksum algorithms. What I want is a CRC32 algorithm that sends data bits, checks and corrects them. For example:

User input: "A" { 01000001 }
I intentionally cause an error so data sent is: "C" { 01000011 }

Is there an algorithm in C that can make the correction so "C" can be corrected to "A" ? I just find "CRC32 Checksum", but nothing about correction and I don't really understand how to do it

CRC is an error-detection code, but it doesn't provide enough information to let you tell which bit had the error.

(mcdowella makes a good point in a comment): For a short messages, you might assume that single-bit errors are most likely. You could brute-force try every bit separately, to see if you get the right CRC by flipping that bit. Some multi-bit errors will lead this method to find a wrong message that has the same CRC as the original, though.


For that you need an error-correction code. You detect which parts of the input were "erased" using error-detection codes, like a CRC or a stronger hash, but then you use an erasure code to re-generate the bad data from the good data and the redundancy blocks.

See for example PAR2 for a complete end-to-end system for files, including a file format. It uses Reed-Solomon with a GaloisField<2^16> for error correction.

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