Function cdrom_crc::crc16 [−][src]
pub fn crc16(data: &[u8], initial_crc: u16) -> u16
Calculates a 16-bit CRC for the supplied data.
This is the form of CRC used by the CD standard's Q subcode data.
initial_crc
is an initial CRC value which will be updated as
calculations are performed; for Q subcode data, use the value
of the CRC16_INITIAL_CRC
constant.
Example
use cdrom_crc::{crc16, CRC16_INITIAL_CRC}; let result = crc16(&[0, 1, 2, 3], CRC16_INITIAL_CRC); assert_eq!(result, 0x9ECE);
Notes
This form of CRC is defined in section 22.3.6 of the CD-ROM standard (ECMA-130, the “Yellow Book”).