libhasha 2.2.2
Loading...
Searching...
No Matches
crc.h File Reference

Header file for CRC32 checksum calculation. More...

Include dependency graph for crc.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define CRC32_POLYNOMIAL   0xEDB88320

Functions

HA_EXTERN_C_BEG HA_PUBFUN uint32_t ha_crc32_hash (ha_inbuf_t data, size_t len)
 Computes the CRC32 checksum in a single operation.

Detailed Description

Header file for CRC32 checksum calculation.

This file provides the definitions and function declaration for computing the CRC32 checksum, a cyclic redundancy check used to detect errors in data. It includes the definition of the CRC32 polynomial and a convenient one-shot function that performs initialization, update, and finalization of the CRC32 calculation in a single call.

Note
The CRC32 calculation uses the commonly used 32-bit polynomial (0xEDB88320).
See also
https://en.wikipedia.org/wiki/Cyclic_redundancy_check

Definition in file crc.h.

Macro Definition Documentation

◆ CRC32_POLYNOMIAL

#define CRC32_POLYNOMIAL   0xEDB88320

Definition at line 30 of file crc.h.

Function Documentation

◆ ha_crc32_hash()

HA_EXTERN_C_BEG HA_PUBFUN uint32_t ha_crc32_hash ( ha_inbuf_t data,
size_t len )

Computes the CRC32 checksum in a single operation.

This function calculates the CRC32 checksum of the given data using the CRC32 algorithm, starting from an initial value of 0xFFFFFFFF and finalizing with a bitwise complement. It is a convenient function that combines the initialization, update, and finalization steps into a single operation.

Parameters
dataPointer to the data buffer for which the CRC32 checksum will be computed.
lenThe length of the data in bytes.
Returns
The computed CRC32 checksum.