I am saving some Objects I have defined from my own classes, to File. (saving the stream data).
That is all fine, but I would like to be able to store in the File the CRC checksum of that File.
Then, whenever my Application attemps to Open a File, it can read the internally stored CRC value.
Then perform a check on the actual File, if the CRC of the File matches the internally stored CRC value I can process the File normally, otherwise display an error message to say the File is not valid.
I need some advice on how to do this though, I thought I could do something like this:
- Save the File from my Application.
- Calculate the CRC of the Saved File.
- Edit the Saved File storing the CRC Value.
- Whenever a File is Opened, Check the CRC matches internal CRC Value.
Problem is, as soon as a single Byte of Data is altered in the File, results in the CRC checksum being completely different - as expected.