public static int GetFileHash(string filePath)
{
if (!File.Exists(filePath)) return 0;
using (BufferedStream stream = new BufferedStream(File.OpenRead(filePath), 512000))
{
var sha = MD5.Create();
byte[] hash = sha.ComputeHash(stream);
return BitConverter.ToInt32(hash, 0);
}
}