Implementasi Algoritma Zig-Zag Cipher Dan Algoritma Rc4+ Cipher Dalam Skema Super Enkripsi Untuk Pengamanan Teks

LISTING PROGRAM

a. Fungsi Cari File Enkripsi
privatevoid btn_cari_Click(object sender, EventArgs e)
{
OpenFileDialog dialog = newOpenFileDialog();
dialog.Filter = "Document (MsWord)|*.doc| PDF|*.pdf";
dialog.Title = "Open File : ";
dialog.RestoreDirectory = true;
if (dialog.ShowDialog() == DialogResult.OK)
{
tipe = dialog.FileName.Substring(dialog.FileName.Length 3,3);
if (tipe == "doc")
{
tb_loc.Text = dialog.FileName;
tb_cari.Text =
System.IO.Path.GetFileName(dialog.FileName);
}
elseif (tipe == "pdf")
{
baca = newPdfReader(dialog.FileName);

tb_loc.Text = dialog.FileName;
tb_cari.Text =
System.IO.Path.GetFileName(dialog.FileName);
}
}
}

b. Fungsi Buka File Enkripsi
privatevoid btn_buka_Click(object sender, EventArgs e)
{
if (tipe == "doc")
{
Microsoft.Office.Interop.Word.Application wordApp = new
Microsoft.Office.Interop.Word.ApplicationClass();
object filenameO = tb_loc.Text.ToString();
object objFalse = false;
object objTrue = true;
object missing = System.Reflection.Missing.Value;
object emptyData = string.Empty;
Microsoft.Office.Interop.Word.Document aDoc =

wordApp.Documents.Open(ref filenameO, ref objFalse, ref objTrue, ref
missing, ref missing, ref missing, ref missing, ref missing, ref missing,
ref missing, ref objTrue, ref missing, ref missing, ref missing, ref
missing);
aDoc.ActiveWindow.Selection.WholeStory();
aDoc.ActiveWindow.Selection.Copy();

Universitas Sumatera Utara

IDataObject data = System.Windows.Forms.Clipboard.GetDataObject();
String fileText =
data.GetData(System.Windows.Forms.DataFormats.Text).ToString();
System.Windows.Forms.Clipboard.SetDataObject(string.Empty);
tb_preview.Text = fileText;
}
else
{
int intPageNum = baca.NumberOfPages;
string[] words;
string line, text;

string temp = "";
for (int i = 1; i n * n)
{
temp = plain.Substring(0, n * n);
plain = plain.Substring((n * n), plain.Length - (n * n));
}
else
{
temp = plain;
plain = "";
}
int k = 0;
for (int i = 0; i < n; i++)

Universitas Sumatera Utara

{
for (int j = 0; j < n; j++)
{
if (k >= temp.Length)

{
arr[i, j] = ((char)rnd.Next(65,
90)).ToString();
}
else
{
arr[i, j] = temp[k].ToString();
}
k++;
}
}
//baris
if (rad_enk_baris.Checked == true)
{
for (int i = 0; i < M.Length; i++)
{
for (int j = 0; j < n; j++)
{
if (j % 2 == 0)
{

cipher += arr[M[i] - 1, j];
}
else
{
if (M[i] >= n)
cipher += arr[0, j];
else
cipher += arr[M[i], j];
}
}
}
}
//kolom
elseif (rad_enk_kolom.Checked == true)
{
for (int i = 0; i < M.Length; i++)
{
for (int j = 0; j < n; j++)
{
if (j % 2 == 0)

{
cipher1 += arr[j, M[i] - 1];
}
else
{
if (M[i] >= n)
cipher1 += arr[j, 0];
else
cipher1 += arr[j, M[i]];
}
}
}
}
}

Universitas Sumatera Utara

tb_enkzig.Text = cipher + cipher1;
p.Stop();
timezig = (int.Parse(p.Elapsed.ToString("fffffff")) /

10000f).ToString();
}

f. Fungsi Acak Kunci RC4+ Cipher
string timezig;
char[] kar = {' ', '!', '\"', '#', '$', '%', '&', '\'', '(', ')','*','+',',','','.','/','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','[','\\',']','^','_','`','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','{','
|','}','~','Ɗ'};
privatevoid btn_acakrc4_Click(object sender, EventArgs e)
{
Random rnd = newRandom();
string kunci2 = "";
int r, n;
n = rnd.Next(tb_enkzig.Text.Length);
for (int i = 0; i < n; i++)
{
r = rnd.Next(0, kar.Length);
kunci2 += kar[r];

}
tb_enk_acakrc4p.Text = kunci2;
}

g. Fungsi Key Scheduling Algorithm (KSA)
privateint[] S = null;
publicvoid KSA(string key)
{
S = newint[256];
int pjgKey = key.Length;
if (pjgKey < 1)
MessageBox.Show("Kunci tidak boleh kosong");
for (int i = 0; i
3)) % 256]) % 256;
z = ((S[(a + b) % 256] + S[(c ^ 170) % 256]) ^ S[(j + b) %
256]) % 256;
cipher += t.getChar((t.getDesimal(plain[k]) ^ z) % 256);
}
tb_enkrc4p.Text = cipher;
q.Stop();

string timerc4p = (int.Parse(q.Elapsed.ToString("fffffff")) /
10000f).ToString();
tb_ratarata.Text = ((double.Parse(timezig) +
double.Parse(timerc4p)) / 2).ToString() + " ms";
}

i. Fungsi Simpan Enkripsi
privatevoid btn_simpan_enk_Click_1(object sender, EventArgs e)
{
SaveFileDialog simpan = newSaveFileDialog();
simpan.Filter = "Super Enkripsi(*.inda)|*.inda";
simpan.FileName = "*.inda";
if (simpan.ShowDialog() == DialogResult.OK)
{
FileStream fstream = newFileStream(simpan.FileName, FileMode.OpenOrCreate);
StreamWriter sw = newStreamWriter(fstream);
SeekOrigin seekorigin = newSeekOrigin();
sw.BaseStream.Seek(0, seekorigin);
sw.WriteLine(tb_enkrc4p.Text);
sw.Flush();

sw.Close();
string filenamee = simpan.FileName.Substring(0, simpan.FileName.Length - 5)
+ "a.dat";
FileStream fstreamm = newFileStream(filenamee, FileMode.OpenOrCreate);
StreamWriter sww = newStreamWriter(fstreamm);
SeekOrigin seekoriginn = newSeekOrigin();
sww.BaseStream.Seek(0, seekoriginn);
sww.WriteLine(tb_enk_acakzig.Text);

Universitas Sumatera Utara

sww.WriteLine(tb_enk_acakrc4p.Text);
sww.WriteLine(tb_preview.Text.Length.ToString());
sww.WriteLine(rad_enk_baris.Checked);
sww.Flush();
sww.Close();
}
}

j. Fungsi Cari File Dekripsi

string pilihan;
privatevoid btn_cari_dek_Click(object sender, EventArgs e)
{
OpenFileDialog open = newOpenFileDialog();
open.Filter = "Super Enkripsi File(*.inda)|*.inda";
if (open.ShowDialog() == DialogResult.OK)
{
tb_cari1.Text = open.FileName;
tb_loc1.Text = open.FileName;
string namaa = open.FileName.Substring(0, open.FileName.Length - 5) +
"a.dat";
FileStream fstreamm = newFileStream(namaa, FileMode.Open,
FileAccess.ReadWrite);
StreamReader sreaderr = newStreamReader(fstreamm);
sreaderr.BaseStream.Seek(0, SeekOrigin.Begin);
kuncizig = sreaderr.ReadLine();
kunciplus = sreaderr.ReadLine();
len = int.Parse(sreaderr.ReadLine());
pilihan = sreaderr.ReadLine();
sreaderr.Close();
string nama = open.FileName.Substring(0, open.FileName.Length);
FileStream fstream = newFileStream(nama, FileMode.Open,
FileAccess.ReadWrite);
StreamReader sreader = newStreamReader(fstream);
sreader.BaseStream.Seek(0, SeekOrigin.Begin);
hasilenk = sreader.ReadLine();
sreader.Close();
}
}

k. Fungsi Buka File Dekripsi
privatevoid btn_buka_dek_Click(object sender, EventArgs e)
{
tb_preview1.Text = hasilenk;
tb_dek_acakzig.Text = kuncizig;
tb_dek_acakrc4p.Text = kunciplus;
if (pilihan == "True")
{
rad_dek_baris.Checked = true;
}
else
{
rad_dek_kolom.Checked = true;
}
}

Universitas Sumatera Utara

l. Fungsi Dekripsi Algoritma Zig-zag Cipher
string hasilenk, kuncizig, kunciplus;
int len;
privatevoid btn_dekzig_Click(object sender, EventArgs e)
{
string[] temp2;
if (flag == false)
{
temp2 = kuncizig.Split(' ');
M = newint[temp2.Length];
for (int i = 0; i < temp2.Length; i++)
{
M[i] = int.Parse(temp2[i]);
}
n = M.Length;
}
string temp, plain = "", cipher = tb_dekrc4p.Text;
string[,] arr;
while (cipher != "")
{
arr = newstring[n, n];
if (cipher.Length > n * n)
{
temp = cipher.Substring(0, n * n);
cipher = cipher.Substring(n * n, cipher.Length - (n *
n));
}
else
{
temp = cipher;
cipher = "";
}
//baris
string temp1;
if (rad_dek_baris.Checked == true)
{
for (int i = 0; i < M.Length; i++)
{
temp1 = temp.Substring(0, n);
temp = temp.Substring(n, temp.Length - n);
for (int j = 0; j < n; j++)
{
if (j % 2 == 0)
{
arr[M[i] - 1, j] = temp1[j].ToString();
}
else
{
if (M[i] >= n)
arr[0, j] = temp1[j].ToString();
else
arr[M[i], j] = temp1[j].ToString();
}
}
}

Universitas Sumatera Utara

for (int i = 0; i < n; i++)
{
for (int j = 0; j < n; j++)
{
plain += arr[i, j];
}
}
}
//kolom
elseif (rad_dek_kolom.Checked == true)
{
for (int i = 0; i < M.Length; i++)
{
temp1 = temp.Substring(0, n);
temp = temp.Substring(n, temp.Length - n);
for (int j = 0; j < n; j++)
{
if (j % 2 == 0)
{
arr[j, M[i] - 1] = temp1[j].ToString();
}
else
{
if (M[i] >= n)
arr[j, 0] = temp1[j].ToString();
else
arr[j, M[i]] = temp1[j].ToString();
}
}
}
for (int i = 0; i < n; i++)
{
for (int j = 0; j < n; j++)
{
plain += arr[i, j];
}
}
}
}
tb_dekzig.Text = plain.Substring(0, len);
}

m. Fungsi Dekripsi Algoritma RC4+ Cipher
privatevoid btn_dek_rc4p_Click(object sender, EventArgs e)
{
string plain = "", cipher = tb_preview1.Text;
KSA(tb_dek_acakrc4p.Text);
int i = 0, j = 0, a, c, z;
Tabel t = newTabel();
for (int k = 0; k < cipher.Length; k++)
{
i = (i + 1) % 256;
a = S[i];

Universitas Sumatera Utara

j = (j + a) % 256;
int b = S[j];
S[i] = b;
S[j] = a;
c = (S[((i > 3)) % 256] + S[((j >
3)) % 256]) % 256;
z = ((S[(a + b) % 256] + S[(c ^ 170) % 256]) ^ S[(j + b) %
256]) % 256;
plain += t.getChar((t.getDesimal(cipher[k]) ^ z) % 256);
}
string plain1;
plain1 = plain.Replace("Ā", "" + System.Environment.NewLine);
tb_dekrc4p.Text = plain1;
}

n. Fungsi Simpan Dekripsi
privatevoid btn_simpan_dek_Click(object sender, EventArgs e)
{
SaveFileDialog simpan = newSaveFileDialog();
simpan.Filter = "Document (MsWord)|*.doc";
simpan.FileName = "*.doc";
if (simpan.ShowDialog() == DialogResult.OK)
{
File.WriteAllText(simpan.FileName, tb_dekzig.Text.ToString());
}
}
}

Universitas Sumatera Utara

CURRICULUM VITAE
DATA DIRI
Nama Lengkap
: Noer Inda Chayanie
Nama Panggilan
: Inda
Tempat/Tanggal Lahir
: Medan/23 Mei 1995
Jenis Kelamin
: Perempuan
Agama
: Islam
Kebangsaan
: Indonesia
Alamat
: Jl. Beringin Komplek Wartawan No. 4A
Medan Timur, Sumatera Utara
Nomor HP
: +6282366003327
E-mail
: noerinda@hotmail.com

RIWAYAT PENDIDIKAN
S1 Ilmu Komputer
Universitas Sumatera Utara, Medan
131401122
Sekolah Menengah Atas
SMAN 3 MEDAN
2010-2013
Sekolah Menengah Pertama
SMP SWASTA PERTIWI MEDAN
2007-2010
Sekolah Dasar
SD SWASTA PERTIWI MEDAN
2001-2007

Universitas Sumatera Utara

SEMINAR/KURSUS/WORKSHOP
No.
1
2
3
4
5
6
7

Nama Seminar/Kursus/Workshop
GIT Repository
Global Inspiring Seminar of Indonesia Next Program 2016
Seminar Nasional Literasi Indormasi (SENARAI)
Seminar What Will You Be
Pelatihan Dasar Organisasi IMILKOM
Bimbingan Belajar Nurul Fikri
Kursus Musik Medan Musik

Tahun
2017
2016
2014
2013
2014
2013
2005

KEAHLIAN
Bahasa Pemrograman
DMBS
Software
Lainnya

: C++, Java for Mobile, C#, HTML
: MySQL
:Office Application
:Musik

PENGALAMAN ORGANISASI
No

Organisasi

1

IMILKOM USU

2

IMILKOM USU

3

Porseni IMILKOM 2015
Ilmu Komputer Goes To School
2014
Palang Merah Remaja

4
5

Posisi
Kepala Biro Administrasi dan
Kesekretariatan
Anggota Komunikasi dan
Informasi
Anggota Humas

Tahun
2016-sekarang
2015-2016
2015

Sekretaris

2014

Anggota

2010-2013

Universitas Sumatera Utara