I want to move from the unofficial implementations of hash functions to the official System.IO.Hashing. But I absolutely do not understand how to make a report on the progress of hashing? I intend to use the XxHash3 algorithm, but I think it doesn’t matter.
At the moment, I calculate the hash like this (without displaying progress):
private string GetXxHash3(string filename)
{
var hashAlgorithm = new XxHash3();
using (Stream entryStream = System.IO.File.OpenRead(filename))
hashAlgorithm.Append(entryStream);
return BitConverter.ToString(hashAlgorithm.GetHashAndReset()).Replace("-", string.Empty);
}