public static string Hash(this IFileInfo fileInfo, IHashAlgorithm hashAlgorithm = null) { if (hashAlgorithm == null) { hashAlgorithm = Hashing.Default; } using (hashAlgorithm) { using (var stream = fileInfo.OpenRead()) { var hash = hashAlgorithm.ComputeHex(stream); return(hash); } } }
public static string Hash(this IFileInfo fileInfo, IHashAlgorithm hashAlgorithm = null) { if (hashAlgorithm == null) { hashAlgorithm = Hashing.Default; } using (hashAlgorithm) { using (var stream = fileInfo.OpenRead()) { var hash = hashAlgorithm.ComputeHex(stream); return hash; } } }