crc v0.8.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

See :crc.crc/2

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

See :crc.crc_final/1

See :crc.crc_init/1

See :crc.crc_update/2

Returns a list of all the pre-defined CRC models

Returns a list of all pre-defined CRC Models that match the filter given

Link to this section Functions

Link to this function ccitt_16(input) View Source
ccitt_16(binary()) :: 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(input, seed) View Source
ccitt_16(binary(), number()) :: number()
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) View Source
ccitt_16_kermit(binary()) :: number()

Calculates a 16-bit CCITT Kermit CRC

This CCIT method uses a 0x8408 polynomial.

Link to this function ccitt_16_kermit(input, seed) View Source
ccitt_16_kermit(binary(), number()) :: number()
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(params, input) View Source
crc(:crc_algorithm.params(), iodata()) :: :crc_algorithm.value()

See :crc.crc/2.

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

Link to this function crc_final(resource) View Source
crc_final(:crc_algorithm.resource()) :: :crc_algorithm.value()

See :crc.crc_final/1.

Link to this function crc_init(params) View Source
crc_init(:crc_algorithm.params()) :: :crc_algorithm.resource()

See :crc.crc_init/1.

Link to this function crc_update(resource, input) View Source
crc_update(:crc_algorithm.resource(), iodata()) :: :crc_algorithm.resource()

See :crc.crc_update/2.

Link to this function list() View Source
list() :: [{atom(), String.t()}]

Returns a list of all the pre-defined CRC models

Link to this function list(filter) View Source
list(binary()) :: [{atom(), String.t()}]

Returns a list of all pre-defined CRC Models that match the filter given.

Filter is compiled into a regular expression and matched against the model name and description.