CSharp examples for Security:MD5
Gets the MD5 of the given string.
using System.Reflection; using System.Xml.Linq; using System.Text; using System.Linq; using System.Globalization; using System.Collections.Generic; public class Main{ /// <summary> /// Gets the MD5 of the given string. /// </summary> /// <param name="input">The input.</param> /// <returns>The MD5 hash.</returns> static string GetMD5(string input) {/* w ww . j ava 2 s . co m*/ var bytes = Encoding.UTF8.GetBytes(input); var data = MD5Core.GetHash(bytes); var builder = new StringBuilder(); for (int i = 0; i < data.Length; i++) builder.Append(data[i].ToString("x2")); return builder.ToString(); } }