我如何猜测校验和算法?
如果给定代码 + CRC 字符串,如何计算出 CRC 算法?
我有几个由代码 + 匹配的 CRC 组成的字符串,但不知道如何计算有问题的 CRC,以便我可以生成更多代码字符串。 以下是一些示例(16 位代码 + 4 位 CRC):
0010101000011101 + 0000 0010101000011111 + 0001 1000110011101101 + 0001 0000000000000100 + 0010 0011100011001110 + 0011 1000110011101110 + 0100 0001011110101100 + 0100 0010101000011110 + 0101 0011100011001101 + 0110 0001011110101111 + 0111 0011100011001100 + 1001 0011100011001111 + 1010 0001011110101101 + 1011 0000000000001000 + 1011 0000111100001101 + 1100 0000000000001100 + 1100 1111111111111111 + 1101 1000110011101111 + 1101 1000110011101100 + 1110 0001011110101110 + 1110 1111111100001101 + 1110 0010101000011100 + 1111
这些代码来自 RF (433MHz) 发送器,例如 X10 产品。
我不确定这是否是 CRC 或它是什么,但至少它是根据这些代码字符串以某种方式计算出来的。
更新
回复:找到规范我也认为这将是最好的解决方案,但由于这不是选择,我需要以某种方式强制校验和计算。
这就是问题所在,我没有规格,也无法在任何地方找到它们。 我尝试了几种不同的校验和计算方法,但没有结果,是否有一种方法可以比较输入字符串,找出它们的共同点,并通过这种方式获得算法
How can I figure out the CRC algorithm if a given code + CRC string is given?
I have got several strings consisting of code + matching CRCs but don't know how to calculate the CRC in question so that I could produce more code strings. Here are some samples (16bit code + 4bit CRC):
0010101000011101 + 0000 0010101000011111 + 0001 1000110011101101 + 0001 0000000000000100 + 0010 0011100011001110 + 0011 1000110011101110 + 0100 0001011110101100 + 0100 0010101000011110 + 0101 0011100011001101 + 0110 0001011110101111 + 0111 0011100011001100 + 1001 0011100011001111 + 1010 0001011110101101 + 1011 0000000000001000 + 1011 0000111100001101 + 1100 0000000000001100 + 1100 1111111111111111 + 1101 1000110011101111 + 1101 1000110011101100 + 1110 0001011110101110 + 1110 1111111100001101 + 1110 0010101000011100 + 1111
These codes come from a RF (433MHz) sender like the X10 products.
I am not sure if this is a CRC or what it is, but at least it calculated somehow out of those code strings.
Updates
RE: finding the specifications I also think would be the best solution but since this is no option I need to brute force the checksum calculation somehow.
This is the problem, I don't have the specifications and I can´t get them anywhere. I have tried several different checksum calculation methods without result, isn't there a way to compare the input strings finding out what they have in common and this way getting the algorithm
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(9)
是什么让您认为它是 CRC? 通常 CRC 不用于如此小的数据。
对我来说,这看起来像是某种奇偶校验、ECC(实际上是 FEC)或 里德-所罗门代码。 可能是汉明码 - 汉明广泛应用于工业和电信领域。
What makes you think it is a CRC? Usually CRCs are not used for such small pieces of data.
To me this rather looks like some kind of parity, ECC (actually FEC) or Reed-Solomon code. Might be Hamming Code - Hamming widely used in industry, in telecomunications.
猜测这个词非常正确。 如果此 RF 设备不是专有的,请尝试阅读规格! 这将是最简单的方法。
猜测所有可能的 CRC(或哈希算法)看起来不太乐观。 只需查看此处即可。
第三种可能性是对用于生成校验和的代码进行逆向工程。
祝你好运 :)
Guessing is the very right word. If this RF device is not proprietary, try reading the specifications! This would be the easiest way to go.
Guessing all the possible CRC (or Hashing algorithms) does not look too optimistic. Just take a look here.
A third possibility is to reverse engineer the code you are using to generate the checksums.
good luck :)
@mecki 可能是正确的,但很难知道。 您可以尝试X-10无线设备的数据格式和X-10 常见问题解答。
@mecki might be correct but it's hard to know. You might try Data format for X-10 wireless units and X-10 FAQ.
差分“分析”的结果,这看起来不像crc,参考:
http://www.cosc.canterbury.ac .nz/greg.ewing/essays/CRC-Reverse-Engineering.html
我也怀疑它是汉明码,因为 4 个奇偶校验位只允许 11 个数据位,而不是 16 个。
results of differential "analysis", this does not look like crc, reference:
http://www.cosc.canterbury.ac.nz/greg.ewing/essays/CRC-Reverse-Engineering.html
I doubt it's hamming code either, as 4 parity bits only allow 11 data bits, not 16.
CRC 算法的可能性太多,无法有效猜测。 您可以采取简单的方法,即找到适合您的设备的规格。 或者,您可以采用强力方法,即计算出每个可能输入的 CRC,并创建一个生成相同结果的算法。
There are too many CRC algorithm possibilities to guess effectively. You can take the easy approach, which is finding a Specification for your device. Or you can take the brute force method, which is figuring out the CRC for each possible input, and creating an algorithm that generates the same result.
你可以尝试一些常见的 CRC 方法并希望幸运,但 Mana 的答案(寻找规格)将是最好的选择。
You could try a few common CRC methods and hope to get lucky, but Mana's answer (looking for specs) would be the best choice.
良好的校验和算法的要点在于它与输入文本没有任何共同点。 您可以更改输入中的一个字符。 并且整个校验和输出将会改变。 所以,唯一的办法就是,是的,猜测。 如果您知道输入和输出字符串是什么,您可以尝试一些常见的校验和算法,看看它们是否给出正确的输出。 除此之外,不,这是不可能的。
或者,正如其他人所建议的那样,它可能根本不是校验和,而是某种纠错/冗余代码,这可能更容易弄清楚。
The entire point in a good checksum algorithm is that it doesn't have anything in common with the input text. You can change one single character in the input. and the entire checksum output will change. So the only way to go the other way is to, yes, guess. If you know what the the input and output strings are, you can try a few common checksum algorithms, and see if any of them give the right output. Other than that, no, it's not possible.
Alternatively, as others have suggested, it may not be a checksum at all, but some kind of error correction/redundancy code, and that might be easier to figure out.
也许它不是 CRC,但我仍然无法找到纠错/冗余算法。
Probably it is not a CRC, but still I can´t manage to find out the error correction/redundacy algorith.
根据字符串的长度与校验和的长度来判断,我认为这是一个简单的 1 错误校正校验和。 它可能是使用汉明距离的简单方法之一。 我不记得它是如何工作的,而且我身上没有任何信息论/线性代数教科书。
Judging by the length of the strings versus the length of the checksum, I would say this is a simple 1-error correcting checksum. Its probably one of the simple ones using hamming distances. I can't remember off hand how it worked, and I don't have any information theory/linear algebra textbooks on me.