简体   繁体   English

CRC32校正算法C

[英]CRC32 correction algorithm C

I've been looking for a CRC32 algorithm, but all I find just give me Checksum algorithms. 我一直在寻找CRC32算法,但我发现的只是给我Checksum算法。 What I want is a CRC32 algorithm that sends data bits, checks and corrects them. 我想要的是一种CRC32算法,可以发送数据位,检查并更正它们。 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" ? C中是否有可以进行校正的算法,因此"C"可以校正为"A" I just find "CRC32 Checksum", but nothing about correction and I don't really understand how to do it 我只找到“ CRC32校验和”,但与校正无关,我也不是很清楚如何做

CRC is an error-detection code, but it doesn't provide enough information to let you tell which bit had the error. CRC是一种错误检测代码,但它并没有提供足够的信息,让你知道哪个位有错误。

(mcdowella makes a good point in a comment): For a short messages, you might assume that single-bit errors are most likely. (mcdowella在评论中很有意思):对于短消息,您可能会认为单位错误是最有可能的。 You could brute-force try every bit separately, to see if you get the right CRC by flipping that bit. 您可以强行尝试每一位,以查看是否通过翻转该位获得了正确的CRC。 Some multi-bit errors will lead this method to find a wrong message that has the same CRC as the original, though. 但是,某些多位错误将导致此方法找到具有与原始CRC相同的CRC的错误消息。


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. 您可以使用错误检测代码(例如CRC或更强的哈希)来检测输入的哪些部分被“擦除”,然后使用擦除代码从正常数据和冗余块中重新生成不良数据。

See for example PAR2 for a complete end-to-end system for files, including a file format. 有关完整的文件(包括文件格式)的端到端系统,请参见例如PAR2 It uses Reed-Solomon with a GaloisField<2^16> for error correction. 它使用Reed-Solomon和GaloisField <2 ^ 16>进行纠错。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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