• Tidak ada hasil yang ditemukan

LISTING PROGRAM. private void pemecahankuncibutton_click(object sender, EventArgs e) { PemecahanForm form = new PemecahanForm(); form.

N/A
N/A
Protected

Academic year: 2021

Membagikan "LISTING PROGRAM. private void pemecahankuncibutton_click(object sender, EventArgs e) { PemecahanForm form = new PemecahanForm(); form."

Copied!
9
0
0

Teks penuh

(1)

LISTING PROGRAM

Form „Halaman Utama‟

using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; namespace MetodeKraitchik {

public partial class HalamanUtamaForm : Form {

public HalamanUtamaForm() {

InitializeComponent(); }

private void pemecahanKunciButton_Click(object sender, EventArgs e)

{

PemecahanForm form = new PemecahanForm(); form.ShowDialog();

}

private void dekripsiButton_Click(object sender, EventArgs e) {

dekripsiForm form = new dekripsiForm(); form.ShowDialog();

}

private void tentangButton_Click(object sender, EventArgs e) {

tentangForm form = new tentangForm(); form.ShowDialog();

}

private void bantuanButton_Click(object sender, EventArgs e) {

bantuanForm form = new bantuanForm(); form.ShowDialog();

} } }

Form „Pemecahan Kunci RSA‟

using System;

using System.Collections.Generic; using System.ComponentModel;

(2)

using System.Data; using System.Drawing; using System.Linq; using System.Numerics; using System.Text; using System.Threading.Tasks; using System.Threading; using System.Windows.Forms; using System.Diagnostics; namespace MetodeKraitchik {

public partial class PemecahanForm : Form {

DateTime start, finish;

BigInteger D, E, p, q;

BigInteger[] hasil = new BigInteger[2]; public PemecahanForm()

{

InitializeComponent(); }

public static bool IsSquare(BigInteger X) { BigInteger sqr = AkarkanBigInteger.SRO(X); if (sqr * sqr == X) { return true; } return false; }

public static BigInteger[] Kraitchik(BigInteger N) {

BigInteger[] hasil = new BigInteger[2]; bool found = false;

BigInteger x = AkarkanBigInteger.SRO(N); BigInteger k = 1; while (!found) { if (IsSquare(x * x - k * N) && x * x - k * N != 0) { BigInteger y = AkarBigInteger.SRO(x * x - k * N); if ((x + y) - k * N != 0 && (x - y) - k * N != 0) { hasil[0] = (x + y) / k; hasil[1] = x - y;

if (0 < hasil[0] && hasil[0] < N && 0 < hasil[1] && hasil[1] < N) found = true; } k++; } x++; } return hasil; }

(3)

public static BigInteger GCD(BigInteger m, BigInteger n) { BigInteger r = n % m; while (r != 0) { r = m % n; m = n; n = r; } return m; }

public static BigInteger nilaiE(BigInteger totienK, BigInteger nK) { BigInteger E = 2; while (GCD(totienK, E) != 1) { E++; } return E; }

public static BigInteger nilaiD(BigInteger EK, BigInteger totienK)

//modular Inverse Extended Euclidean GCD {

BigInteger x = 1, y = 0, xLast = 0, yLast = 1; BigInteger a = EK, b = totienK;

BigInteger c, d, q, r; while (a != 1) { q = b / a; r = b % a; c = xLast - q * x; d = yLast - q * y; xLast = x; yLast = y; x = c; y = d; b = a; a = r; } x = (x + totienK) % totienK; return x; }

public static BigInteger faktorPrima(BigInteger n) { BigInteger k = 2; while (k * k <= n) { if (n % k == 0) { n /= k; } else { ++k; }

(4)

}

return n; }

private void button1_Click(object sender, EventArgs e) { try { if (textBox1.Text.Length <= 64) { textBox3.Text = ""; textBox4.Text = ""; start = DateTime.Now; timer1.Enabled = true; hasil = Kraitchik(BigInteger.Parse(textBox1.Text)); finish = DateTime.Now; } else {

MessageBox.Show("Panjang Kunci maksimal 64 digit!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);

} } catch {

MessageBox.Show("Silakan Input Kunci Publik (n)", "Missing data", MessageBoxButtons.OK,

MessageBoxIcon.Error); }

}

private void timer1_Tick(object sender, EventArgs e) {

TimeSpan selisih = finish.Subtract(start); textBox3.Text += hasil[0].ToString() + "\n"; textBox4.Text += hasil[1].ToString();

textBox2.Text = selisih.TotalMilliseconds + " ms"; timer1.Enabled = false;

MessageBox.Show("Pemfaktoran Kunci Publik (n) Berhasil", "Success", MessageBoxButtons.OK,

MessageBoxIcon.Information); }

private void button2_Click(object sender, EventArgs e) { textBox1.Text = ""; textBox2.Text = ""; textBox3.Text = ""; textBox4.Text = ""; richTextBox3.Text = ""; }

private void button3_Click(object sender, EventArgs e) {

(5)

form.ShowDialog(); }

private void button4_Click(object sender, EventArgs e) { try { richTextBox3.Text = ""; p = BigInteger.Parse(textBox3.Text); q = BigInteger.Parse(textBox4.Text); BigInteger n = BigInteger.Multiply(p, q);

BigInteger totien = BigInteger.Multiply(p - 1, q - 1);

E = nilaiE(totien, n);

richTextBox3.Text += "Kunci Publik " + "(" + "e =" + E.ToString() + ", " + "n =" + n.ToString() + ")" + "\n\n";

d = nilaiD(E, totien);

richTextBox3.Text += "Kunci Privat " + "(" + "d =" + d.ToString() + ", " + "n =" + n.ToString() + ")" + "\n\n";

richTextBox3.Text += "Panjang Kunci Publik (n) = " + textBox1.Text.Length + "\n\n";

richTextBox3.Text += "Totien (n) = " + totien.ToString() + "\n\n";

BigInteger S = p - q;

richTextBox3.Text += "Selisih Faktor Kunci (p-q) = " + S.ToString() + "\n\n"; BigInteger G = GCD(p - 1, q - 1); richTextBox3.Text += "GCD (p-1, q-1) = " + G.ToString() + "\n\n"; BigInteger Fp = faktorPrima(p - 1);

richTextBox3.Text += "Faktor Prima p-1 = " + Fp.ToString() + "\n\n";

BigInteger Fq = faktorPrima(q - 1);

richTextBox3.Text += "Faktor Prima q-1 = " + Fq.ToString() ;

} catch {

MessageBox.Show("Silakan Input Kunci Publik (n)", "Missing data", MessageBoxButtons.OK,

MessageBoxIcon.Error); }

} } }

Form „Dekripsi RSA‟

(6)

using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using System.Numerics; using System.IO; namespace MetodeKraitchik {

public partial class dekripsiForm : Form {

string[] baris = null; public dekripsiForm() {

InitializeComponent(); }

private void bantuanButton_Click(object sender, EventArgs e) {

bantuanForm form = new bantuanForm(); form.ShowDialog();

}

public int[] dekripsiRSA(BigInteger[] a) {

BigInteger n = BigInteger.Parse(textBox1.Text); BigInteger d = BigInteger.Parse(textBox2.Text); int[] p = new int[a.Length];

for (int i = 0; i < a.Length; i++) {

p[i] = (int)BigInteger.ModPow(a[i], d, n); }

return p; }

public static string convertAscii(int[] p) {

string temp = "";

for (int i = 0; i < p.Length; i++) { char a=(char)p[i]; temp += a.ToString(); } return temp; }

private void button1_Click(object sender, EventArgs e) {

OpenFileDialog openFileDialog = new OpenFileDialog(); if (openFileDialog1.ShowDialog() == DialogResult.OK) {

baris =

(7)

string gabung = "";

foreach (string line in baris) { gabung += line + ""; } textBox3.Text = openFileDialog1.FileName; } }

private void button2_Click(object sender, EventArgs e) {

try {

BigInteger[] daftar = new BigInteger[baris.Length]; int i = 0;

foreach (string line in baris) {

daftar[i] = BigInteger.Parse(line); i++;

}

int[] hasildekrip = dekripsiRSA(daftar); string hasilx = convertAscii(hasildekrip);

if (saveFileDialog1.ShowDialog() == DialogResult.OK) {

File.WriteAllText(@saveFileDialog1.FileName,hasil x);

MessageBox.Show("Dekripsi Berhasil", "Sukses", MessageBoxButtons.OK,MessageBoxIcon.Information); MessageBox.Show(hasilx); textBox4.Text = saveFileDialog1.FileName; } } catch {

MessageBox.Show("Input kunci privat (n,d) atau Input File terenkripsi", "Error Input",

MessageBoxButtons.OK, MessageBoxIcon.Error); }

}

private void button3_Click(object sender, EventArgs e) { textBox1.Text = ""; textBox2.Text = ""; textBox3.Text = ""; textBox4.Text = ""; } } }

(8)

CURRICULUM VITAE

1.

Data Pribadi

Nama

: Budi Satria Muchlis

Tempat/Tanggal Lahir

: Lhokseumawe/19 Maret 1991

Jenis Kelamin

: Laki-laki

Agama

: Islam

Kewarganegaraan

: WNI

Alamat

: Komplek Villa Setiabudi Abadi II Jl. Abadi Blok F no.

16, Setiabudi, Kel. Tanjung Rejo, Kec. Medan Sunggal,

Medan, Sumatera Utara

Alamat Orang tua

: Jl. Azizi Raya no.12 Kel. Andalas Barat, Kec. Padang

Timur, Padang, Sumatera Barat

No. Hp

: 081374240163

Email

: vandeboeds@gmail.com

Status Pernikahan

: Belum Menikah

2.

Riwayat Pendidikan

Jenjang

Pendidikan

Nama Institusi Pendidikan

Tahun

TK

Tunas Harapan PT. PIM, Lhokseumawe, NAD

1996-1997

SD

Iskandar Muda PT. PIM, Lhokseumawe, NAD

1997-2003

SMP

SMP Negeri 5 Padang, Sumatera Barat

2003-2006

SMA

SMA Negeri 3 Padang, Sumatera Barat

2006-2009

PT

S1 Ilmu Komputer Fasilkom-TI Universitas

Sumatera Utara

2009-2014

3.

Pengalaman Organisasi

Nama Organisasi

Jabatan

Tahun

BRM (Rohis) SMA Negeri 3

Padang

Kabid. Kaderisasi

2007-2009

BKM Al-Khuwarizmi S1 Ilmu

Komputer USU

Kabid. Kemakmuran

Mushalla

2010

UKMI Al-Falak FMIPA USU

Anggota Dep. Humas

2010-2011

BKM Al-Khuwarizmi S1 Ilmu

Komputer USU

(9)

PEMA FMIPA USU

Kabid. Internal

2011-2012

UKMI Al-Khuwarizmi Fasilkom-TI

USU

Ketua Umum

2012-2013

DPW KAM Rabbani Fasilkom-TI

USU

Sekjend

2013

DPW KAM Rabbani Fasilkom-TI

USU

Ketua

2013-2014

4.

Pengalaman Kursus/Pelatihan/Seminar

No.

Nama Kursus/Pelatihan/Seminar

Tahun

1.

English Course Grade 4 (High Elementary) ELC (English

Language School)

2008

2.

TRICK (Training Islam Ceria dan Kreatif) UKMI

Al-Khuwarizmi Fasilkom-TI USU

2009

3.

Workshop Web Development IMILKOM Fair 2010

2010

4.

Workshop Konfigurasi Access Point & Wireless Security

Wireless Roadshow PT. Telkom Indonesia

2011

5.

Seminar Nasional Kongres Nasional ILP2MI IV

2013

5.

Keahlian/Skill

No.

Skill

Keterangan

1.

Bahasa

Indonesia, Inggris

2.

Pemrograman

Pascal, C++, C#, MATLAB, Java

3.

Database

MySql

Referensi

Dokumen terkait

Sementara ini jemaat-jemaat dalam lingkup GKI SW Jateng yang membuka kelas-kelas sekolah minggu untuk anak usia 3-6 tahun, yang biasanya disebut dengan kelas balita, pada umumnya

Dengan struktur demikian, maka WHO tidak dapat hanya menuntut negara korban untuk melaksanakan kewajiban virus sharing sebagai bagian dari kewajiban publiknya sebagai

Penulis menggunakan 4 (empat) indikator implementasi kebijakan yaitu Informasi, Isi Kebijakan, Dukungan Masyarakat dan Pembagian Potensi. Sumber data terdiri dari data primer

PENGEMBANGAN PERBAIKAN SIFAT FLY ASH SEBAGAI BAHAN PENGGANTI SEBAGIAN SEMEN adalah hasil karya saya, dan dalam naskah tugas akhir ini tidak terdapat karya

Hasil dari penelitian yang dilakukan untuk pembangunan aplikasi Online Fashion Market yaitu memudahkan pedagang dalam hal memasarkan produknya secara online juga memudahkan

20 tentang Sistem Pendidikan Nasional pasal 37 (2) merupakan usaha untuk membekali peserta didik dengan pengetahuan dan kemampuan dasar berkenaan dengan hubungan

Oleh karena prevalensi stres atau kecenderungan neurosis lebih banyak dijumpai pada wilayah pedesaan, bukan daerah yang terkena dampak tsunami berat serta bukan merupakan daerah yang

Memberikan bermacam-macam penafsiran terhadap suatu gambar, cerita atau masalah; memberikan suatu pertimbangan dari situasi yang berbeda dari yang diberikan orang lain dalam