Skip to content

Instantly share code, notes, and snippets.

@jmzweb
jmzweb / CRC16-CCITT.js
Created August 17, 2018 06:52 — forked from chitchcock/CRC16-CCITT.js
A quick and dirty copy of a C routine for generating a CRC16-CCITT with an intial value of 0xFFFF in Javascript
// Modified from http://automationwiki.com/index.php?title=CRC-16-CCITT
var crcTable = [0x0000, 0x1021, 0x2042, 0x3063, 0x4084, 0x50a5,
0x60c6, 0x70e7, 0x8108, 0x9129, 0xa14a, 0xb16b,
0xc18c, 0xd1ad, 0xe1ce, 0xf1ef, 0x1231, 0x0210,
0x3273, 0x2252, 0x52b5, 0x4294, 0x72f7, 0x62d6,
0x9339, 0x8318, 0xb37b, 0xa35a, 0xd3bd, 0xc39c,
0xf3ff, 0xe3de, 0x2462, 0x3443, 0x0420, 0x1401,
0x64e6, 0x74c7, 0x44a4, 0x5485, 0xa56a, 0xb54b,
0x8528, 0x9509, 0xe5ee, 0xf5cf, 0xc5ac, 0xd58d,