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 {
/// <summary>
/// Description of Form1. /// </summary>
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<int> ch = new List<int>(); List<int> hs = new List<int>(); List<int> ehs = new List<int>(); int[] fr;
byte[] bytes;
void HomeToolStripMenuItemClick(object sender, EventArgs e) {
this.Hide();
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<bytes.Length; i++)
{
bitt[i] = int.Parse(bytes[i].ToString()); }
}
else
{
MessageBox.Show("File yang anda pilih salah"); }
if (metode==".doc"){ eks.Text=".doc"; }
else if (metode==".rtf"){ eks.Text=".rtf"; }
else if (metode==".txt"){ eks.Text=".txt"; }
} }
bool cek(int x) {
for(int i=0; i<ch.Count; i++) {
if(ch[i] == x)
return false; }
return true; }
void GetCharSet(int[] st){ ch.Clear();
for (int i = 0; i < st.Length; i++){
if(cek(st[i])) ch.Add(st[i]); }
}
void freq(int x) {
for(int i=0; i<ch.Count; i++) {
if(ch[i] == x) fr[i]++;
} }
void CountFreq(int[] st){ fr = new int[ch.Count];
for(int i=0; i<ch.Count;i++) fr[i] = 0;
for(int i=0; i<st.Length; i++) {
freq(st[i]); }
}
void InsertionSort() {
for (int i = 1; i < ch.Count; i++) for (int j = 0; j < i; j++)
if (fr[i] > fr[j]) { int frtemp = fr[i]; fr[i] = fr[j]; fr[j] = frtemp;
int sbtemp = ch[i];
ch[i] = ch[j]; ch[j] = sbtemp;
}
}
String Reverse(String sb){ Console.Write("reverse");
char[] charArray = sb.ToCharArray(); Array.Reverse(charArray);
return new String(charArray); }
String DecToBin(int dec) {
StringBuilder bin = new StringBuilder(); int r = dec % 2;
bin.Insert(0, r); dec = dec / 2; while (dec != 0) { r = dec % 2; bin.Insert(0, r); dec = dec / 2; }
return bin.ToString(); }
int BinToDec(String bin) {
StringBuilder sb = new StringBuilder(Reverse(bin)); int n = 1;
int dec = 0;
for (int i = 0; i < sb.Length; i++) {
dec = dec + (int)(Char.GetNumericValue(sb[i])) * n; n = n * 2;
}
return dec; }
int indeks(int x) {
for(int i=0; i<ch.Count; i++) {
if(ch[i]==x)
return i; }
return 0; }
string Decode(List<int> hss) {
StringBuilder sb = new StringBuilder(); int t = hss.Count;
for (int i = 0; i < t; i++)
{
StringBuilder y = new StringBuilder(DecToBin(hss[i])); if (y.Length < 8)
{
int z = 8 - y.Length % 8; for (int j = 0; j < z; j++) y.Insert(0, "0");
}
sb.Append(y);
}
return sb.ToString(); }
void Button2Click(object sender, EventArgs e) {
lv_proses(bitt); }
void lv_proses(int [] st) {
hs.Clear(); Kodelv(st);
String hasil = stb_lv(st); Encode(hasil);
watch.Stop();
double siz = (hs.Count) * 1.0 ;
size.Text = Math.Round(siz,2).ToString() + " byte"; double CR = (siz/(fileLength * 1.0))*100;
cr.Text = Math.Round(CR,2).ToString()+" %"; double RC = (fileLength/siz);
rc.Text = Math.Round(RC,2).ToString(); double SS = ((fileLength -
siz)*1.0/fileLength)*100;
ss.Text = Math.Round(SS,2).ToString()+" %"; Time.Text =
Math.Round(Convert.ToDecimal(watch.ElapsedMilliseconds)/1000,4).ToStr ing()+" s";
}
void Kodelv(int [] st) {
GetCharSet(st);
CountFreq(st);
InsertionSort();
lv = new string[ch.Count]; lv[0] = "0";
for (int n = 1; n < ch.Count; n++) { int C = 1;
String nbin = DecToBin(n);
String kiri = nbin.Substring(0,1);
String kanan = nbin.Substring(1,nbin.Length-1); int M = kanan.Length;
String Code = kanan; while(M != 0)
{
C++;
nbin = DecToBin(M);
kiri = nbin.Substring(0,1);
kanan = nbin.Substring(1,nbin.Length-1); Code = kanan + Code;
M = kanan.Length; }
Code = "0" + Code; for(int j=0; j<C; j++) Code = "1" + Code; lv[n] = Code;
}
}
string stb_lv(int [] st) {
StringBuilder stb = new StringBuilder();
for(int i=0; i<st.Length; i++) { stb.Append(lv[indeks(st[i])]); }
if (x != 0) { pad = 8 - x;
for (int i = 0; i < pad; i++) stb.Append("0");
}
String d = DecToBin(pad); int y = 8 - d.Length;
for (int i = 0; i < y; i++) stb.Append("0");
stb.Append(d);
return stb.ToString(); }
void Encode(String stb) {
for (int i = 0; i < stb.Length; i+= 8)
{
String x = stb.Substring(i, 8);
int y = BinToDec(x);
hs.Add(y);
}
}
string simpans; byte[] bytes2; int [] hasil;
void Button3Click(object sender, EventArgs e) {
if (eks.Text==".doc"){ hasil= hs.ToArray();
List<byte> bytes = new List<byte>(hasil.GetUpperBound(0) *
sizeof(byte));
foreach (int integer in hasil)
{
bytes.Add(BitConverter.GetBytes(integer)[0]); }
bytes2 = bytes.ToArray();
SaveFileDialog simpan = new SaveFileDialog();
simpan.Filter = "Encrypted and Compressed Files( *.hlvd)|*.hlvd"; simpan.FileName = "*.hlvd";
if (simpan.ShowDialog() == DialogResult.OK) {
File.WriteAllBytes(simpan.FileName, bytes2);
string filenamee=simpan.FileName.Substring(0,simpan.FileName.Length-
3) + "l.dat";
FileStream fstreamm=new FileStream(filenamee,FileMode.OpenOrCreate); StreamWriter sww = new StreamWriter(fstreamm);
SeekOrigin seekoriginn = new SeekOrigin(); sww.BaseStream.Seek(0, seekoriginn);
sww.WriteLine(+ch.Count);
StringBuilder stb = new StringBuilder();
for(int i=0; i<ch.Count; i++) {
stb.Append(ch[i]+"~"); }
sww.WriteLine(stb);
for (int n = 0; n < lv.Length; n++) sww.Write(lv[n]+"~");
sww.Flush(); sww.Close();
simpans=simpan.FileName.ToString();
} }
else if (eks.Text==".docx"){ hasil= hs.ToArray();
List<byte> bytes = new List<byte>(hasil.GetUpperBound(0) *
sizeof(byte));
foreach (int integer in hasil) {
bytes.Add(BitConverter.GetBytes(integer)[0]); }
bytes2 = bytes.ToArray();
SaveFileDialog simpan = new SaveFileDialog();
simpan.Filter = "Encrypted and Compressed Files( *.hlvx)|*.hlvx"; simpan.FileName = "*.hlvx";
if (simpan.ShowDialog() == DialogResult.OK) {
File.WriteAllBytes(simpan.FileName, bytes2);
string filenamee=simpan.FileName.Substring(0,simpan.FileName.Length-
3) + "l.dat";
FileStream fstreamm=new FileStream(filenamee,FileMode.OpenOrCreate); StreamWriter sww = new StreamWriter(fstreamm);
SeekOrigin seekoriginn = new SeekOrigin(); sww.BaseStream.Seek(0, seekoriginn);
sww.WriteLine(+ch.Count);
StringBuilder stb = new StringBuilder();
for(int i=0; i<ch.Count; i++) {
stb.Append(ch[i]+"~"); }
sww.WriteLine(stb);
for (int n = 0; n < lv.Length; n++) sww.Write(lv[n]+"~");
sww.Flush(); sww.Close();
simpans=simpan.FileName.ToString();
MessageBox.Show("Berhasil disimpan, dapat dilihat pada "+simpans); }
}
else if (eks.Text==".rtf"){ hasil= hs.ToArray();
List<byte> bytes = new List<byte>(hasil.GetUpperBound(0)*
sizeof(byte));
foreach (int integer in hasil) {
bytes.Add(BitConverter.GetBytes(integer)[0]); }
bytes2 = bytes.ToArray();
SaveFileDialog simpan = new SaveFileDialog();
simpan.Filter = "Encrypted and Compressed Files( *.hlvr)|*.hlvr"; simpan.FileName = "*.hlvr";
if (simpan.ShowDialog() == DialogResult.OK) {
File.WriteAllBytes(simpan.FileName, bytes2);
string filenamee=simpan.FileName.Substring(0,simpan.FileName.Length-
3) + "l.dat";
FileStream fstreamm=new FileStream(filenamee,FileMode.OpenOrCreate); StreamWriter sww = new StreamWriter(fstreamm);
sww.BaseStream.Seek(0, seekoriginn); sww.WriteLine(+ch.Count);
StringBuilder stb = new StringBuilder();
for(int i=0; i<ch.Count; i++) {
stb.Append(ch[i]+"~"); }
sww.WriteLine(stb);
for (int n = 0; n < lv.Length; n++) sww.Write(lv[n]+"~");
sww.Flush(); sww.Close();
simpans=simpan.FileName.ToString();
MessageBox.Show("Berhasil disimpan, dapat dilihat pada "+simpans); }
else if (eks.Text==".txt"){ hasil= hs.ToArray();
List<byte> bytes = new List<byte>(hasil.GetUpperBound(0) *
sizeof(byte));
foreach (int integer in hasil) {
bytes.Add(BitConverter.GetBytes(integer)[0]); }
bytes2 = bytes.ToArray();
SaveFileDialog simpan = new SaveFileDialog();
simpan.Filter = "Encrypted and Compressed Files( *.hlvt)|*.hlvt"; simpan.FileName = "*.hlvt";
if (simpan.ShowDialog() == DialogResult.OK) {
File.WriteAllBytes(simpan.FileName, bytes2);
string filenamee=simpan.FileName.Substring(0,simpan.FileName.Length-
3) + "l.dat";
FileStream fstreamm=new FileStream(filenamee,FileMode.OpenOrCreate); StreamWriter sww = new StreamWriter(fstreamm);
SeekOrigin seekoriginn = new SeekOrigin(); sww.BaseStream.Seek(0, seekoriginn);
sww.WriteLine(+ch.Count);
StringBuilder stb = new StringBuilder();
for(int i=0; i<ch.Count; i++) {stb.Append(ch[i]+"~");
}
sww.WriteLine(stb);
for (int n = 0; n < lv.Length; n++) sww.Write(lv[n]+"~");
sww.Flush(); sww.Close();
simpans=simpan.FileName.ToString();
MessageBox.Show("Berhasil disimpan, dapat dilihat pada "+simpans); }
} }
void Button6Click(object sender, EventArgs e) {
SaveFileDialog simpan = new SaveFileDialog(); simpan.Filter = "key files( *.key)|*.key"; simpan.FileName = "*.key";
if (simpan.ShowDialog() == DialogResult.OK) {
FileStream(simpan.FileName,FileMode.OpenOrCreate); StreamWriter sw = new StreamWriter(fstream);
SeekOrigin seekorigin = new SeekOrigin(); sw.BaseStream.Seek(0, seekorigin);
for(int i=0; i<3; i++) {
for (int j = 0; j < 3; j++) {
sw.WriteLine(kunci[i,j]); }
}
sw.Flush(); sw.Close(); }
}
void Button4Click(object sender, EventArgs e) {
textBox2.Text = null; int d = 0;
int x = 0;
while ( d <= 0 || x == 10000) {
x =0;
for(int i = 0; i < 3; i++) {
for(int j = 0; j < 3; j++)
{
kunci[i,j] = r.Next(1,10);
}
} d =
((kunci[0,0]*kunci[1,1]*kunci[2,2])+(kunci[0,1]*kunci[1,2]*kunci[2,0] )+(kunci[0,2]*kunci[1,0]*kunci[2,1
]))-((kunci[2,0]*kunci[1,1]*kunci[0,2])+(kunci[2,1]*kunci[1,2]*kunci[0,0] )+(kunci[2,2]*kunci[1,0]*kunci[0,1]));
for (int i = 0; i <= 10000; i++) {
x = i;
if((x * d) % 256 == 1)
break; }
}
for(int i = 0; i < 3; i++) {
for(int j = 0; j < 3; j++)
{
textBox2.Text += kunci[i,j].ToString() + "\t";
}
textBox2.Text += "\n"; }
}
void Button5Click(object sender, EventArgs e) {
Stopwatch waktu = new Stopwatch(); waktu.Start();
while (hs.Count % 3 != 0) {
}
int[] tempenc = new int[3]; for(int i = 0; i < hs.Count; i=i+3) {
for(int j = 0; j < 3; j++)
{
for (int k = 0; k < 3; k++)
{
tempenc[j] += kunci[j,k] * hs[i+k];
}
}
for(int j = 0; j < 3; j++)
{
hs[i+j] = tempenc[j] % 256; }
tempenc = new int[3]; }
waktu.Stop();
MessageBox.Show("berhasil dienkrip"); textBox3.Text =
Math.Round(Convert.ToDecimal(waktu.ElapsedMilliseconds)/1000,4).ToStr ing()+" s";
double siz = (hs.Count) * 1.0;
textBox4.Text = Math.Round(siz,2).ToString() + " byte"; }
} }
Form2.cs (Penerima)
/*
* Created by SharpDevelop. * User: Lia
* Date: 3/13/2017 * Time: 10:13 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;
using Microsoft.Office.Interop.Word;
namespace TA {
/// <summary>
/// Description of Form2. /// </summary>
public partial class Penerima : Form {
int[,] kunciinvers = new int[3,3]; int[,] adjoint = new int[3,3]; int det;
public Penerima() {
//
// The InitializeComponent() call is required for Windows Forms designer support.
//
InitializeComponent();
//
// TODO: Add constructor code after the InitializeComponent() call.
// }
void HomeToolStripMenuItemClick(object sender, EventArgs e)
{
this.Hide();
MainForm home=new MainForm(); home.Show();
}
void SenderToolStripMenuItemClick(object sender, EventArgs e)
{
this.Hide();
Pengirim kirim=new Pengirim(); kirim.Show();
}
void BantuanToolStripMenuItemClick(object sender, EventArgs e)
{
this.Hide();
Bantuan help=new Bantuan(); help.Show();
}
List<int> ch = new List<int>(); List<int> hs = new List<int>(); List<int> pic = new List<int>();
public String[] lv; string eks=""; int[] bitt; byte[] bytes;
void Button1Click(object sender, EventArgs e) {
OpenFileDialog open = new OpenFileDialog(); open.Filter = "Enkripsi dan kompres
file|*.hlvr;*.hlvd;*.hlvt;*.hlvx"; open.FileName="";
if (open.ShowDialog() == DialogResult.OK) {
string metode = open.FileName.Substring(open.FileName.Length-5,5);
if(metode==".hlvd" || metode==".hlvr" || metode==".hlvt"|| metode==".hlvx")
{
hs.Clear(); pic.Clear();
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];
for(int i=0; i<bytes.Length; i++) { bitt[i] = int.Parse(bytes[i].ToString());
}
for (int i = 0; i < bitt.Length; i++){
hs.Add(bitt[i]);
}
string namaa = open.FileName.Substring(0, open.FileName.Length- 3) + "l.dat";
FileStream fstreamm = new FileStream(namaa, FileMode.Open,FileAccess.ReadWrite);
StreamReader sreaderr = new StreamReader(fstreamm); sreaderr.BaseStream.Seek(0, SeekOrigin.Begin); string keterangan = sreaderr.ReadLine();
string[] info = new string[3]; int n = int.Parse(keterangan); keterangan = sreaderr.ReadLine(); info = new string[n];
info = keterangan.Split('~');
for(int i = 0;i<n;i++)
ch.Add(int.Parse(info[i])); keterangan = sreaderr.ReadLine(); info = new string[n];
lv = new string[n];
info = keterangan.Split('~');
for(int i = 0;i<n;i++) lv[i] = info[i]; sreaderr.Close(); }
else
{
MessageBox.Show("File yang anda pilih salah"); }
if (metode==".hlvd"){ eks=".doc"; ext.Text=eks;
}
else if (metode==".hlvr"){ eks=".rtf";ext.Text=eks; }
else if (metode==".hlvx"){ eks=".docx";ext.Text=eks; }
else if(metode==".hlvt"){ eks=".txt";ext.Text=eks; }
} }
string Decode()
{
int t = hs.Count;
for (int i = 0; i < t; i++)
{
StringBuilder y = new StringBuilder(DecToBin(hs[i])); if (y.Length < 8)
{
int z = 8 - y.Length % 8; for (int j = 0; j < z; j++) y.Insert(0, "0");
}
sb.Append(y);
}
return sb.ToString();
}
void Decompress(String stb)
{
StringBuilder bit = new StringBuilder(); StringBuilder stb2;
int t = stb.Length;
int pad = BinToDec(stb.Substring(t - 8, 8));
stb2 = new StringBuilder(stb.Substring(0, t - pad - 8)); for (int i = 0; i < stb2.Length; i++)
{
bit.Append(stb2[i]);
List<string> list = new List<string>(lv); if (list.Contains(bit.ToString()))
{
int x = list.IndexOf(bit.ToString()); pic.Add(ch[x]);
bit = new StringBuilder(); }
}
}
string DecToBin(int dec)
{
StringBuilder bin = new StringBuilder(); int r = dec % 2;
bin.Insert(0, r); dec = dec / 2; while (dec != 0)
{
r = dec % 2;
bin.Insert(0, r); dec = dec / 2;
}
return bin.ToString();
}
string Reverse(String sb)
{
char[] charArray = sb.ToCharArray();
Array.Reverse(charArray); return new String(charArray);
}
{
StringBuilder sb = new StringBuilder(Reverse(bin)); int n = 1;
int dec = 0;
for (int i = 0; i < sb.Length; i++)
{
dec = dec + (int)(Char.GetNumericValue(sb[i])) * n;
n = n * 2;
}
return dec;
}
double siz=0;
void Button2Click(object sender, EventArgs e) {
siz=0;
Stopwatch waktu = new Stopwatch(); waktu.Start();
String dc = Decode(); Decompress(dc);
waktu.Stop();
siz = (pic.Count) * 1.0 ;
textBox4.Text = Math.Round(siz,2).ToString() + " byte";
textBox1.Text =
Math.Round(Convert.ToDecimal(waktu.ElapsedMilliseconds)/1000,4).ToStr ing()+" s";
MessageBox.Show("File berhasil didekompresi"); }
byte[] bytes2; int [] hasil; string simpan;
void Button3Click(object sender, EventArgs e) {
if (eks==".doc"){
hasil= pic.ToArray(); List<byte> bytes = new
List<byte>(hasil.GetUpperBound(0) * sizeof(byte));
foreach (int integer in hasil) {
bytes.Add(BitConverter.GetBytes(integer)[0]); }
bytes2 = bytes.ToArray();
SaveFileDialog save = new SaveFileDialog(); save.Filter = "Simpan|*.doc";
save.FileName = "*.doc";
if(save.ShowDialog() == DialogResult.OK) {
File.WriteAllBytes(save.FileName, bytes2); simpan=save.FileName.ToString();
MessageBox.Show("Berhasil disimpan, dapat dilihat pada "+simpan);
}
else if (eks==".rtf"){ hasil= pic.ToArray(); List<byte> bytes = new
List<byte>(hasil.GetUpperBound(0) * sizeof(byte));
foreach (int integer in hasil) {
bytes.Add(BitConverter.GetBytes(integer)[0]); }
bytes2 = bytes.ToArray();
SaveFileDialog save = new SaveFileDialog(); save.Filter = "Simpan|*.rtf";
save.FileName = "*.rtf";
if(save.ShowDialog() == DialogResult.OK) {
File.WriteAllBytes(save.FileName, bytes2); simpan=save.FileName.ToString();
MessageBox.Show("Berhasil disimpan, dapat dilihat pada "+simpan);
} }
else if (eks==".docx"){ hasil= pic.ToArray();
List<byte> bytes = new List<byte>(hasil.GetUpperBound(0) *
sizeof(byte));
foreach (int integer in hasil) {
bytes.Add(BitConverter.GetBytes(integer)[0]); }
bytes2 = bytes.ToArray();
SaveFileDialog save = new SaveFileDialog(); save.Filter = "Simpan|*.docx";
save.FileName = "*.docx";
if(save.ShowDialog() == DialogResult.OK) {
File.WriteAllBytes(save.FileName, bytes2); }
simpan=save.FileName.ToString();
MessageBox.Show("Berhasil disimpan, dapat dilihat pada "+simpan);
}
else if (eks==".txt"){ hasil= pic.ToArray(); List<byte> bytes = new
List<byte>(hasil.GetUpperBound(0) * sizeof(byte));
foreach (int integer in hasil) {
bytes.Add(BitConverter.GetBytes(integer)[0]); }
SaveFileDialog save = new SaveFileDialog(); save.Filter = "Simpan|*.txt";
save.FileName = "*.txt";
if(save.ShowDialog() == DialogResult.OK) {
File.WriteAllBytes(save.FileName, bytes2); simpan=save.FileName.ToString();
MessageBox.Show("Berhasil disimpan, dapat dilihat pada "+simpan);
} } }
void Button4Click(object sender, EventArgs e) {
OpenFileDialog open = new OpenFileDialog(); open.Filter = "key files( *.key)|*.key"; open.FileName="*.key";
if (open.ShowDialog() == DialogResult.OK) {
textBox2.Text="";
string nama = open.FileName.Substring(0, open.FileName.Length); kunci = new int[3,3];
int k =0; string[] lines = File.ReadAllLines(nama);
int linecount = File.ReadAllLines(nama).Length;
for(int i = 0; i < 3; i++) {
for(int j = 0; j < 3; j++)
{
kunci[i,j] = int.Parse(lines[k]);
k++;
} }
for(int i = 0; i < 3; i++) {
for(int j = 0; j < 3; j++)
{
textBox2.Text += kunci[i,j].ToString() + "\t";
}
textBox2.Text += "\n";
}
} }
void Button5Click(object sender, EventArgs e) {
Stopwatch waktu = new Stopwatch(); waktu.Start();
int i, j, k;
det =
((kunci[0,0]*kunci[1,1]*kunci[2,2])+(kunci[0,1]*kunci[1,2]*kunci[2,0] )+(kunci[0,2]*kunci[1,0]*kunci[2,1
]))-((kunci[2,0]*kunci[1,1]*kunci[0,2])+(kunci[2,1]*kunci[1,2]*kunci[0,0] )+(kunci[2,2]*kunci[1,0]*kunci[0,1]));
adjoint[0,0] = (kunci[1,1]*kunci[2,2 ])-(kunci[1,2]*kunci[2,1]);
adjoint[0,2] = (kunci[0,1]*kunci[1,2 ])-(kunci[1,1]*kunci[0,2]);
adjoint[1,0] = -((kunci[1,0]*kunci[2,2 ])-(kunci[2,0]*kunci[1,2]));
adjoint[1,1] = (kunci[0,0]*kunci[2,2 ])-(kunci[2,0]*kunci[0,2]);
adjoint[1,2] = -((kunci[0,0]*kunci[1,2 ])-(kunci[1,0]*kunci[0,2]));
adjoint[2,0] = (kunci[1,0]*kunci[2,1 ])-(kunci[2,0]*kunci[1,1]);
adjoint[2,1] = -((kunci[0,0]*kunci[2,1 ])-(kunci[2,0]*kunci[0,1]));
adjoint[2,2] = (kunci[0,0]*kunci[1,1 ])-(kunci[1,0]*kunci[0,1]);
int x = 0;
while ((x * det) % 256 != 1) {
x++;
}
for(i = 0; i < 3; i++) {
for(j = 0; j < 3; j++)
{
kunciinvers[i,j] = ((x*adjoint[i,j]) % 256 + 256) %256; }
}
int[] tempenc = new int[3]; for(i = 0; i < hs.Count; i=i+3) {
for(j = 0; j < 3; j++)
{
for (k = 0; k < 3; k++)
{
tempenc[j] += kunciinvers[j,k] * hs[i+k];
}
}
for(j = 0; j < 3; j++)
{
hs[i+j] = (tempenc[j]%256+256) % 256; }
tempenc = new int[3]; }
while (hs[hs.Count-1] == 32) {
hs.RemoveAt(hs.Count-1); }
waktu.Stop();
MessageBox.Show("Berhasil didekripsi"); textBox3.Text =
Math.Round(Convert.ToDecimal(waktu.ElapsedMilliseconds)/1000,4).ToStr ing()+" s";
double siz = (hs.Count) * 1.0 ;
textBox5.Text = Math.Round(siz,2).ToString() + " byte"; }
var applicationWord = new
Microsoft.Office.Interop.Word.Application();
Microsoft.Office.Interop.Word.Application word = null; word = new Microsoft.Office.Interop.Word.Application();
object inputFile = simpan;
object confirmConversions = false; object readOnly = true;
object visible = true;
object missing = Type.Missing;
// Open the document...
Microsoft.Office.Interop.Word.Document doc = null; doc = word.Documents.Open(
ref inputFile, ref confirmConversions, ref readOnly, ref missing,
ref missing, ref missing, ref missing, ref missing,
ref missing, ref missing, ref missing, ref visible,
ref missing, ref missing, ref missing, ref missing); word.Visible = true;
doc.Activate(); // Console.ReadKey();
} }
D
AFTAR
R
IWAYAT
H
IDUP
C
URRICULUMV
ITAEI. DATA PRIBADI /Personal Identification
Nama Lengkap : Windi Saputri Simamora Tempat/
Tgl. Lahir
: Medan / 05 Mei 1995
Jenis Kelamin : Perempuan
Agama : Islam
Kebangsaan : Indonesia
Alamat : Jl. Jati II No.65 Medan
Telepon Email
: :
085372066122
IPK : 3.61
II. KEMAMPUAN / Capabilities
Bahasa : Bahasa Indonesia
Bahasa Pemrograman : C#, C++,PHP
Database : MySQL
Lainnya : HTML, Ms. Office, Adobe Photoshop, Adobe Flash
III. PENDIDIKAN FORMAL / Formal Education
[ 2013
–
2017 ]
S1 Ilmu Komputer, Fakultas Ilmu Komputer dan Teknologi Informasi Universitas Sumatera Utara
[ 2010
–
2013 ]
SMA Negeri 5 Medan
[ 2007
–
2010 ]
SMP Negeri 6 Medan
[ 2001
–
2007 ]
SD Negeri 060822 Medan IV. PENDIDIKAN NON-FORMAL / Informal Education
[ 2012
–
2013 ]
Kursus Bahasa Inggris di Gemilang Education Center MedanV. PELATIHAN DAN SEMINAR / Trainings & Workshop
1) Peserta Seminar Nasional “Melalui Inovasi Teknologi untuk Menciptakan Mahasiswa
Kreatif dan Mandiri”, Universitas Sumatera Utara [2017]
2) Peserta Seminar Nasional Literasi Informasi (SENARAI) Fasilkom-TI Universitas Sumatera Utara [2014]
3) Peserta TRICK (Training Islam Ceria dan Kreatif), UKMI Al-Khuwarizmi, Universitas Sumatera Utara [2013]
4) Peserta Seminar “What Will You Be?” IMILKOM, Universitas Sumatera Utara [2013]
XIII. LAINNYA / Others -