Header Ads

Encrypt and Decrypt text in C#

I have simple way to do it.

Creat a form. 3 textbox and 2 command button.


private void button1_Click(object sender, EventArgs e)
{
textBox2.Text = Convert.ToBase64String(Encoding.Unicode.GetBytes(textBox1.Text));
}


private void button2_Click(object sender, EventArgs e)
{
textBox3.Text = Encoding.Unicode.GetString(Convert.FromBase64String(textBox2.Text));
}

No comments:

Powered by Blogger.