Module integrity

Source
Expand description

Is the file still what it was when it was written?

Every other check in this module describes what a file is. This one asks whether it is still intact — the question that matters on a library that has been moved from disk to disk for ten years.

The answer comes from the checksums the containers already carry, so nothing has to be decoded and no reference copy is needed:

  • a FLAC frame ends with a CRC-16 over its own bytes, and its header carries a CRC-8;
  • an Ogg page carries a CRC-32 over the whole page.

Both catch what actually happens to stored files: a flipped bit, a bad sector, a truncated copy. What they do not catch is a stream re-encoded consistently — for that, FLAC also stores an MD5 of the decoded audio in STREAMINFO, and checking it means decoding. That verdict will come with the decoder; what is stored here is shaped to accommodate it without changing.

This verifier does not support checksums for MP3, MP4, WAV or AIFF. Their answer is “nothing to check”, which is distinct from “not checked yet” and does not establish that the file is healthy.

Structs§

Report
The outcome of one verification.

Enums§

Verdict
What is known about the integrity of a file.

Constants§

FLAC_METHOD
Name of the FLAC method, as stored in the catalog.
OGG_METHOD
Name of the Ogg method, as stored in the catalog.

Functions§

check
Verifies the checksums a file carries.