#ifndef __CRC32_H__ #define __CRC32_H__ #include "ecb.h" #include "uuint.h" #ifdef __cplusplus extern "C" { #endif typedef uint32_t crc32_t; #define CRC32_INIT ((crc32_t)0) /* * Update a running crc with the bytes buf[0..len-1] and return the updated * crc. If buf is NULL, this function returns the required initial value * for the crc. Pre- and post-conditioning (one's complement) is performed * within this function so it shouldn't be done by the application. * Usage example: * * uLong crc = CRC32_INIT; * * while (read_buffer (buffer, length) != EOF) { * crc = crc32 (crc, buffer, length); * } * if (crc != original_crc) error (); */ UULIBINT_FUNC crc32_t uu_crc32 (crc32_t prev, const void *data, unsigned int len); /* * This calculates the crc of a block of data consisting of two * parts, using only their CRCs. This is used to quickly combine * part CRCs into a full file CRC. */ UULIBINT_FUNC uint32_t uu_crc32_combine (uint32_t crcA, uint32_t crcB, size_t lengthB); #ifdef __cplusplus } #endif #endif