scottdevries
scottdevries

Reputation: 117

How do I compute a standard ANSI CRC-16 hash in Javascript?

I need to compute an ANSI CRC-­16 hash of plainText ASCII bytes using the standard ANSI CRC‐16 hash with the polynomial of X16 + X15 + X2 + 1.

For example, if I have plaintext of 1085051000201146587443HG234, I need to be able to generate the CRC-­‐16 Hash, which in this case would be 26359.

It looks like a two-step process to me, where the first step would be to convert each letter/integer into an ASCII value and append all the values together.

The second step would be to take that numeric string and apply the polynomial calculation.

Any ideas how to do this in Javascript? Is this possible?

Upvotes: 4

Views: 6213

Answers (1)

Dagg Nabbit
Dagg Nabbit

Reputation: 76766

There's an example here: http://zorc.breitbandkatze.de/crc.html

Upvotes: 3

Related Questions