标题:[求助]关于CRC校验的问题
只看楼主
aukosfg
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2007-10-17
 问题点数:0 回复次数:0 
[求助]关于CRC校验的问题

AnsiString BuildCRC(unsigned char *cpBuffer, unsigned long Bytes)
{
unsigned short crc=0xFFFF,mo;
unsigned long i=0,j;
byte x;

while(i<Bytes)
{
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
x=(byte)(crc>>8);
crc=(unsigned short)(((short)cpBuffer[i])^x);
i++;
j=0;
while(j<8)
{
mo=(unsigned short)(crc&0x0001);
crc=(unsigned short)(crc>>1);
if(mo==1) crc=(unsigned short)(crc^0xA001);
j++;
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
}

return IntToHex(crc,4);
}


C的我看的不是很明白,,谁能帮我把这段程序写成VB的,,谢谢了!!!

[此贴子已经被作者于2007-10-22 14:53:34编辑过]

搜索更多相关主题的帖子: CRC 校验 
2007-10-22 14:50



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-179788-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.301834 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved