I have a simple encryption/decryption application that I am testing to learn more about security. I found out that if the user modifies the encrypted file, then decryption fails because the hashing algorithm doesn't generate back the original content. What are the common practices that deal with the problem of encrypted files modified by users either intentionally or unintentionally? The only thing I can think of is timestamp checking, but I am not sure how useful that is. About my last statement, I guess I am not sure if there is a way to trick the OS so that the new timestamp is set back to the exact old time stamp although the content is modified. 
How to handle the problem of modified encrypted files
security;encryption
Well, any file altered after encryption is going to generate funny results. The only way I would know of detecting such changes would be to store a hash of the encrypted file when you do the encryption, and then compare that hash to the hash of the encrypted file prior to decryption. If there are any changes, the hashes will mismatch, and you'll know that the encrypted file isn't going to return the original results.Don't rely on file stamps, though; timestamps and other metadata can change simply by moving a file around (either by the user or other processes). (Furthermore, timestamps and metadata can always be changed back, thus fooling the check.)