compute_crc

Function compute_crc 

Source
pub fn compute_crc(bytes: &[u8]) -> u16
Expand description

Compute the DPRS CRC-CCITT over the given bytes.

Matches CAPRSCollector::calcCRC from ircDDBGateway: reflected polynomial 0x8408, initial value 0xFFFF, final ~accumulator. Equivalent to crate::header::crc_ccitt.

ยงExample

// The empty-bytes CRC of CCITT with 0xFFFF init + final NOT is
// the canonical 0x0000 (init ^ 0xFFFF).
assert_eq!(compute_crc(b""), 0x0000);