How to calculate standard ANSI CRC-16 hash code in Javascript?

I need to calculate the ANSI CRC-16 hash from ASCII plainText bytes using the standard ANSI CRC-16 hash with polynomial X16 + X15 + X2 + 1.

For example, if I have plaintext 1085051000201146587443HG234, I need to be able to generate a CRC-16 hash, which in this case will be 26359.

It looks like a two-step process for me, where the first step is to convert each letter / integer to an ASCII value and add all the values ​​together.

The second step is to take this number string and apply the polynomial calculation.

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

+4
source share
1 answer
+3
source

Source: https://habr.com/ru/post/1385959/


All Articles