CRC-CCITT program in c - Code

Latest

programs

Sunday, October 30, 2011

CRC-CCITT program in c


CRC-CCITT

#include <stdio.h>

int crc_1021(int data)
{
int crc;
int x;

x = ((crc >> 8) ^ data) & 0xff;
x ^= x>>4;
crc = (crc << 8) ^ (x << 12) ^ (x <<5) ^ x;
crc &= 0xffff;

return(crc);

}

int main()

{
int crc;
printf("The CRC16-X25_ccitt of %d is %d. \n", crc, crc_1021(crc));
return 0;
}

No comments:

Post a Comment