Skip to content
This repository has been archived by the owner on May 10, 2023. It is now read-only.

born2bewild/node-crc16-ccitt

Repository files navigation

crc16-ccitt

npmjs CircleCI codecov req size license activity

Description

CRC-16-CCITT is an error detection scheme that does not impose any additional transmission overhead. This scheme was first employed by IBM in its SDLC data link protocol and is used today in other modern data link protocols such as HDLC, SS7, and ISDN. Like a checksum, the CCITT-CRC does not impose any additional transmission overhead at the character level. It can detect errors in any arbitrary number of bits of data, and its error detection rate is 99.9984 percent, worse case.

Some rather powerful math stands behind the CCITT-CRC. Luckily, one doesn't need to understand the math in order to use the algorithm. The basic idea is to treat the entire message as a binary number, which both the sender and receiver divide using the same divisor. The quotient is discarded, and the remainder is sent as the CRC. If the message is received without error, the receiver's calculation will match the sender's calculation, and the CRC's will agree. The CRC is actually the one's complement of the remainder obtained from modulo 2 division of the message by a generation polynomial.

The CCITT-CRC uses:

equation

This description was copied from AutomationWiki

Code is based on POSNET documentation.