Generate the keyed hash code of the file's contents
using System;
using System.IO;
using System.Text;
using System.Security.Cryptography;
class MainClass
{
public static void Main(string[] args)
{
byte[] key = Encoding.Unicode.GetBytes("yourKey");
using (KeyedHashAlgorithm hashAlg = KeyedHashAlgorithm.Create("AlgorithmName"))
{
hashAlg.Key = key;
using (Stream file = new FileStream("c:\\text.txt", FileMode.Open,FileAccess.Read))
{
byte[] hash = hashAlg.ComputeHash(file);
// Display the keyed hash code to the console.
Console.WriteLine(BitConverter.ToString(hash));
}
}
}
}