校验码按照先高字节后低字节的顺序存放。
public static string GetHj212Crc16(byte[] bytes)
{
    int crcRegister = 0xFFFF;
    for (int i = 0; i < bytes.Length; i++)
    {
        crcRegister = (crcRegister >> 8) ^ bytes[i];
        for (int j = 0; j < 8; j++)
        {
            int check = crcRegister & 0x0001;
            crcRegister >>= 1;
            if (check == 0x0001)
            {
                crcRegister ^= 0xA001;
            }
        }
    }
    string result = string.Format("{0:X}", crcRegister);//转十六进制
    for (int i = result.Length; i < 4; i++)//补足 4 位
    {
        result = "0" + result;
    }
    return result;
}代码地址:Hj212Crc16
原文:https://www.cnblogs.com/victorbu/p/10393148.html