简体   繁体   English

如何决定何时反映或 XOR CRC 数据?

[英]How to decide when to reflect or XOR CRC data?

I found multiple optimal CRC-32 polynomials on the CRC Polynomal Zoo site of Philip Koopman.我在 Philip Koopman 的CRC Polynomal Zoo 网站上找到了多个最佳 CRC-32 多项式。 Now I want to generate a CRC lookup table for one of the polynomials, by using the software pycrc .现在我想通过使用软件pycrc为多项式之一生成一个 CRC 查找表。

To generate a CRC lookup table you have to provide the following information for the choosen polynomial:要生成 CRC 查找表,您必须为所选多项式提供以下信息:

  • Reflected in (boolean)反映在(布尔值)
  • Reflected out (boolean)反映出来(布尔值)
  • XOR in (hex value) XOR in(十六进制值)
  • XOR out (hex value)异或输出(十六进制值)

For some polynomials I found the above parameters in a specification (for instance a AUTOSAR specification for the polynomial "F4ACFB13"), but what parameters should I choose if there is no specification for a certain polynomial?对于某些多项式,我在规范中找到了上述参数(例如多项式“F4ACFB13”的AUTOSAR 规范),但是如果某个多项式没有规范,我应该选择哪些参数? The Koopman site doesn't seem to provide the recommended parameters to use. Koopman 网站似乎没有提供建议使用的参数。

I already tried to find an explanation how to choose these parameters, but I could only find explanations how to implement these parameters and not how to choose them.我已经尝试找到如何选择这些参数的解释,但我只能找到如何实现这些参数而不是如何选择它们的解释。 Most websites recommend searching for specifications describing "common CRC polynomials", because they provide the optimal parameters.大多数网站建议搜索描述“通用 CRC 多项式”的规范,因为它们提供了最佳参数。

Generally you are trying to match the CRC used in some existing protocol.通常,您正在尝试匹配某些现有协议中使用的 CRC。 In that case you need to do the same thing you did for the AUTOSAR CRC: find the specification for the CRC.在这种情况下,您需要执行与 AUTOSAR CRC 相同的操作:找到 CRC 的规范。 Or you need to get several examples of messages and correct CRCs and try to reverse-engineer the CRC parameters.或者您需要获取多个消息示例并更正 CRC,然后尝试对 CRC 参数进行逆向工程。

You can find over a hundred CRC definitions here .您可以在此处找到一百多个 CRC 定义。

If you are creating your own protocol from scratch, then you can select any polynomial, reflection, initial value, and final exclusive-or you like, as well as any byte order of the CRC in the message.如果您从头开始创建自己的协议,那么您可以 select 任何多项式、反射、初始值和最终异或您喜欢的,以及消息中 CRC 的任何字节顺序。 I would recommend that the polynomial be chosen with good properties for your message length from Phil's data, and that the initial value of the CRC register, init , not be zero.我建议从 Phil 的数据中为您的消息长度选择具有良好属性的多项式,并且 CRC 寄存器的初始值init为零。 (If it is zero, then the CRC of any string of zeros will be the same value, that final exclusive-or, regardless of the length.) Also there is no detriment, and it is more aesthetic to pick the initial value and the final exclusive-or to be equal, so that the CRC of an empty sequence is zero. (如果它是零,那么任何零串的 CRC 都将是相同的值,即最终的异或,无论长度如何。)也没有损害,选择初始值和最终异或相等,因此空序列的 CRC 为零。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 JOptionPane输入对话框如何确定值是2还是JOptionPane.CANCEL_OPTION - JOptionPane Input Dialog how to decide if the value is 2 or JOptionPane.CANCEL_OPTION 如何使HTML占位符输入复选框元素的值反映要存储在数组中的不同值 - How to make the value of an HTML placeholder input checkbox element reflect different values to be stored in an array 提交表单时如何添加URL数据(变量)? - How to add URL data (variables) when submiting a form? 在以下情况下如何防止数字数据:HTML输入类型=“文本”? - How to prevent Numeric data when:HTML Input type = “text”? Ada:如何在获取整数时管理Data_error异常 - Ada: How to manage Data_error exception when getting integers 在 Angular 中使用 Input 传递数据时如何处理 undefined? - How to handle undefined when passing data with Input in Angular? 更新多个记录时,如何获取ID字段以显示在请求数据中? - How do i get my id field to show up in the request data when updating multiple records? 如何更改单元格但尚未输入数据时如何运行Excel宏? - How do I run an Excel macro for when a cell is changed but the data has not been entered yet? Visual Studio 2013 LightSwitch添加链接的字段数据时如何限制弹出窗口中的选项? - Visual Studio 2013 LightSwitch How to limit options in popup window when adding linked field data? 从文件读回对象时,Java如何知道对象和数据的类型 - How does Java know the types of objects and data when reading them back from a file
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM