Skip to content

Instantly share code, notes, and snippets.

View vaelen's full-sized avatar

Andrew Young vaelen

View GitHub Profile
@bryc
bryc / crc16.js
Last active May 8, 2023 03:15
Optimized CRC implementations in JavaScript
/*
Optimized CRC-16 for 0x1021 (unreflected)
----
With this code, (5) CRC-16 variants can be modelled:
crc=0x0000, xorout=0x0000 = CRC-16/XMODEM (default)
crc=0xFFFF, xorout=0x0000 = CRC-16/IBM-3740
crc=0xFFFF, xorout=0xFFFF = CRC-16/GENIBUS
crc=0x0000, xorout=0xFFFF = CRC-16/GSM