[Flac] Checking file integrity
J.B. Nicholson-Owens
jbn at forestfield.org
Sat Apr 23 13:01:35 PDT 2011
Anton Shepelev wrote:
> I have read FLAC stores a hashsum inside its files
> to check their integrity. But how to do it without
> having to extract the file? Is the hashsum calcu-
> lated on the extracted or compressed data?
I'm not sure what you're asking for, but the hash is computed on the raw
sample data. Raw samples are compressed inside the FLAC file.
To extract the computed hash (MD5):
metaflac --show-md5sum audio.flac
To extract the raw sample data and do the MD5 hash computation another
way you can uncompress the FLAC file, convert it to raw with a program
like sox(1), and recompute the MD5 hash:
flac --decode audio.flac (this creates audio.wav)
sox audio.wav audio.raw (this creates audio.raw)
md5sum audio.raw (this should match the hash above)
For example:
$ metaflac --show-md5sum audio.flac
7853aca9317d3b348b3aad5219fa63c9
$ flac --decode --silent audio.flac
$ sox audio.wav audio.raw
$ md5sum audio.raw
7853aca9317d3b348b3aad5219fa63c9 audio.raw
I hope this helps.
More information about the Flac
mailing list