MD5CryptoServiceProvider Class
Computes the MD5 hash for the input data using the implementation provided by the cryptographic service provider (CSP).
For a list of all members of this type, see MD5CryptoServiceProvider Members.
System.Object
System.Security.Cryptography.HashAlgorithm
System.Security.Cryptography.MD5
System.Security.Cryptography.MD5CryptoServiceProvider
[Visual Basic] NotInheritable Public Class MD5CryptoServiceProvider Inherits MD5 [C#] public sealed class MD5CryptoServiceProvider : MD5 [C++] public __gc __sealed class MD5CryptoServiceProvider : public MD5 [JScript] public class MD5CryptoServiceProvider extends MD5
Thread Safety
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Example
[Visual Basic, C#, C++] The following example is a method that computes the MD5 hash for data and returns it.
[Visual Basic] Function MD5hash(data() As Byte) As Byte() ' This is one implementation of the abstract class MD5. Dim md5 As New MD5CryptoServiceProvider() Dim result As Byte() = md5.ComputeHash(data) Return result End Function [C#] byte[] MD5hash (byte[] data) { // This is one implementation of the abstract class MD5. MD5 md5 = new MD5CryptoServiceProvider(); byte[] result = md5.ComputeHash(data); return result; } [C++] Byte MD5hash (Byte data[]) [] { // This is one implementation of the abstract class MD5. MD5* md5 = new MD5CryptoServiceProvider(); Byte result[] = md5->ComputeHash(data); return result; }
[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.
Requirements
Namespace: System.Security.Cryptography
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)
See Also
MD5CryptoServiceProvider Members | System.Security.Cryptography Namespace | Cryptographic Services