The .NET Framework represents all hashing
algorithms with the abstract
An abstract class represents each specific algorithm, extended by
individual implementation classes, as shown in Figure 13-3. This approach supports selecting between
several implementations of the same algorithm.
Figure 13-3. The .NET Framework class hierarchy for hashing algorithms
There are two types of implementation class included with the .NET
Framework. Those whose names end with
SHA1Managed) were written in a managed
.NET language (for example, C# or Visual Basic .NET). Those classes
whose names end in
SHA1CryptoServiceProvider) rely on the
Windows Crypto API. Where there is a choice between a managed
implementation and a Crypto API implementation, our (unscientific)
testing shows that the Crypto API versions are slightly faster and
consume less system memory.