Skip to main content

crc8

Function crc8 

Source
pub fn crc8(data: &[u8]) -> u8
Expand description

Computes the Maxim 1-Wire CRC-8 over data.

This is the CRC the DS18B20 (and every Maxim 1-Wire device) appends to its ROM code and scratchpad. The polynomial is X^8 + X^5 + X^4 + 1, processed least-significant-bit first from a zero shift register, which is the reflected form 0x8C.

§Arguments

  • data - the bytes the CRC covers, in transmission order.

§Returns

The 8-bit CRC; for a correctly received message followed by its CRC byte, running this over all of them yields zero.