最后我尝试使用mysql中的加密和压缩函数来获取安全密码和用户名。如何使用DES_DECRYPT()函数从mysql中获取数据?
DES_ENCRYPT函数完全适用于加密。我给我用来加密和保存在数据库中的代码。
MySqlConnection connection = new MySqlConnection(MyConString);
MySqlCommand command = connection.CreateCommand();
command.CommandText = "insert into user (User_Id, Password, Branch, Upto_Date) values (DES_ENCRYPT('" + textBox1.Text + "'),DES_ENCRYPT('" + textBox2.Text + "'),'" + comboBox1.SelectedItem.ToString() + "','" + textBox4.Text + "') ";
connection.Open();
command.ExecuteNonQuery();
MessageBox.Show("Record Succesfully Added", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
connection.Close();
但我无法在DES_DECRYPT函数中检索数据。
我试"select DES_DECRYPT(User_Id),DES_DECRYPT(Password),Branch,Upto_Date from user"
代码检索但没有用。我做什么从MySQL数据表中获取数据?
的最后一个记录,使用DES_ENCRYPT()函数插入。
我没有足够的时间做哈希!所以只有我切换到这个。任何方式谢谢你。 – Sagotharan 2011-06-03 09:38:12
任何加密都比在数据库中存储普通密码更好! ;-) – Bjoern 2011-06-03 09:45:05