<ListBox Name="_listBox"
ItemsSource="{Binding Items, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=UserControl}}"
/>
using System;
using System.Text;
using System.Security.Cryptography;
class Program
{
static void Main(string[] args)
{
string pass = "123";
using(MD5 md5 = MD5.Create())
{
string hash = GetMD5(md5, pass);
Console.Write(hash);
Console.ReadKey();
}
}
static string GetMD5(MD5 md5, string pass)
{
byte[] data = md5.ComputeHash(Encoding.UTF8.GetBytes(pass));
StringBuilder sb = new StringBuilder();
for(int i =0; i<data.Length; i++)
{
sb.Append(data[i].ToString("x2"));
}
return sb.ToString();
}
}