• Tidak ada hasil yang ditemukan

LISTING PROGRAM. using System; using System.Collections.Generic; using System.Drawing; using System.Windows.Forms;

N/A
N/A
Protected

Academic year: 2021

Membagikan "LISTING PROGRAM. using System; using System.Collections.Generic; using System.Drawing; using System.Windows.Forms;"

Copied!
11
0
0

Teks penuh

(1)

LISTING PROGRAM

1. Mainform

using System; using System.Collections.Generic; using System.Drawing; using System.Windows.Forms; namespace Skripsi_1 { /// <summary> /// Description of MainForm. /// </summary>

public partial class MainForm : Form {

public char[,] kunci = new char[1000,1000];

public int[] barisw = new int[30];

public int[] cipherkunci = new int[1000];

public int bilm,biln,n;

public int kolkey, barkey;

public int nteks;

public MainForm() { InitializeComponent(); }

void ToolStripButton1Click(object sender, EventArgs e) {

}

void ToolStripButton2Click(object sender, EventArgs e) {

Form tentang = new About(); tentang.Show();

this.Hide(); }

void ENKRIPSIToolStripMenuItemClick(object sender, Eve ntArgs e)

{

Form enkrip = new Enkripsi(); enkrip.Show();

this.Hide(); }

void DEKRIPSIToolStripMenuItemClick(object sender, Eve ntArgs e)

{

Dekripsi dekrip = new Dekripsi(); dekrip.bilm = bilm;

(2)

dekrip.n = n;

for (int i=0; i<n; i++){

dekrip.cipherkunci[i] = cipherkunci[i]; }

for (int i=0; i<7; i++){

dekrip.barisw = barisw; }

dekrip.kolkey = kolkey; dekrip.barkey = barkey;

for (int i=0; i<barkey; i++){

for (int j=0; j<kolkey; j++){

dekrip.kunci[i,j] = kunci[i,j]; } } dekrip.nteks = nteks; dekrip.Show(); this.Hide(); }

void ToolStripButton3Click(object sender, EventArgs e) {

Form bantuan = new Help(); bantuan.Show();

this.Hide(); }

void ToolStripButton4Click(object sender, EventArgs e) {

if (MessageBox.Show("Apakah Anda benar ingin

keluar dari Aplikasi?","konfirmasi",

MessageBoxButtons.YesNo,MessageBoxIcon.Question)==DialogResul t.Yes)

Application.Exit(); }

void MainFormLoad(object sender, EventArgs e) {

} }

(3)

2. Enkripsi plainteks menggunakan Algoritma ADFGVX Cipher

string[] arrkunci1

= new string[] {"A", "D", "F", "G", "V", "X"}; string[,] arrkunci2

= new string[6,6] {{"F","E","D","C","B","A"}, {"G","H","I","J"," K","L"}, {"R","Q","P","O","N","M"}, {"S","T","U","V","W","X"}, { "3","2","1","0","Z","Y"}, {"4","5","6","7","8","9"}};

string tekss = richTextBox1.Text.ToUpper().ToString();

char[] teks = tekss.ToCharArray();

string[] cipher = new string[10000]; nteks = tekss.Length;

int l = 0;

Stopwatch timer = new Stopwatch(); timer.Start();

for (int i = 0; i < nteks; i++){

if (char.IsLetter(teks[i]) == true){

for (int j =0; j<6; j++){ for (int k =0; k<6; k++){ if (teks[i].ToString() == arrkunci2[j,k]){ cipher[l] = arrkunci1[j]; cipher[l+1] = arrkunci1[k]; l+=2; } } } } else{ cipher[l] = teks[i].ToString(); l+=1; } } double n = Convert.ToDouble(l)/Convert.ToDouble(textBox3.TextLength);

char[] txtkunci = textBox3.Text.ToUpper().ToCharArray();

barkey = (Convert.ToInt16( Math.Ceiling(n)))+2; kolkey = textBox3.TextLength;

for (int i = 0; i < kolkey; i++){ kunci[0,i] = txtkunci[i]; }

for (int i = 0; i <kolkey; i++){

kunci[1,i] = Convert.ToChar((i+1).ToString()); }

int x = 0;

for(int i = 2; i <barkey; i++){

if (i%2 == 0){

for(int j = 0; j<kolkey; j++){

if(cipher[x] == null){

kunci[i,j] = 'x';

(4)

else{ kunci[i,j] = Convert.ToChar(cipher[x]); x++; } } } else{

for(int k = kolkey-1; k>=0; k--){

if(cipher[x] == null){ kunci[i,k] = 'x'; } else{ kunci[i,k] = Convert.ToChar(cipher[x]); x++; } } } }

char[] tempkey = new char[kolkey];

char[] tempkey1 = new char[10000];

for (int i=0; i<kolkey; i++){ tempkey[i] = kunci[0,i]; }

Array.Sort(tempkey);

for (int i=0; i<kolkey; i++){

for (int j=i; j<kolkey; j++){

if (tempkey[i] == kunci[0,j]){

for(int k=0; k<barkey; k++){

tempkey1[k] = kunci[k,i]; kunci[k,i] = kunci[k,j]; kunci[k,j] = tempkey1[k]; } break; } } }

for (int i=0; i<kolkey; i++){

for (int j=2; j<barkey; j++){

textBox4.Text+= kunci[j,i].ToString(); }

}

timer.Stop();

textBox2.Text = timer.Elapsed.TotalSeconds.ToString();

3.

Acak Kunci Algoritma Knapsack

public int gcd(int p2, int n2){ if (n2 == 0){

(5)

return p2; }

return gcd(n2, p2 % n2); }

public bool iscoprime(int p1, int n1){ if (gcd(p1, n1) == 1){

return true; }

return false; }

void Button4Click(object sender, EventArgs e) {

nW = textBox3.TextLength;

int jumlah;

int n=1;

Random r = new Random(); textBox5.Text = textBox3.Text; barisanw[0] = r.Next(1,3); while (n<7){

jumlah = 0;

for(int j=0; j<=n-1; j++){

jumlah = jumlah+ barisanw[j]; }

barisanw[n] = jumlah + r.Next(1,5); n++;

}

int jum_elemen = 0;

for (int i=0; i<7; i++){

jum_elemen = jum_elemen + barisanw[i]; }

for (int i=0; i<7; i++){

textBox7.Text += barisanw[i].ToString()+ " "; } bilm= r.Next(jum_elemen+1,10000); biln=r.Next(255); while(iscoprime(bilm,biln) == false){ bilm=r.Next(jum_elemen+1,10000); biln=r.Next(255); } textBox8.Text = bilm.ToString(); textBox9.Text = biln.ToString(); for (int i=0; i<7; i++){

publik[i] = (barisanw[i]*biln) % bilm;

textBox11.Text += publik[i].ToString()+" ";

}

(6)

char[] txtkunci = textBox5.Text.ToCharArray(); string tempbiner;

char[] biner = new char[nW];

nW = textBox3.TextLength;

Stopwatch timer = new Stopwatch(); timer.Start();

for (int i=0; i<nW; i++){ tempbiner =

Convert.ToString((int)txtkunci[i],2).PadLeft(7,'0');

biner = tempbiner.ToCharArray();

for (int j=0; j<7; j++){

cipherkey[i] +=

Convert.ToInt16(char.GetNumericValue(biner[j])) * publik[j];

} textBox10.Text += cipherkey[i].ToString()+ " "; } timer.Stop(); textBox6.Text = timer.Elapsed.TotalSeconds.ToString();

5.

Dekripsi cipherkey menggunakan Algoritma Knapsack

int invmodulo = Convert.ToInt16(textBox4.Text);

string plainkey = "";

Stopwatch timer = new Stopwatch(); timer.Start();

for (int i=0; i<n; i++){

tempplain = (cipherkunci[i]*invmodulo) % bilm;

for (int j=6; j>=0; j--){ if (tempplain >= barisw[j]){ tempplain -= barisw[j]; binerplain[i,j] += "1"; } else{ binerplain[i,j] += 0; } } }

for (int i=0; i<n; i++){

plainkey="";

for (int j=0; j<7; j++){

plainkey += binerplain[i,j]; }

textBox5.Text += (char)Convert.ToInt16(plainkey,2);

} timer.Stop();

(7)

6.

Dekripsi Cipherteks Menggunakan Algoritma ADFGVX Cipher

string[] arrkunci1

= new string[] {"A", "D", "F", "G", "V", "X"}; string[,] arrkunci2

= new string[6,6] {{"F","E","D","C","B","A"}, {"G","H","I","J" ,"K","L"},{"R","Q","P","O","N","M"}, {"S","T","U","V","W","X"} , {"3","2","1","0","Z","Y"}, {"4","5","6","7","8","9"}};

char[] tempkey = textBox5.Text.ToUpper().ToCharArray();

char[] tempkey1 = new char[1000];

string tempplainteks="";

Stopwatch timer = new Stopwatch(); timer.Start();

for (int i=0; i<kolkey; i++){

for (int j=i; j<kolkey; j++){

if (tempkey[i]==kunci[0,j] && Char.GetNumericValue(k unci[1,j]) <= i+1){

for(int k=0; k<barkey; k++){

tempkey1[k] = kunci[k,i]; kunci[k,i] = kunci[k,j]; kunci[k,j] = tempkey1[k]; } break; } } }

for (int i=2; i<barkey; i++){ if (i%2 == 0){

for (int j=0; j<kolkey; j++){

tempplainteks+= kunci[i,j].ToString(); }

} else{

for (int j=kolkey-1; j>=0; j--){

tempplainteks+= kunci[i,j].ToString(); }

} }

char[] tempplainteks1 = tempplainteks.ToCharArray(); int x = 0;

while (x<textBox7.TextLength){

if (char.IsLetter(tempplainteks1[x]) == true && temppl

ainteks1[x] != 'x'){

textBox8.Text +=arrkunci2[Array.IndexOf(arrkunci1, (te mpplainteks1[x]).ToString()), Array.IndexOf(arrkunci1, (temppl ainteks1[x+1].ToString()))];

x+=2; }

(8)

break; } else{ textBox8.Text += tempplainteks1[x].ToString(); x+=1; } } timer.Stop(); textBox10.Text = timer.Elapsed.TotalMilliseconds.ToString();

(9)

Curriculum Vitae

Data Pribadi

Nama

: Jul Ilmi Harahap

Alamat

: Desa Hutaimbaru, Kec. Halongonan, Kab. Padang Lawas

Utara, Prov. Sumatera Utara

Kode Post

: 22753

Nomor Telepon

: 082370044798

Email

: harahapilmi@gmail.com

Jenis Kelamin

: Perempuan

Tanggal Kelahiran

: 28 Oktober 1993

Tempat Kelahiran

: Napa gadung laut

Warga Negara

: Indonesia

Agama

: Islam

Jenjang Pendidikan

Periode

Institusi Pendidikan

2000-2006

Sekolah Dasar Negeri 100670 Hutaimbaru

2006-2009

Madrasah Tsanawiyah Swasta Al-Yunusiah, Hutaimbaru,

2009-2012

Sekolah Menengah Atas Negeri 01 Halongonan

2012 - Selesai

S1 Ilmu Komputer, Universitas Sumatera Utara, Medan

(10)

Programming

HTML, Php

Design

Photoshop, CSS

Microsoft

Word, Excel, PowerPoint

Pendidikan Non Formal

Periode/Tahun

Nama Lembaga/Seminar

2012

Smartfren

“Tren Data Evdo : Kulik Lebih Jauh Lagi Teknologi Rev B”

UKMI Ad-Dakwah Universitas Sumatera Utara

“Mentoring Akbar Universitas”

2013

IMILKOM (Ikatan Mahasiswa Ilmu Komputer)

“What Will You Be 2013”

UKMI Al-Khuwarizmi Fasilkom-Ti Universitas Sumatera Utara

“Peserta Kelas Media interaktif dan Web Development”

2014

Universitas Sumatera Utara

“SENARAI (Seminar Nasional Literasi Informasi) 2014”

IMILKOM (Ikatan Mahasiswa Ilmu Komputer)

“Kewirausahaan & Talk Show 2014”

UKM Fotografi Universitas Sumatera Utara

“Peserta Workshop Dasar VII UKM Fotografi USU”

2015

IMILKOM (Ikatan mahasiswa Ilmu Komputer)

“Public Speaking 2015”

(11)

Pengalaman Organisasi

Pengalaman Kerja

Periode/Tahun

Jabatan

Nama Organisasi

2012-2013

Anggota

Ukmi Al-Khuwarizmi Fasilkom-Ti

Universitas Sumatera Utara

2013-2014

Sekretaris Devisi

Ukmi Al-Khuwarizmi Fasilkom-Ti

Universitas Sumatera Utara

2015-2016

Sekretaris Umum

Unit Kegiatan Mahasiswa (UKM)

Fotografi USU

1. Internship

– Divisi Keuangan

Referensi

Dokumen terkait

[r]

[r]

Suku pertama dan suku kelima suatu barisan aritmetika berturut–turut adalah 2 dan 10, jumlah dua puluh suku pertama barisan tersebut adalah ….. Diketahui

Perhatia n siswa saat mengikuti pembelajaran pada kondisi awal sebesar 55,56% dan setelah mendapat tindakan dengan penggunaan metode CTL dalam pembelajaran pada siklus I

Objek-objek tersebut dapat divisualisasikan dengan berbagai cara, pilihlah unsur- unsur rupa (garis, warna, tekstur, bidang, volume, ruang), sesuai dengan kebutuhan interes

[r]

Adapun tujuan dari penelitian ini adalah untuk mengetahui bagaimana kondisi ketersediaan pangan di Indonesia saat ini dan bagaimana pengaruh kontribusi

penelitian ini bertujuan untuk mengetahui pengaruh terapi puisi sebagai media ekspresi emosi terhadap penurunan tingkat stres pada mahasiswa baru.. Desain penelitian ini