Microsoft.CodeAnalysis.Sarif.HashUtilities.ComputeMD5Hash C# (CSharp) Method

ComputeMD5Hash() public static method

public static ComputeMD5Hash ( string fileName ) : string
fileName string
return string
        public static string ComputeMD5Hash(string fileName)
        {
            string md5 = null;

            try
            {
                using (FileStream stream = File.OpenRead(fileName))
                {
                    using (var bufferedStream = new BufferedStream(stream, 1024 * 32))
                    {
                        using (var sha = new MD5Cng())
                        {
                            byte[] checksum = sha.ComputeHash(bufferedStream);
                            md5 = BitConverter.ToString(checksum).Replace("-", string.Empty);
                        }
                    }
                }
            }
            catch (IOException) { }
            catch (UnauthorizedAccessException) { }
            return md5;
        }