Skip to main content

compute_crc32

Function compute_crc32 

Source
pub(crate) fn compute_crc32(
    crc: u32,
    data: u64,
    bit_size: u32,
    polynomial: u128,
) -> u32
Expand description

Compute a CRC32 checksum using the given polynomial.

bit_size is the number of relevant data bits (8, 16, 32, or 64). Only the low bit_size bits of data are used; higher bits must be zero. polynomial includes the leading 1 bit (e.g. 0x11EDC6F41 for CRC32C).

Following hardware CRC conventions, crc and data bits are assumed to be reversed, and output bits will be equally reversed.