R – CRC checks for files


I'm working with a small FAT16 filesystem, and I want to generate CRC values for indidual XML files which store configuration information. In case the data changes or is corrupted, I want to be able to check the CRC to determine that the file is still in it's original state.

The question is, how do I put the CRC value into the file, without changing the CRC value of the file itself? I can think of a couple solutions, but I think there must be a fairly standard solution for this issue.

Best Solution

You could append the CRC value to the end of the file. Then, when computing the CRC value later for checking, omit the last four bytes.

Related Question