LISTING PROGRAM
1. FORM MAIN MENU
Created by SharpDevelop. User: Excited
Date: 2162016 Time: 7:11 PM
To change this template use Tools | Options | Coding | Edit Standard Headers.
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Windows.Forms;
namespace enkrip
{
summary
Description of MainForm.
summary public
partial class
MainForm : Form {
public MainForm
{ The InitializeComponent call is required for Windows Forms designer
support.
InitializeComponent ;
TODO : Add constructor code after the InitializeComponent call.
} void
Button3Click object
sender, EventArgs e {
Universitas Sumatera Utara
} void
Button1Click object
sender, EventArgs e {
}
void ExitToolStripMenuItemClick
object sender, EventArgs e
{ Application.
Exit ;
} void
EnkripToolStripMenuItemClick object
sender, EventArgs e {
enkrip pindah =
new enkrip
;
this. Hide
; pindah.
ShowDialog ;
} void
DekripToolStripMenuItemClick object
sender, EventArgs e {
dekrip pindah =
new dekrip
;
this. Hide
; pindah.
ShowDialog ;
} void
AboutToolStripMenuItemClick object
sender, EventArgs e {
about pindah =
new about
;
this. Hide
; pindah.
ShowDialog ;
} void
HomeToolStripMenuItemClick object
sender, EventArgs e {
MainForm pindah =
new MainForm
;
this. Hide
; pindah.
ShowDialog ;
}
Universitas Sumatera Utara
} }
2. FORM ENKRIPSI
Created by SharpDevelop. User: Excited
Date: 2172016 Time: 7:32 PM
To change this template use Tools | Options | Coding | Edit Standard Headers.
using System;
using System.Drawing;
using System.Windows.Forms;
using org.jivesoftware.util;
namespace enkrip
{
summary
Description of enkrip.
summary public
partial class
enkrip : Form {
public enkrip
{ The InitializeComponent call is required for Windows Forms designer
support.
InitializeComponent ;
TODO : Add constructor code after the InitializeComponent call.
} void
ExitToolStripMenuItemClick object
sender, EventArgs e {
Universitas Sumatera Utara
Application. Exit
; }
void HomeToolStripMenuItemClick
object sender, EventArgs e
{ MainForm pindah =
new MainForm
;
this. Hide
; pindah.
ShowDialog ;
} void
DekripToolStripMenuItemClick object
sender, EventArgs e {
dekrip pindah =
new dekrip
;
this. Hide
; pindah.
ShowDialog ;
} void
AboutToolStripMenuItemClick object
sender, EventArgs e {
about pindah =
new about
;
this. Hide
; pindah.
ShowDialog ;
} void
EnkripToolStripMenuItemClick object
sender, EventArgs e {
enkrip pindah =
new enkrip
;
this. Hide
; pindah.
ShowDialog ;
} void
Button1Click object
sender, EventArgs e {
try
{ OpenFileDialog open =
new OpenFileDialog
; open.Filter =
Image Files .bmp|.bmp ;
if open.
ShowDialog == DialogResult.OK
{ Bitmap bit =
new Bitmap
open.FileName;
if bit.Height =
600 bit.Width =
600
Universitas Sumatera Utara
{ pictureBox1.Image = bit;
}
else
MessageBox. Show
Image Pixel must be 300x300 px ,
Warning ;
} }
catch Exception
{
throw new
ApplicationException Failed loading image
; }
}
void Button2Click
object sender, EventArgs e
{ Blowfish algo =
new Blowfish
textBox1.Text; Bitmap image =
new Bitmap
pictureBox1.Image;
int isi =
;
int xi = image.Width;
int yi = image.Height;
string redasli=
; string
greenasli= ;
string blueasli=
;
for int
i = ; i yi; i++
{
for int
j = ; j xi; j++
{ redasli = redasli +
char image.
GetPixel j,i.R;
greenasli = greenasli + char
image. GetPixel
j,i.G; blueasli = blueasli +
char image.
GetPixel j,i.B;
} }
string redenkrip = algo.
encryptString redasli;
string greenenkrip = algo.
encryptString greenasli;
string blueenkrip = algo.
encryptString blueasli;
int ukurenkrip
= int
Math. Ceiling
double Math.
Sqrt redenkrip.Length;
Bitmap imagehasil = new
Bitmap ukurenkrip,ukurenkrip;
double redf,greenf,bluef;
Universitas Sumatera Utara
for int
i = ; i ukurenkrip; i++
{
for int
j = ; j ukurenkrip; j++
{
if isiredenkrip.Length-
1 break
; redf =
double redenkrip[isi];
greenf = double
greenenkrip[isi]; bluef =
double blueenkrip[isi];
imagehasil. SetPixel
j,i,Color. FromArgb
255 ,
int redf,
int greenf,
i nt
bluef; redf=
;greenf= ;bluef=
;isi++; }
} pictureBox2.Image = imagehasil;
richTextBox1.Text = redasli.Length.ToString; richTextBox2.Text = greenasli.Length.ToString;
richTextBox3.Text = blueasli.Length.ToString; richTextBox4.Text = redenkrip.Length.ToString;
richTextBox5.Text = greenenkrip.Length.ToString; richTextBox6.Text = ukurenkrip.ToString;
MessageBox. Show
siap ;
}
void Button3Click
object sender, EventArgs e
{
if pictureBox2.Image =null
{ SaveFileDialog simpan =
new SaveFileDialog
; simpan.Filter =
Image Files | .bmp ;
simpan.FileName = .bmp
;
if simpan.
ShowDialog == DialogResult.OK
{ pictureBox2.Image.
Save simpan.FileName, System.Drawing.Imagin
g.ImageFormat.Bmp;
Universitas Sumatera Utara
MessageBox. Show
Citra hasil telah disimpan
, simpan
, MessageBoxButtons.OK, MessageBoxIcon.Information; }
}
else
{ MessageBox.
Show Citra hasill belum ada
; }
} }
}
3. FORM DEKRIPSI