I've got a ASP.NET 5 RC1 (soon to be ASP.NET Core) Web Application project.
It needs to compute SHA1 hashes.
Various SHA1
subclasses are available and build under DNX 4.5.1, but there doesn't seem to be any available implementation under DNX Core 5.0.
Do I have to add a reference to bring that code in, or is it simply not available for .NET Core yet?
According to this article:
.NET Core consists of a set of libraries, called “CoreFX”, and a small, optimized runtime, called “CoreCLR”.
Sure enough, in the CoreFX repo, there are no subclasses of SHA1
:
https://github.com/dotnet/corefx/tree/master/src/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography
However in CoreCLR the subclasses are there as you'd expect, within mscorlib:
https://github.com/dotnet/coreclr/tree/43b39a73cbf832ec13ec29ed356cb75834e7a8d7/src/mscorlib/src/System/Security/Cryptography
Why is there overlap between coreclr and corefx? Is this mscorlib code not available for .NET Core projects?
The description of the System.Security.Crytpography.Algorithms
package on NuGet says:
Provides base types for cryptographic algorithms, including hashing, encryption, and signing operations.
Is there another package that includes actual algorithms and not just base classes? Is this something that simply hasn't been ported yet? Is there somewhere you can review the status of APIs and a roadmap, as Mono has?
Add the System.Security.Cryptography.Algorithms
nuget package.
Then
var sha1 = System.Security.Cryptography.SHA1.Create();
var hash = sha1.ComputeHash(myByteArray)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With