C# 中的 CRC-4 实现
我一直在网上搜索 4 位循环冗余校验 (CRC-4-ITU) 的 C# 实现,但到目前为止我还没有成功。
有谁能给我 CRC-4-ITU 的参考实现吗?最好使用标准多项式,如果有标准多项式(我已阅读规范 维基百科指出作为 CRC4 规范,但没有找到多项式的定义)。
我也非常感谢某种测试套件或测试数据来验证 CRC4 实现。
谢谢!
I've been searching the net for a C# implementation of the 4-bit cyclic redundancy check (CRC-4-ITU) but so far I've been unsuccessful.
Is there anyone who's able to give me a reference implementation of CRC-4-ITU? Preferrably with the standard polynomial if there is a standard polynomial (I've read the spec pointed to by wikipedia as the CRC4 spec without finding a definition of the polynomial).
I'd also really appreciate some sort of test suite or test data to verify a CRC4 implementation.
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
维基百科的循环冗余检查文章说多项式是 x^4 + x + 1。也很好地描述了如何计算校验和。
这是 CRC16 的算法。我知道这不是您所要求的,但将其调整为 4 位应该相对简单。
http://www.experts-exchange.com/Programming/Languages/ C_Sharp/Q_24775723.html
此外,还有计算校验和的指南:
http ://www.ross.net/crc/download/crc_v3.txt
“您想了解但又害怕的有关 CRC 算法的所有内容
询问担心你的理解错误可能会被发现。”
The Cyclic Redundancy Check article at Wikipedia says the polynomial is x^4 + x + 1. There is also a pretty good description of how the checksum is computed.
Here is an algorithm for CRC16. I know it's not what you asked for, but it should be relatively straightforward to adapt it for 4 bits.
http://www.experts-exchange.com/Programming/Languages/C_Sharp/Q_24775723.html
Also, there is this guide to computing checksums:
http://www.ross.net/crc/download/crc_v3.txt
"Everything you wanted to know about CRC algorithms, but were afraid
to ask for fear that errors in your understanding might be detected."