Here is a simple code to get the Hash value of a byte[] (byte array). The byte[] can be from any file. You can see my previous post to get the hash value directly from file. Click Here.
Happy coding :)
public static string GetHashValue(byte[] content)
{
string hash;
using (System.Security.Cryptography.SHA1CryptoServiceProvider sha = new System.Security.Cryptography.SHA1CryptoServiceProvider())
{
hash = Convert.ToBase64String(sha.ComputeHash(content));
}
return hash;
}
Happy coding :)
No comments:
Post a Comment