private string GetMd5(Stream fileStream) { MD5CryptoServiceProvider md5Provider = new MD5CryptoServiceProvider(); byte[] bytesHash = md5Provider.ComputeHash(fileStream); md5Provider.Clear(); StringBuilder sbResult = new StringBuilder(); for (int i = 0; i < bytesHash.Length; i++) { sbResult.Append(bytesHash[i].ToString("X").PadLeft(2, '0')); } return sbResult.ToString().ToLower(); }