Represents the base class from which all implementations of cryptographic hash algorithms must derive.
For a list of all members of this type, see HashAlgorithm Members.
[Visual Basic] MustInherit Public Class HashAlgorithm Implements ICryptoTransform, IDisposable [C#] public abstract class HashAlgorithm : ICryptoTransform, IDisposable [C++] public __gc __abstract class HashAlgorithm : public ICryptoTransform, IDisposable [JScript] public abstract class HashAlgorithm implements ICryptoTransform, IDisposable
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Hash functions are fundamental to modern cryptography. These functions map binary strings of an arbitrary length to small binary strings of a fixed length, known as hash values. A cryptographic hash function has the property that it is computationally infeasible to find two distinct inputs that hash to the same value. Hash functions are commonly used with digital signatures and for data integrity.
The hash is used as a unique value of fixed size representing a large amount of data. Hashes of two sets of data should match if the corresponding data also matches. Small changes to the data result in large unpredictable changes in the hash.
[Visual Basic, C#, C++] The following example computes the SHA1CryptoServiceProvider hash for an array. This example assumes that there is a predefined byte array dataArray. SHA1CryptoServiceProvider is a derived class of HashAlgorithm.
[Visual Basic] Dim sha As New SHA1CryptoServiceProvider() Dim result As Byte() = sha.ComputeHash(dataArray) [C#] HashAlgorithm sha = new SHA1CryptoServiceProvider(); byte result = sha.ComputeHash(dataArray); [C++] HashAlgorithm* sha = new SHA1CryptoServiceProvider(); Byte result = sha->ComputeHash(dataArray);
[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button in the upper-left corner of the page.
Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family
Assembly: Mscorlib (in Mscorlib.dll)