Skip to content

Instantly share code, notes, and snippets.

@rodolfofadino
Created January 13, 2013 19:19
Show Gist options
  • Save rodolfofadino/4525754 to your computer and use it in GitHub Desktop.
Save rodolfofadino/4525754 to your computer and use it in GitHub Desktop.
public string GetHashFromFile(string localDoArquivo)
{
using (HashAlgorithm hashAlgorithm = HashAlgorithm.Create("SHA1"))
{
using (Stream stream = new FileStream(localDoArquivo, FileMode.Open, FileAccess.Read))
{
byte[] hash = hashAlgorithm.ComputeHash(stream);
return BitConverter.ToString(hash);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment