示例#1
0
        private string GetMd5(string filePath)
        {
            string result = null;

            try
            {
                using (var fs = new FileStream(filePath, FileMode.Open, FileAccess.Read)
                {
                    Position = 0
                })
                {
                    var ha = new MD5CryptoServiceProvider().ComputeHash(fs).ToList();
                    fs.Close();
                    ha.ForEach(x => result += $"{x:X2}");
                }
            }
            catch
            {
                // ignored
            }
            return(result);
        }