in reply to Re: (String::CRC) Re: CRC-16 algorithm
in thread CRC-16 algorithm

Yes, I forgot to add that. Unfortunately, even with the change, the result is:

cradcliff% ./crc16-modular.pl 123456789
CRC16 in decimal: 4535
CRC16 in hex:
  11b7

...which doesn't match the 0xBB3D result provided by the on-line calculator. I'm guessing that String::CRC doesn't use the CRC-16 polynomial or some other CRC-16-specific setting.

I'll check my other algorithm against the on-line calculator. If anyone has algorithmic hints, please post them.

  • Comment on (Checking String::CRC) Re: CRC-16 algorithm

Replies are listed 'Best First'.
Re^2: CRC-16 algorithm
by Anonymous Monk on Feb 23, 2015 at 11:38 UTC
    CRC16 crc = new CRC16(); System.out.println("CRC16 = " + crc.getCRC16("050101")); } public String getCRC16(String input) { byte[] bytes = input.getBytes(); int crc = 0x0000; for (byte b : bytes) { crc = (crc >>> 8) ^ table(crc ^ b) & 0xff; } return Integer.toHexString(crc); }
      anyone explain this
        its not perl, the end