Why are there multiple different hashing algorithm providers in System.Security.Cryptography?

StackOverflow https://stackoverflow.com/questions/224272

  •  03-07-2019
  •  | 
  •  

Question

As documented by MSDN, there are several providers for many of the different hashing algorithms (e.g. MD5, SHA, RIPE). For each of the algorithms, any available implementation seems to fall into 1 of 3 categories:

  • [Algo]Cng
  • [Algo]CryptoServiceProvider
  • [Algo]Managed

Why are there multiple implementations of any of these hashing algorithms?

What are the differences between the implementations?

What are the practical differences when choosing which implementation to utilize in an application?

References:

http://msdn.microsoft.com/en-us/library/system.security.cryptography.aspx

Was it helpful?

Solution

  • [Algo]Managed is a pure-IL implementation of the algorithm.
  • [Algo]CryptoServiceProvider delegates to CAPI, which allows you to use things such as hardware crypto devices.
  • [Algo]Cng uses Cryptography API: Next Generation (CNG) which is designed to be a replacement for CAPI but is only supported in Vista and Server 2008.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top