CSharp examples for System.Security.Cryptography:MD5
Digests the given string using the MD5 algorithm.
// MailSystem.NET is free software; you can redistribute it and/or modify public class Main{ /// <summary> /// Digests the given string using the MD5 algorithm. /// </summary> /// <param name="data">The data to be digested.</param> /// <remarks>This method is used for APOP authentication.</remarks> /// <returns>A 16 bytes digest representing the data.</returns> /// <example> /// The example below illustrates the use of this method. /// //from w w w . ja v a2 s .c o m /// <code> /// C# /// /// string data = "ActiveMail rocks ! Let's see how this string is digested..."; /// string digest = Crypto.MD5Digest(data); /// </code> /// /// digest returns 3ff3501885f8602c4d8bf7edcd2ceca1 /// /// Digesting is used to check data equivalence. /// Different data result in different digests. /// </example> public static string MD5Digest(string data) { System.Security.Cryptography.MD5CryptoServiceProvider md5 = new System.Security.Cryptography.MD5CryptoServiceProvider(); byte[] bufe = md5.ComputeHash(System.Text.Encoding.ASCII.GetBytes(data)); return System.BitConverter.ToString(bufe).ToLower().Replace("-",""); } }