C#获取文件哈希值

    using (HashAlgorithm hash = HashAlgorithm.Create())
    {
     using (FileStream file1 = new FileStream(文件路径, FileMode.Open))
     {
       byte[] hashByte1 = hash.ComputeHash(file1);
       var hashval = StringToHex.byteToHexStr(hashByte1);          
     }
   }

 

posted @ 2021-05-17 13:46  是晚安呀  阅读(1200)  评论(0编辑  收藏  举报