Expand description
Public because a checksum is a checksum. copy verifies a file it has just
written with the same CRC-32 routine Ogg pages are checked with, rather than
growing a second implementation of the same polynomial next door.
The three cyclic redundancy checks the audio containers carry.
Each is defined by its polynomial and by whether the bits are reflected, and the three used here disagree on both counts — so they are written out rather than derived from one another.
| Where | Width | Polynomial | Covers |
|---|---|---|---|
| FLAC frame header | 8 | 0x07 | the header, up to the byte before the CRC |
| FLAC frame | 16 | 0x8005 | the whole frame, up to the two bytes before the CRC |
| Ogg page | 32 | 0x04C11DB7 | the page, its own CRC field read as zero |
Tables are built at first use rather than written out: 256 entries computed in a few microseconds are easier to trust than 256 constants copied by hand.
Functions§
- crc8
- CRC-8 as FLAC uses it: polynomial
0x07, no reflection, zero seed. - crc16
- CRC-16 as FLAC uses it: polynomial
0x8005, no reflection, zero seed. - crc32_
ogg - CRC-32 as Ogg uses it: polynomial
0x04C11DB7, no reflection and no final inversion — which is what sets it apart from the CRC-32 of zip and PNG, and why a general-purpose implementation cannot be reused here.