Better yet: Use the hash (SHA256 for eg) to cipher the file itself (using AES256 for eg), and append a hash of the clear-text file (can be anything, even simple CRC) to the ciphered file.
To decipher:
- Ask password to user
- Hash the password with SHA256
- Decipher the file using the password hash as key
- Compute the CRC of the deciphered file
- If the computed CRC matches what was appended after the cipher text, the password was correct. If they don't match, the key wasn't good and you deciphered garbage which means the password was not good.
As a bonus, no need to keep a 'secret' key somewhere, it's all self contained. Plus bruteforce/dictionary attack are painful because you have to decipher the whole file for each try to check the CRC.