// Copyright (c) Meta Platforms, Inc. and affiliates. // SPDX-License-Identifier: LGPL-2.1-or-later /** * @file * * CRC-32 checksums. * * See @ref CRC32. */ #ifndef DRGN_CRC32_H #define DRGN_CRC32_H #include #include /** * @ingroup Internals * * @defgroup CRC32 CRC-32 * * CRC-32 checksums. * * @{ */ /** * Update a CRC-32 checksum with additional data. * * This uses the IEEE CRC-32 polynomial (x32 + * x26 + x23 + x22 + * x16 + x12 + x11 + * x10 + x8 + x7 + * x5 + x4 + x2 + * x + 1). * * @param[in] crc Checksum to update. For the first call, this is the initial * checksum value (often `0xffffffff`). * @param[in] buf Data to checksum. * @param[in] len Size of @p buf in bytes. * @return Updated checksum. This is not bitwise negated as is often required * for the final result. */ uint32_t crc32_update(uint32_t crc, const void *buf, size_t len); /** @} */ #endif /* DRGN_CRC32_H */