计算以太网帧的crc [英] Calulate crc of an ethernet frames

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

问题描述

我想在tcl脚本中计算此帧的CRC:

I want to caculate in a tcl script the CRC for this frame :

00000A00080000000A00090000004500002E0000000040117AC00000000000000000003F003F001AB6EB000102030405060708090A0B0C0D0E0F1011

预期的CRC为0x1652255A.我尝试了以下操作(在此处找到):

The expected CRC is 0x1652255A. I tried the following (found here):

% set string \x00\x00\x0A\x00\x08\x00\x00\x00\x0A\x00\x09\x00\x00\x00\x45\x00\x00\x2E\x00\x00\x00\x00\x40\x11\x7A\xC0\x00\x00\x00\x00\x00\x00\x00\x00\x00\x3F\x00\x3F\x00\x1A\xB6\xEB\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0A\x0B\x0C\
x0D\x0E\x0F\x10\x11
% package require crc32
1.3
% crc::crc32 -format %X $string
690CE0EE ;# not good

% set string 00000A00080000000A00090000004500002E0000000040117AC00000000000000000003F003F001AB6EB000102030405060708090A0B0C0D0E0F1011
% set bin [binary format H* $string]
% crc::crc32 -format %X $bin
690CE0EE ;# same than previous one

此过程中有些我不理解的地方,我不确定它是否正常运行,因为结果始终相同:

There is something I don't understand with this proc, and I am not sure it is working correctly, because the result is always the same :

%  crc::crc32 -format %X foo
690CE0EE
%  crc::crc32 -format %X somethingdifferent
690CE0EE

如果我继续使用此在线工具,如果找到了预期的工具,结果...

If I go on this online tool, if find the expected result...

问题是来自我还是来自包裹?

Is the problem coming from me or from the package ?

推荐答案

我没有看到您所看到的.

I am not seeing what you're seeing.

% set string \x00\x00\x0A\x00\x08\x00\x00\x00\x0A\x00\x09\x00\x00\x00\x45\x00\x00\x2E\x00\x00\x00\x00\x40\x11\x7A\xC0\x00\x00\x00\x00\x00\x00\x00\x00\x00\x3F\x00\x3F\x00\x1A\xB6\xEB\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0A\x0B\x0C\x0D\x0E\x0F\x10\x11


    E.@zÀ??¶ë



% package require crc32
1.3.1
% crc::crc32 -format %X $string
1652255A

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

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