Closed mgardi85 closed 5 years ago
First of all, this is not the right place to request features for .Net Framework.
Second, I don't think this kind of changes are being done to .Net Framework anymore. Your best bet is to focus on .Net Core going forwards. And if you want to request a new API for .Net Core, the right place is the corefx repository.
thanks for the reply. will follow up in corefx repository
Within System.Security.Cryptography.HashAlgorithm we have a compute hash overload which takes stream as parameter input and then reads through the stream to compute the hash.
Since the reading may involve IO , can a new member "ComputeHashAsync" be introduced which would read assynchronously .
This would be helpful in freeing up threads .
we can have something like
public Task async<byte[]> ComputeHashAsync(Stream inputStream) { if (m_bDisposed) throw new ObjectDisposedException(null); byte[] buffer = new byte[4096]; int bytesRead; do { bytesRead = await inputStream.ReadAsync(buffer, 0, 4096); if (bytesRead > 0) { HashCore(buffer, 0, bytesRead); } } while (bytesRead > 0); HashValue = HashFinal(); byte[] Tmp = (byte[]) HashValue.Clone(); Initialize(); return(Tmp); }
https://github.com/Microsoft/referencesource/blob/master/mscorlib/system/security/cryptography/hashalgorithm.cs