LISTING PROGRAM
1.
Class keygen.cs
using System; using System.Numerics; namespace Program_Skripsi { /// <summary> /// Description of keygen. /// public class keygen { private int prima; public keygen(int p) { this.prima = p; } public static BigInteger bilprima(BigInteger random){ int counter=0; for (int i=2; i
0) return 0; else return random; } public static BigInteger gcd(BigInteger m, BigInteger n){ BigInteger r = m % n; while (r != 0){ return gcd(n,r); } return n; } public static int kunci_eA(int prima){ Random rnd = new Random(); int key_eA = rnd.Next(2, prima-1); if (gcd(key_eA,prima-1) == 1) return key_eA; else return kunci_eA(prima); } public static int kunci_dA(int prima, BigInteger eA){ int key_dA = 1; BigInteger hasil = (key_dA*eA) % (prima-1); while (hasil != 1 && hasil != 0){ key_dA++;
Universitas Sumatera Utara
hasil = (key_dA*eA) % (prima-1); } if (hasil == 0 && key_dA!=eA) return kunci_dA( prima, eA); else return key_dA; } public static BigInteger kunci_eB(int prima){ Random rnd2 = new Random(); BigInteger key_eB = rnd2.Next(2, prima-1); if (gcd(key_eB,prima-1)==1 ) return key_eB; else return kunci_eB(prima); } public static int kunci_dB(int prima, int eA, int dA, BigInte ger eB){ BigInteger hasil; int key_dB=1; if (gcd(eB,prima-1)==1 ){ hasil = (key_dB*eB) % (prima-1); while (hasil != 1 && hasil != 0){ key_dB++; hasil = (key_dB*eB) % (prima-1); } if (hasil == 0 && key_dB!=eA && key_dB!=dA && key_dB!=eB) return kunci_dB(prima, eA, dA, eB); else return key_dB; } else return kunci_dB(prima, eA, dA, eB); } } }
2.
Class MO.cs
using using using using
System; System.Collections.Generic; System.Text; System.Numerics;
namespace Program_Skripsi { /// <summary> /// Description of mo. /// public class MO { private string teks; public MO(string t)
Universitas Sumatera Utara
{ this.teks = t; } public static string enkripsiPlain(string plaintxt, int prima , int eA){ StringBuilder bitsplain = new StringBuilder(); StringBuilder text = new StringBuilder(); BigInteger c1x; BigInteger sum, sum2=1, aaa=0, hasil=0, sumx, sumx2=1; foreach (char c in plaintxt){ bitsplain.Append(c); } BigInteger[] p = new BigInteger[bitsplain.Length]; for (int i=0; i
Universitas Sumatera Utara
BigInteger plain; BigInteger[] c3 = new BigInteger[bitsplain.Length]; StringBuilder sb = new StringBuilder(); BigInteger sum, sum2=1, aaa=0, hasil=0, sumx, sumx2=1; for (int i=0; i
3.
Class erCode.cs
using using using using
System; System.Collections.Generic; System.Text; System.Linq;
namespace Program_Skripsi { /// <summary> /// Description of Class1. /// public class erCode { private string kalimat; public erCode(string s) { this.kalimat = s; } static List sortedChar (string kalimat //charset List list = new List(); int i=0; foreach (char elemen in kalimat) { while (!list.Contains(elemen)){ list.Add(elemen); i++; } } //frequency List frek = new List(); foreach (char elemen in list){ int hitung = 0; foreach (char e in kalimat){ if (e == elemen) hitung +=1; }
Universitas Sumatera Utara
frek.Add(hitung); } //sorting int temp,j; char temp2; for (int n =0; n < frek.Count; n++) { temp = frek[n]; temp2 = list[n]; j = n - 1; while (j >= 0 && frek[j] < temp) { frek[j + 1] = frek[j]; list[j + 1] = list[j]; j--; } frek[j + 1] = temp; list[j + 1] = temp2; } return list; } public static string Code(int n){ StringBuilder kode = new StringBuilder(); if (n<4){ string s = Convert.ToString(n,2); for (int i = 0; i<3-s.Length; i++){ kode.Append("0"); } kode.Append(s); } else { kode.Append("0"); while (n>=4){ string st = Convert.ToString(n,2); kode.Insert(0,st); n = st.Length; } } return kode.ToString(); } public static string kompresi (string kalimat){ List srtChar = sortedChar(kalimat); int m = 0; string bitflag; StringBuilder bitkom = new StringBuilder(); foreach (char c in kalimat){ bitkom.Append(Code(srtChar.IndexOf(c))); } m=0; while (bitkom.Length % 7 !=0){ bitkom.Append("0"); m++;
Universitas Sumatera Utara
} if (m!=0){ bitflag = Convert.ToString(m,2); while (bitflag.Length % 7 !=0){ bitflag = "0"+bitflag; } bitkom.Append(bitflag); } else bitkom.Append("0000000"); string sbitkom = Convert.ToString(bitkom); StringBuilder charkom = new StringBuilder(); int awal = 0; for (int i=7; i<sbitkom.Length+7; i+=7){ int dec = Convert.ToInt32(sbitkom.Substring(awal,7), 2); char chr = (char)dec; charkom.Append(chr); awal = i; } charkom.Append("/*/"); for (int j=0; j<srtChar.Count; j++){ charkom.Append(srtChar[j]); } return charkom.ToString(); } public static string bitkompresi(string strkom){ string charkompresi = strkom.Split(new [] {"/*/"}, StringSplitOptions.None)[0]; //convert char to binary StringBuilder binn = new StringBuilder(); foreach (char c in charkompresi){ string t = Convert.ToString(System.Convert.ToInt32(c),2); if (t.Length<=7){ for (int i = 0; i<7-t.Length; i++){ binn.Append("0"); } binn.Append(t); } else binn.Append(t); } string bin = binn.ToString(); //remove bitflag int bitf = Convert.ToInt32(bin.Substring(bin.Length7),2); if(bitf == 0) bin = bin.Substring(0,bin.Length-7); else bin = bin.Substring(0,bin.Length-(7+bitf));
Universitas Sumatera Utara
return bin; } public static string dekompresi(string strkompresi) string bin = bitkompresi(strkompresi); string karakter = strkompresi.Split(new [] {"/*/"}, StringSplitOptions.None)[1]; //ubah dari binari >> karakter string kode = ""; List<string> kodeER = new List<string>(); for (int y=0; y
Universitas Sumatera Utara
CURRICULUM VITAE
-------------------------------------------------------------------------------------------------------Data Pribadi Nama : Novi Nuryanti Azharia Tempat/Tanggal Lahir : Medan / 08 November 1994 Tinggi/Berat Badan : 153 cm / 67 kg Agama : Islam Kewarganegaraan : Indonesia Alamat Sekarang : Jl. Klambir V No.5 Medan Helvetia Alamat Orang Tua : Perum. Batu Batam Indah Blok. F No. 3 Telp/ Hp : 0812 6333 2910 Email : [email protected] -------------------------------------------------------------------------------------------------------Riwayat Pendidikan [2009 – 2012] : SMA Negeri 4 Batam [2006 – 2009] : SMP Negeri 6 Batam [2000 – 2006] : SD Negeri 007 Batam -------------------------------------------------------------------------------------------------------Keahlian/Kursus Keahlian Komputer : Pemrograman : PHP, C# Database : MysQL Perkantoran : Microsoft Office -------------------------------------------------------------------------------------------------------Pengalaman Organisasi [2009 – 2010] ROHIS SMA Negeri 4 Batam [2012 – 2013] Anggota Kewirausahaan BKM Al-Khuwarizmi 2012 – 2013 -------------------------------------------------------------------------------------------------------Pengalaman Kepanitiaan [2010] Ketua Buka Bersama dan Sahur on the Road BKM Al-Khuwarizmi [2012] Anggota Acara PORSENI IMILKOM 2012 [2012] Anggota Acara PMB IMILKOM 2012 -------------------------------------------------------------------------------------------------------Seminar [2014] Seminar Nasional Literasi Informasi “SENARAI”
Universitas Sumatera Utara