Expand description
This module contains functions for calculating CRCs as defined in the CD-DA and CD-ROM standards.
The CD standards use CRCs (cyclic redundancy checks) as a way to allow a player to check for corruption of low-level metadata. Since CDs are a physical medium that can suffer from scratches, dust, and other damage, it’s important to be able to know that playback metadata is actually accurate before trying to read it.
The CD-DA and CD-ROM standards use two types of CRC functions in different parts of each sector:
- A 32-bit CRC within the error correction metadata located within each sector.
- A 16-bit CRC within the second subcode.
This crate currently only provides the 16-bit CRC.
This crate incorporates an adaptation of a CRC function from the Ruby crc gem by dearblue.
Constants§
- CRC16_
BITMASK - CRC16_
BITSIZE - CRC16_
INITIAL_ CRC - CRC16_
POLYNOMIAL - CRC16_
REFLECT_ INPUT - CRC16_
REFLECT_ OUTPUT - CRC16_
XOR_ OUTPUT
Functions§
- crc16
- 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_crcis an initial CRC value which will be updated as calculations are performed; for Q subcode data, use the value of theCRC16_INITIAL_CRCconstant.