1 |
#ifndef __CRC32_H__ |
2 |
#define __CRC32_H__ |
3 |
|
4 |
#ifndef _ANSI_ARGS_ |
5 |
#ifdef PROTOTYPES |
6 |
#define _ANSI_ARGS_(c) c |
7 |
#else |
8 |
#define _ANSI_ARGS_(c) () |
9 |
#endif |
10 |
#endif |
11 |
|
12 |
#include "ecb.h" |
13 |
|
14 |
#ifdef __cplusplus |
15 |
extern "C" { |
16 |
#endif |
17 |
|
18 |
typedef uint32_t crc32_t; |
19 |
|
20 |
#define CRC32_INIT ((crc32_t)0) |
21 |
|
22 |
crc32_t uu_crc32 _ANSI_ARGS_((crc32_t prev, const void *data, unsigned int len)); |
23 |
/* |
24 |
Update a running crc with the bytes buf[0..len-1] and return the updated |
25 |
crc. If buf is NULL, this function returns the required initial value |
26 |
for the crc. Pre- and post-conditioning (one's complement) is performed |
27 |
within this function so it shouldn't be done by the application. |
28 |
Usage example: |
29 |
|
30 |
uLong crc = CRC32_INIT; |
31 |
|
32 |
while (read_buffer(buffer, length) != EOF) { |
33 |
crc = crc32(crc, buffer, length); |
34 |
} |
35 |
if (crc != original_crc) error(); |
36 |
*/ |
37 |
|
38 |
uint32_t uu_crc32_combine(uint32_t crcA, uint32_t crcB, size_t lengthB); |
39 |
|
40 |
#ifdef __cplusplus |
41 |
} |
42 |
#endif |
43 |
#endif |