X-Git-Url: https://git.ozlabs.org/?a=blobdiff_plain;ds=sidebyside;f=ccan%2Fcrc%2Fcrc.h;h=ba9f039c2958f8dc8eb358eade94069d340144ea;hb=39b46a02b7199786e926dfcb4086544789e30a68;hp=16994fc397597be61e550b755647734e34fd4ee4;hpb=96b6d6f132aeec31adc0dfd0836f67e052694ac7;p=ccan diff --git a/ccan/crc/crc.h b/ccan/crc/crc.h index 16994fc3..ba9f039c 100644 --- a/ccan/crc/crc.h +++ b/ccan/crc/crc.h @@ -1,15 +1,51 @@ +/* Licensed under GPLv2+ - see LICENSE file for details */ #ifndef CCAN_CRC_H #define CCAN_CRC_H #include #include +/* Note: the crc32c function has been *fixed* (it gave wrong results!) and + * moved to the ccan/crc32c module. You probably want that if you're + * just after a "good" crc function. */ + /** - * crc32 - 32 bit crc of string of bytes + * crc32_ieee - IEEE 802.3 32 bit crc of string of bytes + * @start_crc: the initial crc (usually 0) * @buf: pointer to bytes * @size: length of buffer * * 32 bit CRC checksum using polynomial * 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. + * + * See crc32c() for details. + */ +uint32_t crc32_ieee(uint32_t start_crc, const void *buf, size_t size); + +/** + * crc32_ieee_table - Get the IEEE 802.3 CRC table + * + * See crc32c_table() for details. + */ +const uint32_t *crc32_ieee_table(void); + +/** + * crc64_iso - ISO 3309 + * @start_crc: the initial crc (usually 0) + * @buf: pointer to bytes + * @size: length of buffer + * + * 64 bit CRC checksum using polynomial + * X^64 + X^4 + X^3 + X^1 + X^0 + * + * See crc32c() for details. */ -uint32_t crc32(const void *buf, size_t size); +uint64_t crc64_iso(uint64_t start_crc, const void *buf, size_t size); + +/** + * crc64_iso_table - Get the ISO 3309 CRC table + * + * See crc32c_table() for details. + */ +const uint64_t *crc64_iso_table(void); + #endif /* CCAN_CRC_H */