Пример #1
0
 private void button6_Click(object sender, EventArgs e1)
 {
     try
     {
         using (StreamReader sr = new StreamReader(duongdanfile))
         {
             string     ketqua      = "";
             int        e           = Convert.ToInt32(txte.Text);
             int        N           = Convert.ToInt32(txtN.Text);
             String     line        = sr.ReadToEnd();
             string     textnhapvao = line;
             char[]     mangchar    = line.ToCharArray();
             List <int> mangso      = new List <int>();
             foreach (char c in mangchar)
             {
                 mangso.Add(Convert.ToInt32(c));
             }
             foreach (int i in mangso)
             {
                 int  soketquagiaima = GiaiThuat.GiaiMaChungThucRSA(e, N, i);
                 char charduocmahoa  = (char)soketquagiaima;
                 ketqua = ketqua + charduocmahoa;
             }
             txtKetQua.Text = ketqua;
         }
     }
     catch
     {
         MessageBox.Show("Có lỗi xảy ra");
     }
 }
Пример #2
0
 private void btnTestGMBM_Click(object sender, EventArgs e)
 {
     try
     {
         int C        = Convert.ToInt32(txtTestC.Text);
         int d        = Convert.ToInt32(txtd.Text);
         int N        = Convert.ToInt32(txtN.Text);
         int soketqua = GiaiThuat.GiaiMaChungThucRSA(d, N, C);
         txtTestResult.Text = soketqua.ToString();
     }
     catch
     {
         MessageBox.Show("Có lỗi xảy ra.");
     }
 }
Пример #3
0
        private void button4_Click(object sender, EventArgs e)
        {
            int ketqua = GiaiThuat.GiaiMaChungThucRSA(Convert.ToInt32(txte.Text), Convert.ToInt32(txtN.Text), 27);

            MessageBox.Show(ketqua.ToString());
        }