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