using System.Security.Cryptography;

....

FileStream file = new FileStream(fileName, FileMode.Open);

MD5 md5 = new MD5CryptoServiceProvider();

byte[] result = md5.ComputeHash(file);

file.Close();

string md5Hash = Convert.ToBase64String(result);

 ....