I want to store data from textbox into database but it should be encrypted and after that displaying those data by some searching key i used a method for encrypting and its work fine the main problem is displaying data decrypted
 string encClass = AESencDec.Decrypt(txt_class.Text);
 SqlConnection connection = new SqlConnection(ConnectionString);
        SqlCommand command = new SqlCommand("select * from nuclear where Class='" + encClass + "'", connection);
        connection.Open();
        command.CommandType = CommandType.Text;
        command.ExecuteNonQuery();
        DataTable dt = new DataTable();
        SqlDataAdapter da = new SqlDataAdapter();                             
        da.Fill(dt);
        dataGridView1.DataSource = dt;
        connection.Close();
it actually reads data from database and display but i want to know how can i show it decrypted ???
this is Decrypt class that I used for this project
 public static string Decrypt(string text)
    {
        string hash = "f0xle@rn";
        byte[] plaintextbytes = Convert.FromBase64String(text);
        using (MD5CryptoServiceProvider md5 = new MD5CryptoServiceProvider())
        {
            byte[] keys = md5.ComputeHash(UTF8Encoding.UTF8.GetBytes(hash));
            using (TripleDESCryptoServiceProvider triples = new TripleDESCryptoServiceProvider() { Key = keys, Mode = CipherMode.ECB, Padding = PaddingMode.PKCS7 })
            {
                ICryptoTransform transform = triples.CreateDecryptor();
                byte[] results = transform.TransformFinalBlock(plaintextbytes, 0, plaintextbytes.Length);
                return UTF8Encoding.UTF8.GetString(results);
            }
        }
    }
and this is encryption function
 public static string Encrypt(string text)
    {
         string hash = "f0xle@rn";
         byte[] plaintextbytes = UTF8Encoding.UTF8.GetBytes(text);
        using (MD5CryptoServiceProvider md5 = new MD5CryptoServiceProvider())
        {
            byte[] keys = md5.ComputeHash(UTF8Encoding.UTF8.GetBytes(hash));
                using (TripleDESCryptoServiceProvider triples = new TripleDESCryptoServiceProvider() {Key = keys, Mode = CipherMode.ECB, Padding = PaddingMode.PKCS7 })
            {
                ICryptoTransform transform = triples.CreateEncryptor();
                byte[] results = transform.TransformFinalBlock(plaintextbytes, 0, plaintextbytes.Length);
                return Convert.ToBase64String(results);
            }
        }
    }
 
    