最後我嘗試使用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