file integrrity

How to check file integrity before restoring it?