Created
August 3, 2015 06:16
-
-
Save mishrsud/bf26eebf7cfeb0fa0590 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void Main() | |
{ | |
var fileName = @"C:\OfficeDocs\somfile.js"; | |
var hash = GetFileHash(fileName); | |
hash.Dump("Hash"); | |
} | |
// Define other methods and classes here | |
public static string GetFileHash(string filePath) | |
{ | |
using (FileStream stream = File.OpenRead(filePath)) | |
{ | |
var sha = new SHA256CryptoServiceProvider(); | |
byte[] hash = sha.ComputeHash(stream); | |
return BitConverter.ToString(hash).Replace("-", String.Empty); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment