Implementasi Algoritma Kriptografi Hill Cipher dan Kompresi Data Menggunakan Algoritma Levenstein Dalam Pengamanan File Teks

A- 1

LISTING PROGRAM
Form1.cs (Pengirim)
/*
* Created by SharpDevelop.
* User: Lia
* Date: 3/13/2017
* Time: 9:43 PM
*
* To change this template use Tools | Options | Coding | Edit
Standard Headers.
*/
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Drawing.Imaging;
using System.IO;
using System.Text;

using System.Windows.Forms;
namespace TA
{
///
/// Description of Form1.
///
public partial class Pengirim : Form
{
Random r = new Random();
int[,] kunci = new int[3,3];
public Pengirim()
{
//
// The InitializeComponent() call is required for Windows Forms
designer support.
//
InitializeComponent();
//
// TODO: Add constructor code after the InitializeComponent()
call.

//
}
public static String[] lv;
int[] bitt;
double fileLength, panjang_awal;
List ch = new List();
List hs = new List();
List ehs = new List();
int[] fr;
byte[] bytes;
void HomeToolStripMenuItemClick(object sender, EventArgs e)
{
this.Hide();
MainForm home=new MainForm();

Universitas Sumatera Utara

A- 2

home.Show();

}
void RecipientToolStripMenuItemClick(object sender, EventArgs
e)
{
this.Hide();
Penerima terima=new Penerima();
terima.Show();
}
void BantuanToolStripMenuItemClick(object sender, EventArgs e)
{
this.Hide();
Bantuan help=new Bantuan();
help.Show();
}
void Button1Click(object sender, EventArgs e)
{
OpenFileDialog open = new OpenFileDialog();
open.Filter="File Text|*.txt;*.doc;*.rtf;*.docx";
open.FileName="";
if(open.ShowDialog() == DialogResult.OK)

{
string metodee =
open.FileName.Substring(open.FileName.Length-5,5), metode =
open.FileName.Substring(open.FileName.Length-4,4);
if(metode==".doc" || metode==".txt" ||
metode==".rtf"||metodee==".docx")
{
namaFile.Text = open.FileName.ToString();
FileStream fis = new FileStream(open.FileName,
FileMode.Open,FileAccess.ReadWrite);
bytes = new byte[fis.Length];
fis.Read(bytes, 0, (int)fis.Length);
bitt = new int[bytes.Length];
fileLength = new FileInfo(open.FileName).Length *
1.0 ;
panjang_awal= new FileInfo(open.FileName).Length;
textBox1.Text = fileLength.ToString()+" byte";
for(int i=0; i