0

是否可以确定从 CRC16 计算中改变的一个或多个字节?

例如,假设我得到一个 780 字节的配置文件,其中包含 CRC16 作为末尾的两个字节值(因此 CRC16 是根据前 778 个字节计算的)。当我计算文件内容的 CRC16(最后不包括 CRC16 的 778 个字节)并且它不同时,我可以确定错误发生的字节偏移量吗?

4

2 回答 2

2

Using just the two computations of the CRC16, no.

CRC16 is just a checksum: it can tell you that there is a difference, but not where.

于 2011-03-17T20:03:43.403 回答
1

The short answer is NO, you can't.

To understand why you have to understand how the CRC is computed and that mathematically that is called a hashing operation. What it means is the the output can not be reconstructed reliably from the generated hash code (in this case the CRC).

There are statistical analysis methods that may allow you to infer some information about the original text based on certain specific input test cases but in the majority of cases, and to a naive observer there's not direct mapping back to the original text from the CRC. So unless the original text was constructed in a certain way there's no way to know the offset at which data was changed in most cases.

于 2011-03-17T20:03:38.340 回答