KM3NeT CLB
2.0
KM3NeT CLB v2 Embedded Software
|
This module provides checksum functions. More...
#include <stdint.h>
#include <stdbool.h>
Go to the source code of this file.
Macros | |
#define | ADLER32_INIT_VAL 1 |
Value to which the Adler32 checksum should be initialized. | |
#define | CRC32_INIT_VAL 0xFFFFFFFF |
Value to which the CRC32 checksum should be initialized. | |
Functions | |
uint32_t | adler32 (uint32_t adler, const uint8_t *buf, int len) |
Update the adler32 checkum with the new data. More... | |
uint32_t | crc32 (uint32_t crc, const uint8_t *ptr, int cnt, bool dbg) |
Lightweight CRC32 algorithm, using Ethernet polynomial. More... | |
This module provides checksum functions.
Definition in file checksum.h.
uint32_t adler32 | ( | uint32_t | adler, |
const uint8_t * | buf, | ||
int | len | ||
) |
Update the adler32 checkum with the new data.
Adler32 is a very simple to implement checksum but still quite effective. Its much lighter than CRC32, since this required division. However CRC32 is capable of detecting more errors.
adler | Previous adler32 output, or ADLER32_INIT_VAL to start. |
buf | A pointer to the buffer data to add |
len | The length of the buffer |
Definition at line 23 of file checksum.c.
uint32_t crc32 | ( | uint32_t | crc, |
const uint8_t * | ptr, | ||
int | cnt, | ||
bool | dbg | ||
) |
Lightweight CRC32 algorithm, using Ethernet polynomial.
Same as used everywhere.
adler | Previous crc32 output, or CRC32_INIT_VAL to start. |
buf | A pointer to the buffer data to add |
len | The length of the buffer |
Definition at line 57 of file checksum.c.