棘手的crc算法 [英] tricky crc algorithm

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

问题描述

我正在尝试找到适用于以下结果的crc。字节字符串由2个字节(即0xCE1E)组成,并且crc是单个字节(即0x03)

I am trying to find the crc that works with the following results. The byte string consists of 2 bytes (ie. 0xCE1E) and the crc is an single byte (ie. 0x03)


byte crc
CE1E 03
CE20 45
CE22 6F
0000 C0
0001 D4
FFFF 95

任何人都可以帮忙吗?

推荐答案

首先,4个十六进制数字不是4个字节。由于所有示例都显示4个十六进制数字(2个字节),因此我假设您的意思是2个字节。

First, 4 hex digits aren't 4 bytes. Since all your examples show 4 hex digits -- 2 bytes -- I'll assume you mean 2 bytes.

只有65,536个不同的哈希值,这就是您要做的

There are only 65,536 distinct hash values, here's what you do.

对从0000到FFFF的所有65,536个值执行哈希函数。列出结果。该表功能。

Execute the hash function for all 65,536 values from 0000 to FFFF. Tabulate the results. That table is the function. It maps input value to output value.

虽然la脚,它总是正确的,它并不大(65K字节),而且在完成计算后确实非常快

While lame, it's always correct, it's not terribly big (65K bytes), and it's really fast after you've done the calculation.

您不能很容易地反向工程哈希函数。好的状态机是复杂的状态机,它们以某种公平的方式使用所有输入位,因此对于仅相差几位的输入值,其输出值就大大不同。

You can't reverse engineer hash functions very easily. The good ones are sophisticated state machines that use all of the input bits in some "fair" way so that the output values are dramatically different for input values that differ by only a few bits.

如果将0000与0001、0002、0004、0008、0010、0020、0040、0080、0100、0200、0400、0800、1000、2000、4000和8000进行比较,则可能可以找出每个位有助于哈希。但我对此表示怀疑。

If you compare 0000 with 0001, 0002, 0004, 0008, 0010, 0020, 0040, 0080, 0100, 0200, 0400, 0800, 1000, 2000, 4000 and 8000, you might be able to figure out what each bit contributes to the hash. But I doubt it.

这篇关于棘手的crc算法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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