查找生成校验和的算法 [英] Find the Algorithm that generates the checksum

查看:113
本文介绍了查找生成校验和的算法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个传感设备,可以传输6字节消息以及1字节计数器和校验和。



数据看起来像这样:

  ------ DATA ----------- -Counter- --Checksum?- 

55 FF 00 00 EC FF ---- 60 ---------- 1F

计数器中的最后四位始终设置为0,即可能不使用这些位。假定最后一个字节为校验和,因为它具有非常特殊的性质。

现在,我需要找到的算法是基于--DATA--来计算此校验和。
我尝试过的是所有可能的CRC-8多项式,对于每个我试图反映数据,切换它,用非零初始化它的多项式,等等。我得出的结论是我没有处理正常的crc算法。我还尝试了一些flether和adler方法,但没有成功,来回地进行异或运算,但是我仍然不知道如何生成校验和。



我最大的担心是,如何使用的是柜台吗???相同的数据但具有不同的对价会生成不同的校验和。
我尝试将计数器包括在我的计算中,但是没有任何运气。



以下是一些其他数据样本:

  55 FF 00 00 F0 FF A0 38 
66 0B EA FF BF FF C0 CA
5E 18 EA FF B7 FF 60 BD
F6 30 16 00 FC FE 10 81

还有一点值得一提的是最后一个字节

请注意,如果您有任何提示或技巧可以尝试在此处发布,则我实在感到绝望。

p>

谢谢

解决方案

一些随机的想法:


  1. 位排序:您当前将数据表示为八位位组,但这不是CRC算法所看到的。 CRC对表示为位数组而不是八位字节数组的多项式进行运算。因此,设备可能使用与您使用的位排序方案不同的位排序方案来执行CRC。

  2. 根据设备的不同,我可能会说计数器包括在CRC计算中。

  3. 如果这是嵌入式设备,则可能使用其他代码,例如BCH。

是否可以提供有关该设备的其他信息?



这可能表明使用了多么强大的编码。例如,某些CRC-12(0x8F8)的汉明距离为5,最大数据字长为53位(假设CRC大小为12位,则数据字中的数据字可以为52位)。



编辑:
请参见如何猜测校验和算法?以获得其他一些想法。


I have a sensing device that transmits a 6-byte message along with an 1-byte counter and supposedly a checksum.

The data looks something like this:

------DATA----------- -Counter- --Checksum?--

55 FF 00 00 EC FF ---- 60---------- 1F

The last four bits in the counter are always set 0, i.e those bits are probably not used. The last byte is assumed to be the checksum since it has a quite peculiar nature. It tends to randomly change as data changes.

Now what I need is to find the algorithm to compute this checksum based on --DATA--. what I have tried is all possible CRC-8 polynomials, for each polynomial i have tried to reflect data, toggle it, initiate it with non-zeroes etc. I've come to the conclusion that i am not dealing with a normal crc-algorithm. I have also tried some flether and adler methods without success, xor stuff back and forth but still i have no clue how to generate the checksum.

My biggest concern is, how is the counter used??? Same data but with different countervalue generates different checksums. I have tried to include the counter in my computations but without any luck.

Here are some other datasamples:

55 FF 00 00 F0 FF A0 38  
66 0B EA FF BF FF C0 CA  
5E 18 EA FF B7 FF 60 BD  
F6 30 16 00 FC FE 10 81  

One more thing that might be worth mentioning is that the last byte in the data only takes on the values FF or FE

Please, if you have any tips or tricks that i may try post them here, I am truly desperate.

Thanks

解决方案

Some random ideas:

  1. Bit ordering: you are currently representing the data as octets, but this is not how the CRC algorthm sees it. CRCs operate on polynomials represented as arrays of bits, not arrays of octets. Because of this, it is possible that the device performs the CRC using different bit ordering scheme than the one you are using.
  2. Depending on the device, I would say it is rather likely that the counter is included in the CRC calculation.
  3. If this is an embedded device, it might be use some other code, such as a BCH.

Is there any other information that can be given about the device in question?

This might give some indication as to how strong coding has been used. As an example, certain CRC-12 (0x8F8) provides Hamming distance of 5 up to data word lengths of 53 bits (in your data the data word could be 52 bits, assuming CRC size of 12 bits).

Edit: See the answer in How could I guess a checksum algorithm? for some additional ideas.

这篇关于查找生成校验和的算法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆