zoukankan      html  css  js  c++  java
  • crc校验

      ushort calc_crc(byte[] str, uint len)
            {
                byte i;
                ushort crc = 0xffff;
                //string+=4;         //从地址位开始计算//
                int num = 4;
                while (len-- != 0)
                {
                    for (i = 0x80; i != 0; i /= 2)
                    {
                        if ((crc & 0x8000) != 0)
                        {
                            crc *= 2;
                            crc ^= 0x1021;
                        }
                        else crc *= 2;
                        if ((str[num] & i) != 0)
                            crc ^= 0x1021;
                    }
                    num++;
                }
                return crc;
            }

  • 相关阅读:
    配置禅道遇到的那些事儿
    HDU 1181
    HDU1016
    HDU 1518
    2015长春区域赛赛后总结
    Codeforces Round #322 (Div. 2) A B C
    Codeforces Round #325 (Div. 2) A B
    Codeforces Round #324 (Div. 2) A B
    CSU 1530
    CSU 1535
  • 原文地址:https://www.cnblogs.com/Iyce/p/2738653.html
Copyright © 2011-2022 走看看