/// Calculate the CRC32 checksum of a buffer
Calculate the CRC32 checksum of a buffer
Calculate the CRC32 checksum of a buffer
pub fn crc32(stream: &[u8]) -> u32 {
    let mask = 0xEDB88320;
    let mut checksum = !0;
    for &byte in stream {
        for i in 0..8 {
            if checksum & 1 != (byte as u32 >> i) & 1 {
                checksum = (checksum >> 1) ^ mask;
            } else {
                checksum = checksum >> 1;
            }
        }
    }
    !checksum
}
pub fn crc32 ( stream : & [ u8 ] ) -> u32 { let mask = 0xEDB88320 ; let mut checksum = ! 0 ; for & byte in stream { for i in 0 .. 8 { if checksum & 1 != ( byte as u32 >> i ) & 1 { checksum = ( checksum >> 1 ) ^ mask ; } else { checksum = checksum >> 1 ; } } } ! checksum }
Calculate the CRC32 checksum of a buffer
Calculate the CRC32 checksum of a buffer
stream
&[u8]