[求助]关于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编辑过]