コード例 #1
0
ファイル: RC4.cs プロジェクト: Razvan09/Proiect_Diploma
        //buton pentru criptare fisier
        private void BtnCriptare_Click(object sender, EventArgs e)
        {
            string cale = @"C:\Users\RaZwAn\Desktop\Proiect_diploma_2019";

            //folosit la decriptare
            Proiect_Diploma.Clasa_RC4 rc4 = new Proiect_Diploma.Clasa_RC4(txtcheie.Text, txtclar.Text);
            c = Proiect_Diploma.Clasa_RC4.ConvBininHex(rc4.CriptDecript());
            //folosit pentru criptare
            string textclar = txtclar.Text.Replace(" ", "");

            Proiect_Diploma.Clasa_RC4 rc41 = new Proiect_Diploma.Clasa_RC4(txtcheie.Text, textclar.Replace("\r\n", ""));
            c1 = Proiect_Diploma.Clasa_RC4.ConvBininHex(rc41.CriptDecript());

            //mesaj criptat RC4
            for (int i = 0; i < c1.Length; i++)
            {
                using (StreamWriter fisier = File.AppendText(@"C:\Users\RaZwAn\Desktop\Trupoiu Razvan\Proiect_Diploma_2019\Proiect_Diploma\valCriptate.txt"))
                {
                    if (i % 2 == 0)
                    {
                        txtcriptat.AppendText(c1[i].ToString());
                    }
                    else
                    {
                        txtcriptat.AppendText(c1[i] + " ");
                    }
                    fisier.Close();
                }
            }

            rc4.Text = Proiect_Diploma.Clasa_RC4.ConvHexinBin(c);
            MessageBox.Show("Fisierul a fost criptat cu succes!");
        }
コード例 #2
0
ファイル: RC4.cs プロジェクト: Razvan09/Proiect_Diploma
 //buton pentru decriptare fisier
 private void BtnDecriptare_Click(object sender, EventArgs e)
 {
     Proiect_Diploma.Clasa_RC4 rc4 = new Proiect_Diploma.Clasa_RC4(txtcheie.Text, txtclar.Text);
     rc4.Text          = Proiect_Diploma.Clasa_RC4.ConvHexinBin(c);
     txtdecriptat.Text = rc4.CriptDecript();
 }