CRC-16 の値を検証しようとして助けが必要です (CRC-32 の値についても助けが必要です)。私は座ってCRCがどのように機能するかを理解しようとしましたが、空白を描いています.
BD001325E032091B94C412AC
私の最初の問題は、メッセージ " " をCRC16 = 12ACに計算するためにオンライン計算機を使用しようとしたときです。ドキュメントには、最後の 2 オクテットが CRC16 値であると記載されているためBD001325E032091B94C4
、サイトhttp://www.lammertbies.nl/comm/info/crc-calculation.htmlに「 」と入力すると、結果として 12AC ではなく 5A90 が返されます。 .
これらの値が異なる理由と、CRC16 と CRC32 の値を計算する方法のコードを見つけることができる場所を知っている人はいますか?
その他のメッセージは次のとおりです。
16000040FFFFFFFF00015FCB
3C00003144010405E57022C7
BA00001144010101B970F0ED
3900010101390401B3049FF1
09900C800000000000008CF3
8590000000000000000035F7
00900259025902590259EBC9
0200002B00080191014BF5A2
BB0000BEE0014401B970E51E
3D000322D0320A2510A263A0
2C0001440000D60000D65E54
- 編集 -
私はより多くの情報を含めました。私が参照していたドキュメントは、TIA-102.BAAA-A (TIA 標準から) です。ドキュメントには次のように記載されています (可能な限り著作権侵害を回避しようとしています)。
パケット内の最後のブロックは、ユーザー情報の数オクテットおよび/またはパッド オクテットで構成され、その後に 4 オクテットの CRC パリティ チェックが続きます。これは、パケット CRC と呼ばれます。
パケット CRC は、中間ブロックに含まれるすべてのデータ オクテットと最終ブロックのユーザー情報のオクテットにわたってコード化された 4 オクテットの巡回冗長検査です。具体的な計算は以下の通りです。
k を、パケットの CRC を計算するユーザー情報とパッド ビットの総数とします。k メッセージ ビットを次数 k–1 の多項式 M(x) の係数と見なし、0 番目のメッセージ オクテットの MSB を x^k–1 に関連付け、最後のメッセージ オクテットの LSB を x^0 に関連付けます。生成多項式 GM(x) と反転多項式 IM(x) を定義します。
GM(x) = x^32 + x^26 + x^23 + x^22 + x^16 + x^12 + x^11 + x^10 + x^8 + x^7 + x^5 + x ^4 + x^2 + x + 1
IM(x) = x^31 + x^30 + x^29 + ... + x^2 + x +1
パケットの CRC 多項式 FM(x) は、次の式から計算されます。
FM(x) = ( x^32 M(x) mod GM(x) ) + IM(x) modulo 2、つまり GF(2)
FM(x) の係数は、x^31 に対応する CRC の 0 番目のオクテットの MSB と x^0 に対応する CRC の 3 番目のオクテットの LSB と共に CRC フィールドに配置されます。
上記の引用では、^
引用されたときにフォーマットが同じままではなかったため、力を示しました。何がどうなるかわかりませんが、これは役に立ちますか?