Beispiel #1
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (textBox1.Text == "admin" && textBox2.Text == "admin")
     {
         AdminHome a = new AdminHome();
         a.Show();
     }
     else
     {
         string        pass;
         OracleCommand h = new OracleCommand("select password from kasir where id_kasir = '" + textBox1.Text + "'", conn);
         pass = h.ExecuteScalar().ToString();
         byte[] data1 = Convert.FromBase64String(pass);
         using (MD5CryptoServiceProvider md5 = new MD5CryptoServiceProvider())
         {
             byte[] keys = md5.ComputeHash(UTF8Encoding.UTF8.GetBytes(hash));
             using (TripleDESCryptoServiceProvider tripdes = new TripleDESCryptoServiceProvider()
             {
                 Key = keys, Mode = CipherMode.ECB, Padding = PaddingMode.PKCS7
             })
             {
                 ICryptoTransform transform = tripdes.CreateDecryptor();
                 byte[]           results   = transform.TransformFinalBlock(data1, 0, data1.Length);
                 passwordb = UTF8Encoding.UTF8.GetString(results);
             }
         }
         MessageBox.Show(passwordb);
         if (pass != "")
         {
             if (textBox2.Text == passwordb)
             {
                 KasirHome a = new KasirHome();
                 a.ambil(textBox1.Text);
                 a.Show();
             }
             else
             {
                 MessageBox.Show("password salah");
             }
         }
         else
         {
             MessageBox.Show("username tidak ada");
         }
     }
 }