If I have a file that I want to monitor for any changes (other than looking at the file date stamps etc).
How could I perform a SHA1 hash on its contents?
using (FileStream stream = File.OpenRead(@"C:\File.ext")) { using (SHA1Managed sha = new SHA1Managed()) { byte[] checksum = sha.ComputeHash(stream); string sendCheckSum = BitConverter.ToString(checksum) .Replace("-", string.Empty); } }
Calculate the checksum periodically.