考虑对我的登录表单进行一些修改,而不是将我的代码中的密码作为变量存在一种方法,我可以加密它并将其存储在文本文件中,我想登录它的时间比较文本文件的密码?基本的密码加密和存储在一个文件中的密码
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上搜索了一秒钟,到目前为止你尝试过了些什么。 (哦,并且对你的问题提出质疑,那可能) –