crc v0.7.1 CRC View Source

This module is used to calculate CRC (Cyclic Redundancy Check) values for binary data. It uses NIF functions written in C to interate over the given binary calculating the CRC checksum value.

CRC implementations have been tested against these online calculators to validate their correctness to the best of our ability.

https://www.lammertbies.nl/comm/info/crc-calculation.html http://www.sunshine2k.de/coding/javascript/crc/crc_js.html

Link to this section Summary

Functions

Calculates a 16-bit CCITT CRC with the given seed, seed defaults to 0xFFFF if one is not given

Calculates a 16-bit CCITT 0x1D0F CRC

Calculates a 16-bit CCITT Kermit CRC

Calculates a 16-bit CCITT XMODEM CRC

Calculates an XOR checksum for the given binary

Calculates a 16-bit ANSI CRC checksum for the provided binary

Calculates a 16-bit DNP CRC

Calculates a 16-bit modbus CRC

Calculates a 16-bit Sick CRC

Calculates a 32-bit CRC

Calculates a 8-bit CRC with polynomial x^8+x^6+x^3+x^2+1, 0x14D. Chosen based on Koopman, et al. (0xA6 in his notation = 0x14D >> 1): http://www.ece.cmu.edu/~koopman/roses/dsn04/koopman04_crc_poly_embedded.pdf

Link to this section Functions

Link to this function ccitt_16(input, seed \\ 65535) View Source
ccitt_16(binary(), number()) :: number()

Calculates a 16-bit CCITT CRC with the given seed, seed defaults to 0xFFFF if one is not given.

This CCIT method uses a 0x1021 polynomial.

Link to this function ccitt_16_1D0F(input) View Source
ccitt_16_1D0F(binary()) :: number()

Calculates a 16-bit CCITT 0x1D0F CRC

This CCIT method uses a 0x1021 polynomial.

Link to this function ccitt_16_kermit(input, seed \\ 0) View Source
ccitt_16_kermit(binary(), number()) :: number()

Calculates a 16-bit CCITT Kermit CRC

This CCIT method uses a 0x8408 polynomial.

Link to this function ccitt_16_xmodem(input) View Source
ccitt_16_xmodem(binary()) :: number()

Calculates a 16-bit CCITT XMODEM CRC

This CCIT method uses a 0x1021 polynomial.

Link to this function checksum_xor(input) View Source
checksum_xor(binary()) :: number()

Calculates an XOR checksum for the given binary

Link to this function crc_16(input) View Source
crc_16(binary()) :: number()

Calculates a 16-bit ANSI CRC checksum for the provided binary

Link to this function crc_16_dnp(input) View Source
crc_16_dnp(binary()) :: number()

Calculates a 16-bit DNP CRC

Link to this function crc_16_modbus(input) View Source
crc_16_modbus(binary()) :: number()

Calculates a 16-bit modbus CRC

Link to this function crc_16_sick(input) View Source
crc_16_sick(binary()) :: number()

Calculates a 16-bit Sick CRC

Link to this function crc_32(input) View Source
crc_32(binary()) :: number()

Calculates a 32-bit CRC

Link to this function crc_8(input, seed \\ 255) View Source
crc_8(binary(), number()) :: number()

Calculates a 8-bit CRC with polynomial x^8+x^6+x^3+x^2+1, 0x14D. Chosen based on Koopman, et al. (0xA6 in his notation = 0x14D >> 1): http://www.ece.cmu.edu/~koopman/roses/dsn04/koopman04_crc_poly_embedded.pdf

seed defaults to 0xFF if one is not given