System.Security.Cryptography.MD5CryptoServiceProvider Class

Computes the System.Security.Cryptography.MD5 hash value for the input data using the implementation provided by the cryptographic service provider (CSP). This class cannot be inherited.

See Also: MD5CryptoServiceProvider Members

Hash functions map binary strings of an arbitrary length to small binary strings of a fixed length. A cryptographic hash function has the property that it is computationally infeasible to find two distinct inputs that hash to the same value; that is, 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.

Newer hash functions such as the Secure Hash Algorithms SHA-256 and SHA-512 are available. Consider using the System.Security.Cryptography.SHA256 class or the System.Security.Cryptography.SHA512 class instead of the System.Security.Cryptography.MD5CryptoServiceProvider class. Use System.Security.Cryptography.MD5CryptoServiceProvider only for compatibility with legacy applications and data.

The hash size for the System.Security.Cryptography.MD5CryptoServiceProvider class is 128 bits.

The erload:System.Security.Cryptography.HashAlgorithm.ComputeHash methods of the System.Security.Cryptography.MD5CryptoServiceProvider class return the hash as an array of 16 bytes. Note that some MD5 implementations produce a 32-character, hexadecimal-formatted hash. To interoperate with such implementations, format the return value of the erload:System.Security.Cryptography.HashAlgorithm.ComputeHash methods as a hexadecimal value.