Streaming update functions for several common CRC variants implemented in src/juno_*.c. Each function updates a running CRC with a data buffer and returns the new CRC value. Initial (seed) values are provided as macros (JUNO_*_CRC_INIT) for first use.
Behavior and usage
- Passing a NULL data pointer or zero length returns 0 (no update). This differs from returning the variant's seed value for some CRCs (e.g., CCITT/CCITT32/ZIP) and is intentional; see tests and callers.
- All functions are pure and reentrant: no global state is modified.
- CRC-32 ZIP applies a final XOR (0xFFFFFFFF) before returning when data is processed. For multi-chunk streaming with ZIP, undo that XOR on the returned value (res ^ 0xFFFFFFFF) before passing it back as the next iCrc.
Example (streaming across two chunks)
uint32_t Juno_CrcZipUpdate(uint32_t iCrc, const void *pcData, size_t zDataSize)
Update ZIP CRC (CRC-32) with new data.
Definition juno_zip.c:20
#define JUNO_ARC_CRC_INIT
Initial seed for CRC-16/ARC (IBM-16) computations.
Definition crc.h:76
#define JUNO_ZIP_CRC_INIT
Initial seed for ZIP/PKZIP CRC-32 computations (0xFFFFFFFF).
Definition crc.h:156
uint16_t Juno_CrcArcUpdate(uint16_t iCrc, const void *pcData, size_t zDataSize)
Update ARC CRC with new data.
Definition juno_arc.c:21