CRC校验
循环冗余校验,是一种数据传输检错功能,对数据进行多项式计算,并将校验结果附在帧后面,生成一个新帧发送给通讯设备。
CRC16多项式:x16+x15+x2+1
CRC16校验表:CRC-CCITT
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Collections;
namespace Crc_Eg
{
class Program
{
public static UInt16 CRC16_INIT_VAL = 0x0000;
//CRC16静态表
public static UInt16[] Crc16Table = new UInt16[256]{
0x0000,0x1021,0x2042,0x3063,0x4084,0x50a5,0x60c6,0x70e7,
0x8108,0x9129,0xa14a,0xb16b,0xc18c,0xd1ad,0xe1ce,0xf1ef,
0x1231,0x0210,0x3273,0x2252,0x52b5,0x4294,0x72f7,0x62d6,
0x9339,0x8318,0xb37b,0xa35a,0xd3bd,0xc39c,0xf3ff,0xe3de,
0x2462,0x3443,0x0420,0x1401,0x64e6,0x74c7,0x44a4,0x5485,
0xa56a,0xb54b,0x8528,0x9509,0xe5ee,0xf5cf,0xc5ac,0xd58d,
0x3653,0x2672,0x1611,0x0630,0x76d7,0x66f6,