CRC校验工具
http://www.metools.info/code/c15.html
校验算法:
CRC-16
CRC-16/X25 两者貌似不一样
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
typedef unsigned short uint16_t;
typedef unsigned int uint32_t;
typedef unsigned char uint8_t;
static short crctab16[] =
{
(short)0x0000, (short)0x1189, (short)0x2312, (short)0x329b, (short)0x4624, (short)0x57ad, (short)0x6536, (short)0x74bf,
(short)0x8c48, (short)0x9dc1, (short)0xaf5a, (short)0xbed3, (short)0xca6c, (short)0xdbe5, (short)0xe97e, (short)0xf8f7,
(short)0x1081, (short)0x0108, (short)0x3393, (short)0x221a, (short)0x56a5, (short)0x472c, (short)0x75b7, (short)0x643e,
(short)0x9cc9, (short)0x8d40, (short)0xbfdb, (short)0xae52, (short)0xdaed, (short)0xcb64, (short)0xf9ff, (short)0xe876,
(short)0x2102, (short)0x308b, (short)0x0210, (short)0x1399, (short)0x6726, (short)0x76af, (short)0x4434, (short)0x55bd,
(short)0xad4a, (short)0xbcc3, (short)0x8e58, (short)0x9fd1, (short)0xeb6e, (short)0xfae7, (short)0xc87c, (short)0xd9f5,
(short)0x3183, (short)0x200a, (short)0x1291, (short)0x0318, (short)0x77a7, (short)0x662e, (short)0x54b5, (short)0x453c,
(

本文介绍了两种不同的CRC校验工具,并提供了CRC-16的C语言实现代码,包括一个静态CRC校验表。此外,还展示了两个不同的16位校验和计算函数,用于数据完整性检查。

1万+

被折叠的 条评论
为什么被折叠?



