pub fn crc32_range(array: &[u8], offset: usize, length: usize) -> u32Expand description
Calculate CRC32 checksum for a range of bytes in the array.
Equivalent to Java’s crc32(byte[] array, int offset, int length)
§Arguments
array- The byte arrayoffset- Starting offset in the arraylength- Number of bytes to process
§Returns
CRC32 checksum as u32 (masked with 0x7FFFFFFF)
§Panics
Returns 0 if offset or length are invalid (instead of panicking)
§Examples
use rocketmq_common::utils::crc32_utils::crc32_range;
let data = b"Hello, World!";
let checksum = crc32_range(data, 0, 5); // Only "Hello"
assert!(checksum > 0);