General CRC and checksum computation implementation. More...
#include <sys/types.h>
#include "include/checksum.h"
Defines | |
#define | CRC_DIVIDER_BE 0x04C11DB7 |
Big-endian encoding CRC divider. | |
#define | CRC_DIVIDER_LE 0xEDB88320 |
Little-endian encoding CRC divider. | |
Functions | |
uint16_t | compact_checksum (uint32_t sum) |
Compacts the computed checksum to the 16 bit number adding the carries. | |
uint32_t | compute_checksum (uint32_t seed, uint8_t *data, size_t length) |
Computes sum of the 2 byte fields. | |
uint32_t | compute_crc32_be (uint32_t seed, uint8_t *data, size_t length) |
Computes CRC32 value in the big-endian environment. | |
uint32_t | compute_crc32_le (uint32_t seed, uint8_t *data, size_t length) |
Computes CRC32 value in the little-endian environment. | |
uint16_t | flip_checksum (uint16_t checksum) |
Returns or flips the checksum if zero. | |
uint16_t | ip_checksum (uint8_t *data, size_t length) |
Computes the ip header checksum. |
General CRC and checksum computation implementation.