1. Module tppba.py - Implementasi Kombinasi Beaufort Cipher Dan Affine Cipher Pada Three-Pass Protocol Untuk Pengamanan Data
LISTING PROGRAM
1. Module tppba.py
import random import time z=['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q ','R','S','T','U','V','W','X','Y','Z','0','1','2','3','4','5','6','7' ,'8','9','a','b','c','d','e','f','g','h','i','j','k','l','m','n','o', 'p','q','r','s','t','u','v','w','x','y','z','.',',','!','&','*','#',' ^','(','$','%',')','{','}','[',']','+','-','=','<','>','/',':', ';', '_', '?', '|', '`', '~', '\\', '@',' '] #93 lz = len(z) def Lehmann(p): trial = 10 for i in range (0, trial): BilRand = random.randint(2, p - 1) temp = (p - 1)//2 L = pow(BilRand, temp, p) if ((L != 1) & (L - p != -1)): return False return True def genPrime(x): BilRand = random.randint(pow(10, x - 1), pow(10, x) - 1) p = BilRand // 2 * 2 + 1 while not (Lehmann(p)): BilRand = random.randint(pow(10, x - 1), pow(10, x) - 1) p = BilRand // 2 * 2 + 1 return p def key(k): ky = "" for x in range(len(k)): BilRand_Key = random.randint(10, 99) temp = (z.index(k[x]) + BilRand_Key) % lz ky = ky + z[temp] return ky def EnkBeaufort (Plainteks, kunci): hasil1 = "" for x in range(len(Plainteks)): temp = (z.index(kunci[x]) - z.index(Plainteks[x])) % lz hasil1 = hasil1 + z[temp] return hasil1 def EnkAff(m, b, data): hasil2 = "" for x in range(len(data)): temp = (m * z.index(data[x]) + b) % lz hasil2 = hasil2 + z[temp] return hasil2 def DekBeaufort (data, kunci): hasil3 = "" for x in range(len(data)): temp = (z.index(kunci[x]) - z.index(data[x])) % lz hasil3 = hasil3 + z[temp]
return hasil3 t0 = time.time() def DekAff(m, b, data, data2): hasil4 = "" for x in range(len(data)): temp = (z.index(data[x]) + (m - 1)* z.index(data2[x]) + b) % lz hasil4 = hasil4 + z[temp] return hasil4 def geser(y) : b = random.randint(0, pow(10,y)) return b def karakter(c): kr = len(c) return kr def waktuAlgo(t0,t1): tot_waktu = t1 - t0 return tot_waktu2. Modul pintu.py
import sys sys.path.append("d:\kode\program") def pintu (fungsi): if (fungsi == "BilPrima"): import tppba from tppba import genPrime hasil = genPrime(c) print(hasil, end = '') elif (fungsi == "shiff"): import tppba from tppba import geser hasil1 = geser(c) print(hasil1, end = '') elif (fungsi == "EnkripBeaufort"): import tppba from tppba import EnkBeaufort C1 = EnkBeaufort(d,e) print(C1, end = '') elif (fungsi == "EnkripAffine"): import tppba from tppba import EnkAff C2 = EnkAff(b,c,d) print(C2, end = '') elif (fungsi == "DekripBeaufort"): import tppba from tppba import DekBeaufort C3 = DekBeaufort(d,e) print(C3, end = '') elif (fungsi == "DekripAffine"): import tppba from tppba import DekAff Pl = DekAff(b,c,d,e) print(Pl, end = '') elif (fungsi == "KunciBeau"): import tppba
from tppba import key kunci = key(d) print(kunci, end = '') elif (fungsi == "HtgKarakter"): import tppba from tppba import karakter kar = karakter(d) print(kar, end = '') global a a = str(sys.argv[1]) global b b = int(sys.argv[2]) global c c = int(sys.argv[3]) global d d = str(sys.argv[4]) global e e = str(sys.argv[5]) pintu(a)3. Header pada SharpDevelop
using System; using System.Collections.Generic; using System.Drawing; using System.Windows.Forms; using System.Linq; using System.Text; using System.Diagnostics; using System.IO; using System.Dynamic;
4. Fungsi Membuka Directory File Teks (*.doc)
void Button1Click(object sender, EventArgs e) { OpenFileDialog dialog = new OpenFileDialog(); dialog.Filter = "Document (MsWord)|*.doc"; dialog.Title = "Open file doc : "; dialog.RestoreDirectory = true; if(dialog.ShowDialog() == DialogResult.OK){ string dirName = System.IO.Path.GetDirectoryName(dialog.FileName); string drive = dirName.Split(System.IO.Path.VolumeSeparatorChar)[1]; textBoxCari.Text = dirName + "\\" + dialog.SafeFileName.ToString(); } }
5. Fungsi Membaca Directory File Teks (*.doc)
void ButtonBukaClick(object sender, EventArgs e) { Microsoft.Office.Interop.Word.Application wordApp = new Microsoft.Office.Interop.Word.ApplicationClass(); object filenameO = textBoxCari.Text.ToString(); object objFalse = false; object objTrue = true; object missing = System.Reflection.Missing.Value; object emptyData = string.Empty; try{ Microsoft.Office.Interop.Word.Document aDoc = wordApp.Documents.Open(ref filenameO, ref objFalse, ref objTrue, r
ef missing, ref missing, ref missing, ref missing, ref missing, ref m
issing, ref missing, ref objTrue, ref missing, ref missing, ref missi ng, ref missing); aDoc.ActiveWindow.Selection.WholeStory(); aDoc.ActiveWindow.Selection.Copy();
IDataObject data = System.Windows.Forms.Clipboard.GetDataObject(); String fileText = data.GetData(System.Windows.Forms.DataFormats.Text).ToString(); System.Windows.Forms.Clipboard.SetDataObject(string.E mpty); textBoxBuka.Text = fileText; } catch(Exception err){ MessageBox.Show(err.Message); } finally{ MessageBox.Show("File berhasil dibaca"); } }
6. Fungsi Kunci Beaufort
void Button3Click(object sender, EventArgs e) { string Plainteks1 = textBoxBuka.Text.ToString(); ProcessStartInfo p = new ProcessStartInfo(); p.RedirectStandardOutput = true; p.FileName = "c:\\python31\\python.exe"; p.RedirectStandardOutput = true; p.UseShellExecute = false; p.Arguments = "d:\\kode\\program\\pintu.py " + "KunciBeau 0 0 " + "\"" + Plainteks1 + "\"" + " y"; try { using (Process runProses =Process.Start(p)) { StreamReader s = runProses.StandardOutput; string keluar = s.ReadToEnd(); string k = keluar; textBoxKunciBeau.Text = k.ToString(); } } catch { throw; } }
7. Fungsi Enkripsi Beaufort Cipher
void Button5Click(object sender, EventArgs e) { string Plainteks2 = textBoxBuka.Text.ToString(); string kunciB = textBoxKunciBeau.Text.ToString(); ProcessStartInfo p = new ProcessStartInfo(); p.RedirectStandardOutput = true; p.FileName = "c:\\python31\\python.exe"; p.RedirectStandardOutput = true; p.UseShellExecute = false; p.Arguments = "d:\\kode\\program\\pintu.py " + "EnkripBeaufort 0 0 " + "\"" + Plainteks2 + "\"" + " " + "\"" + kunciB +"\""; try { using (Process runProses = Process.Start(p)) { StreamReader s = runProses.StandardOutput; string keluar = s.ReadToEnd(); string k = keluar; if (k != "") MessageBox.Show("Berhasil", "Info", MessageBo xButtons.OK); textBoxEnkBeau.Text = k.ToString(); } } catch { throw; } }
8. Fungsi Dekripsi Beaufort Cipher
void ButtonDekBeauClick(object sender, EventArgs e) { string Plainteks3 = textBoxEnkAff.Text.ToString(); string kunciBe = textBoxKunciBeau.Text.ToString(); ProcessStartInfo p = new ProcessStartInfo(); p.RedirectStandardOutput = true; p.FileName = "c:\\python31\\python.exe"; p.RedirectStandardOutput = true; p.UseShellExecute = false; p.Arguments = "d:\\kode\\program\\pintu.py " + "DekripBeaufort 0 0 " + "\"" + Plainteks3 + "\"" + " " + "\"" + kunciBe + "\""; try {
using (Process runProses =Process.Start(p)) { StreamReader s = runProses.StandardOutput; string keluar = s.ReadToEnd(); if (keluar != "") MessageBox.Show("Berhasil", "Info", MessageBo xButtons.OK); textBoxDekBeau.Text = keluar.ToString(); } } catch { throw; } }
9. Fungsi Pergesesan Affine Cipher
void ButtonAcakAffClick(object sender, EventArgs e) { int nilai = 3; ProcessStartInfo p = new ProcessStartInfo(); p.RedirectStandardOutput = true; p.FileName = "c:\\python31\\python.exe"; p.RedirectStandardOutput = true; p.UseShellExecute = false; p.Arguments = "d:\\kode\\program\\pintu.py " + "shiff 0 " + nilai + " x" + " y"; try { using (Process runProses =Process.Start(p)) { StreamReader s = runProses.StandardOutput; string keluar = s.ReadToEnd(); string k = keluar; textBoxGeser.Text = k.ToString(); } } catch { throw; } }
10. Fungsi Bilangan Prima Affine Cipher
void ButtonAcakAffbClick(object sender, EventArgs e) { int nilai = 3; ProcessStartInfo p = new ProcessStartInfo(); p.RedirectStandardOutput = true; p.FileName = "c:\\python31\\python.exe"; p.RedirectStandardOutput = true; p.UseShellExecute = false; p.Arguments = "d:\\kode\\program\\pintu.py " + "BilPrima 0 " + nilai + " x" + " y"; try { using (Process runProses =Process.Start(p)) { StreamReader s = runProses.StandardOutput; string keluar = s.ReadToEnd(); string k = keluar; textBoxBilPrima.Text = k.ToString(); } } catch { throw; } }
11. Fungsi Enkripsi Affine Cipher
void ButtonEnkAffClick(object sender, EventArgs e) { string Plainteks4 = textBoxEnkBeau.Text.ToString(); int b1 = Convert.ToInt32(textBoxBilPrima.Text.ToString()); int g1 = Convert.ToInt32(textBoxGeser.Text.ToString()); ProcessStartInfo p = new ProcessStartInfo(); p.RedirectStandardOutput = true; p.FileName = "c:\\python31\\python.exe"; p.RedirectStandardOutput = true; p.UseShellExecute = false; p.Arguments = "d:\\kode\\program\\pintu.py " + "EnkripAffine " + b1 + " " + g1 + " " + "\"" + Plainteks4 + "\"" + " y"; try {
using (Process runProses =Process.Start(p)) { StreamReader s = runProses.StandardOutput; string keluar = s.ReadToEnd(); if (keluar != "") MessageBox.Show("Berhasil", "Info", MessageBo xButtons.OK); textBoxEnkAff.Text = keluar.ToString(); } } catch { throw; } }
12. Fungsi Pergesesan Affine Cipher
void TextBoxEnkBeauTextChanged(object sender, EventArgs e) { } void ButtonDekAffClick(object sender, EventArgs e) { string data2 = textBoxEnkBeau.Text.ToString(); string data1 = textBoxDekBeau.Text.ToString(); int b1 = Convert.ToInt32(textBoxBilPrima.Text); int g1 = Convert.ToInt32(textBoxGeser.Text); ProcessStartInfo p = new ProcessStartInfo(); p.RedirectStandardOutput = true; p.FileName = "c:\\python31\\python.exe"; p.RedirectStandardOutput = true; p.UseShellExecute = false; p.Arguments = "d:\\kode\\program\\pintu.py " + "DekripAffine " + b1 + " " + g1 + " " + "\"" + data1 + "\"" + " " + "\"" + data2 + "\""; try { using (Process runProses =Process.Start(p)) { StreamReader s = runProses.StandardOutput; string keluar = s.ReadToEnd(); string k = keluar; if (k != "") MessageBox.Show("Berhasil", "Info", MessageBo xButtons.OK); textBoxDekAff.Text = k.ToString(); } } catch { throw; } }
13. Fungsi Pergesesan Affine Cipher
void ButtonKarakterClick(object sender, EventArgs e) { string kalimat = textBoxBuka.Text.ToString(); ProcessStartInfo p = new ProcessStartInfo(); p.RedirectStandardOutput = true; p.FileName = "c:\\python31\\python.exe"; p.RedirectStandardOutput = true; p.UseShellExecute = false; p.Arguments = "d:\\kode\\program\\pintu.py " + "HtgKarakter 0 0 " + "\"" + kalimat + "\"" + " y"; try { using (Process runProses =Process.Start(p)) { StreamReader s = runProses.StandardOutput; string keluar = s.ReadToEnd(); string k = keluar; textBoxKarakter.Text = k.ToString(); } } catch { throw; } }
14. Fungsi Reset
void ButtonUlangClick(object sender, EventArgs e) { textBoxCari.Text = ""; textBoxBuka.Text = ""; textBoxKunciBeau.Text = ""; textBoxEnkBeau.Text = ""; textBoxBilPrima.Text = ""; textBoxGeser.Text = ""; textBoxEnkAff.Text = ""; textBoxDekBeau.Text = ""; textBoxDekAff.Text = ""; textBoxKarakter.Text = ""; } } }
Full Name : Azizah Mei Sari Sebayang Sex : Female th
Place, Date of Birth : Medan, May, 5 1993 Nationality : Indonesia Height, Weight : 150cm, 49 kg Health : Perfect Religion : Moslem Address : Jl. Pinus VII No. 6 Perumnas Simalingkar
Kec. Medan Tuntungan
Mobile-phone : 08216082 8964 Email Educational Background 1997 : Kindergarten Siti Hajar, Medan- – 1998
- – North Sumatera 1998 - 2004 : Elementary School at IFDS Siti Hajar, Medan – North Sumatera 2004 - 2007 : Junior High School at IFDS Siti Hajar, Medan – North Sumatera 2007 - 2010 : Vocational High School at Telkom Sandhy Putra Major in Networking, Medan – North Sumatera 2010 - Present : Computing Science, Computing Science and Information Technology Faculty, University of North Sumatera
IT Abilities Bahasa : Bahasa Indonesia, Inggris Bahasa Pemrograman : Python, PHP, C# .NET, C++ Database : MySQL Simulator : Paket Tracert
Language Bahasa : Native Language English : Medium Working and organizational experience 2005 - 2006 : Head of Department of Education OSIS Junior High School
IFDS Siti Hajar 2007 - 2008 : Secretary of Department BKM ROHIS Telkom Shandy Putra 2008 - 2009 : Deputy secretary of OSIS Telkom Shandy Putra 2010 - 2011 : Staff on division PW (Pengembangan Wawasan) BKM Al
Khuwarizmi 2010 - 2011 : Private Teacher on LCC (Lily Course Center)
2011 - 2012 : Staff on division PP (Pemberdaya Perempuan) PEMA FMIPA USU
2011 - 2011 : Laboratory Assistant on Information System IKLC Fasilkom-TI USU
2011 - 2012 : Laboratory Assistant on Computing Science IntroductionIKLC Fasilkom-TI USU 2010
- – 2011 : Staff on division Jurnalism IMLKOM Fasilkom-TI USU 2012
- – 2012 : Secretary of LSO IT (Lembaga Semi Otonom Islamic Teaching) UKMI Al Khuwarizmi Fasilkom-TI USU 2013 – 2014 : General Secretary of IMLKOM Fasilkom-TI USU 2013
- – 2014 : Secretary of PSDM SGC USU 2013
- – Now : Member Of RTIK Sumut (USU)
Achievements
Finalist from Medan “Toyota Eco Youth” Organizers by Toyota and
Government (Environment Minister), Jakarta 2007 CCNA I Certified for Networking Academic from CISCO, 2009 Third winner on Islamic Scientific Papers with tittle "Mekah (Ka’bah) adalah
Golden Ration Point Dunia" Organizers by MTQ and UKMI Ad Dakwah USU, Medan, 2010
Finalist PKM (Program Kreatiffitas Mahasiswa) from USU with tittle “Internet
Sehat untuk Tenaga Pendidik Yayasan Pendidikan Islam Amal Shaleh,
Organizers by DIKTI, 2011 Delegation Student of MTQMN 2013
Mahasiswa Berprestasi I 2013 Jurusan Ilmu Komputer Fasilkom-TI USU
Mahasiswa Berprestasi I 2014 Fasilkom-TI USU
Mahasiswa Berprestasi VI 2014 USU