示例#1
0
文件: Program.cs 项目: Corey-M/Misc
 private static string CalculateHash(FileInfo sourceFile)
 {
     if (_md5 == null)
         _md5 = MD5.Create();
     using (var src = new ProgressStream(sourceFile.OpenRead()))
     {
         var hashBytes = _md5.ComputeHash(src);
         if (exit_loops)
             return string.Empty;
         var res = BitConverter.ToString(hashBytes).Replace("-", "").ToLower();
         return res;
     }
 }
示例#2
0
 private static string CalculateHash(FileInfo sourceFile)
 {
     if (_md5 == null)
     {
         _md5 = MD5.Create();
     }
     using (var src = new ProgressStream(sourceFile.OpenRead()))
     {
         var hashBytes = _md5.ComputeHash(src);
         if (exit_loops)
         {
             return(string.Empty);
         }
         var res = BitConverter.ToString(hashBytes).Replace("-", "").ToLower();
         return(res);
     }
 }