考慮對我的登錄表單進行一些修改,而不是將我的代碼中的密碼作爲變量存在一種方法,我可以加密它並將其存儲在文本文件中,我想登錄它的時間比較文本文件的密碼?基本的密碼加密和存儲在一個文件中的密碼
private void button1_Click(object sender, EventArgs e)
{
string username1 = "Richard";
string password1 = "Peugeot";
if (this.textBox1.Text == username1 && this.textBox2.Text == password1)
{
MessageBox.Show("Welcome Richard!", "Welcome");
Form1 frm = new Form1();
frm.Show();
this.Hide();
}
else
MessageBox.Show("Incorrect username or password", "Bad credentials");
}
基本上,你要找的字符串加密,這是有據可查的,請參閱[在.NET中加密/解密字符串](http://stackoverflow.com/questions/202011/encrypt-decrypt-string-in-net)。 –
你是否至少在Google上搜索了一秒鐘,到目前爲止你嘗試過了些什麼。 (哦,並且對你的問題提出質疑,那可能) –