]> git.ozlabs.org Git - ccan/blob - ccan/crc/crc.h
ccan/crc: remove broken "crc32c" routines which gave wrong results.
[ccan] / ccan / crc / crc.h
1 /* Licensed under GPLv2+ - see LICENSE file for details */
2 #ifndef CCAN_CRC_H
3 #define CCAN_CRC_H
4 #include <stdint.h>
5 #include <stdlib.h>
6
7 /* Note: the crc32c function has been *fixed* (it gave wrong results!) and
8  * moved to the ccan/crc32c module.  You probably want that if you're
9  * just after a "good" crc function. */
10
11 /**
12  * crc32_ieee - IEEE 802.3 32 bit crc of string of bytes
13  * @start_crc: the initial crc (usually 0)
14  * @buf: pointer to bytes
15  * @size: length of buffer
16  *
17  * 32 bit CRC checksum using polynomial
18  * X^32+X^26+X^23+X^22+X^16+X^12+X^11+X^10+X^8+X^7+X^5+X^4+X^2+X^1+X^0.
19  *
20  * See crc32c() for details.
21  */
22 uint32_t crc32_ieee(uint32_t start_crc, const void *buf, size_t size);
23
24 /**
25  * crc32_ieee_table - Get the IEEE 802.3 CRC table
26  *
27  * See crc32c_table() for details.
28  */
29 const uint32_t *crc32_ieee_table(void);
30
31 /**
32  * crc64_iso - ISO 3309
33  * @start_crc: the initial crc (usually 0)
34  * @buf: pointer to bytes
35  * @size: length of buffer
36  *
37  * 64 bit CRC checksum using polynomial
38  * X^64 + X^4 + X^3 + X^1 + X^0
39  *
40  * See crc32c() for details.
41  */
42 uint64_t crc64_iso(uint64_t start_crc, const void *buf, size_t size);
43
44 /**
45  * crc64_iso_table - Get the ISO 3309 CRC table
46  *
47  * See crc32c_table() for details.
48  */
49 const uint64_t *crc64_iso_table(void);
50
51 #endif /* CCAN_CRC_H */