1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
|
private void button1_Click(object sender, EventArgs e)
{
string key = "12345678";
string iv = "12345678";
byte[] password = ASCIIEncoding.ASCII.GetBytes(textBox1.Text);
DESCryptoServiceProvider des = new DESCryptoServiceProvider();
des.Key = ASCIIEncoding.ASCII.GetBytes(key);
des.IV = ASCIIEncoding.ASCII.GetBytes(iv);
ICryptoTransform encrypt = des.CreateEncryptor();
MemoryStream str = new MemoryStream(password);
CryptoStream crp = new CryptoStream(str, encrypt, CryptoStreamMode.Write);
} |
Partager