#DESHIFRLASH KODINI HARFLARGA O„GIRISH
ss=""
for t in range (0,l): son=deshifrmatn[t] ss+=chr(son)
print(ss)
fout.write(str(s)) fout.write("\n") fout.write(str(index))
fout.write("\n") fout.write(str(shifrmatn)) fout.write("\n") fout.write(shifrmatn2) fout.write("\n") fout.write(str(ss)) fin.close()
fout.close()
i=input("Deshifrlash muofoqiyatli bajarildi!!!")
Keys topshiriq: Microsoft Visual Studio muhitining WindowsFormsApplication
C# dasturlash tilida RSA algoritmi loyihasini bajarish tartibi.
Microsoft Visual Studio muhitida loyiha yaratish uchun:
Microsoft Visual Studio ilovasini https://visualstudio.microsoft.com rasmiy saytida yuklaymiz va komputerrimizga o‗rnatamiz.
Microsoft Visual Studio ilovasini ishga tushiramiz.
2.1- rasm. Microsoft Visual Studio ilovasi bosh oynasi.
Unda New Project->Visual C#-> WindowsFormsApplication ni tanlaymiz.
2.2-rasm. WindowsFormsApplicationni tanlash.
WindowsFormsApplicationning oynasi obyektlar joylashtirish.
2.3-rasm. WindowsFormsApplicationning asosiy oynasi.
C# dasturlash tilida RSA algoritmi loyihasining kodi:
using System;
using System.Collections.Generic; using System.ComponentModel; using System.Data;
using System.Drawing; using System.Linq; using System.Text;
using System.Threading.Tasks; using System.Windows.Forms;
namespace WindowsFormsApplication6
{
public partial class Form1 : Form
{
int m;
public Form1()
{
InitializeComponent();
}
private void label5_Click(object sender, EventArgs e)
{
}
private void button1_Click(object sender, EventArgs e)
{
int p = int.Parse(textBox1.Text); int q = int.Parse(textBox2.Text); int n = p * q;
m = (p-1) * (q-1);
textBox3.Text = n.ToString(); textBox4.Text = m.ToString();
}
private void button2_Click(object sender, EventArgs e)
{
for (int i = 2; i <= m; i++)
{
bool tub = true;
for (int j = 2; j < i; j++)
{
if (i % j == 0)
{
tub = false; break;
}
}
if (tub == true) richTextBox1.Text += i + ",";
}
}
private void textBox1_TextChanged(object sender, EventArgs e)
{
}
private void button5_Click(object sender, EventArgs e)
{
int e1=1;
int d = int.Parse(textBox5.Text); while ((e1*d%m!=1)||(e1==d))
{ e1 = e1 + 1; }
textBox6.Text = e1.ToString();
}
private void button3_Click(object sender, EventArgs e)
{
string s=richTextBox2.Text; int l = s.Length;
for (int i = 1; i < l; i++)
{
int a = s[i];
int b=int.Parse(textBox6.Text); int n=int.Parse(textBox3.Text);
int c=1;
for (int j = 0; j < b; j++)
{ c = c * a; } c = c % n;
richTextBox3.Text+=n.ToString()+",";
}
}
}
}
|