crc16 implementation java

后端 未结 4 1541
陌清茗
陌清茗 2020-12-10 18:41

I am having problems with calculating CRC-16 implementation of a byte array in java. Basically I am trying to send bytes to a RFID that starts writing to a tag. I can see th

4条回答
  •  情歌与酒
    2020-12-10 19:18

    Maybe are you looking for this?

    Crc16 in java

    I use the same array (variable "table") in this method:

     public Integer computeCrc16(byte[] data) {
        int crc = 0x0000;
        for (byte b : data) {
            crc = (crc >>> 8) ^ table[((crc ^ b) & 0xff)];
    
        }
    
        return (int) crc;
    }
    

提交回复
热议问题