Wednesday, July 30, 2008

C# Hashing

using System.Security.Cryptography;


UnicodeEncoding ue = new UnicodeEncoding();
private void button1_Click(object sender, EventArgs e)
{
byte[] plaintext = ue.GetBytes(TextBoxplaintxt.Text);
MD5CryptoServiceProvider md5 = new MD5CryptoServiceProvider();
byte[] hash = md5.ComputeHash(plaintext);
TextBoxHashed.Text = Convert.ToBase64String(hash);
}

No comments: