This is because you always invoke the same static method, SHA256.Create . SHA256 is an abstract class, and its descendants do not provide an alternative method. In fact, Resharper will give you a warning that you are accessing a static member from a derived type.
Actually, calling SHA256.Create is similar to calling HashAlgorithm.Create . Both classes use the same implementation within themselves and simply cast the result to different types.
The SHA256.Create method will create the default implementation specified in the machine.config file and can be overridden in your app.config
If you want to use a specific provider, use SHA256.Create (string) , passing in the name of the provider you want to use.
Examples:
SHA256.Create("System.Security.Cryptography.SHA256Cng"); HashAlgorithm.Create("System.Security.Cryptography.SHA256Cng"); SHA256.Create("System.Security.Cryptography.SHA256CryptoServiceProvider");
EDIT
The HashAlgorithm.Create documentation indicates a list of valid algorithm names. The MSDN article, Cryptography Class Mapping Algorithm Names , describes how you can map the algorithm names to other providers (your own, third-party, hardware accelerations, or something else) and use them instead of the default algorithms.
EDIT 2
It is also possible to programmatically change the display. So, to map Dog to SHA512CryptoServiceProvider, you just need to write:
CryptoConfig.AddAlgorithm( typeof(System.Security.Cryptography.SHA512CryptoServiceProvider), "Dog"); var t4 = HashAlgorithm.Create("Dog");
source share