Generate SHA1 checksum of a file
suggest changefirst you add System.Security.Cryptography namespace to your project
public string GetSha1Hash(string filePath)
{
using (FileStream fs = File.OpenRead(filePath))
{
SHA1 sha = new SHA1Managed();
return BitConverter.ToString(sha.ComputeHash(fs));
}
}
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents