Function cgl_rs::utils::crc32

source ·
pub fn crc32(data: &[u8]) -> u32
Expand description

Calculates the CRC32 checksum of the given data.

The C implementation is based on linux’s crc32 implementation.

Arguments

  • data - A slice of bytes representing the data to calculate the checksum for.

Returns

A u32 representing the calculated CRC32 checksum.

Example

let data = b"hello world";
let crc32_checksum = cgl_rs::utils::crc32(data);
assert_eq!(crc32_checksum, 222957957);