• Tidak ada hasil yang ditemukan

Lampiran A-1 : Listing Program Main Form

N/A
N/A
Protected

Academic year: 2021

Membagikan "Lampiran A-1 : Listing Program Main Form"

Copied!
17
0
0

Teks penuh

(1)

A- 1

Lampiran A-1 : Listing Program Main Form

Coding Main Form

using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Drawing.Imaging; using System.IO; using System.Linq; using System.Text; using System.Threading; using System.Threading.Tasks; using System.Windows.Forms; using Microsoft.Office.Interop.Word;

using App = Microsoft.Office.Interop.Word.Application;

using AForge.Video.FFMPEG;

using System.Diagnostics;

namespace Avi {

public partial class MainForm : Form

{

Stopwatch stopWatch = new Stopwatch();

public enum SEED_State

{ Accept, Reject }; public MainForm() { InitializeComponent(); bw1.WorkerSupportsCancellation = true; bw1.WorkerReportsProgress = true; splashPanel.Hide(); brwEmbedVideo.Filter = "*.avi|*.avi"; brwEmbedText.Filter = *.docx|*.docx|*.doc|*.doc|*.rtf|*.rtf|*.txt|*.txt"; saveEmbedVideo.DefaultExt = "*.avi|*.avi"; saveEmbedVideo.Filter = "*.avi|*.avi"; brwExtractVideo.Filter = "*.avi|*.avi"; } VideoFileReader reader; int frameCount = 0;

string embedText="", extractText=""; List<Bitmap> oriBitmap, embedBitmap; uint[] randomList;

uint SEED, newSEED;

private void btn_embvideo_Click(object sender, EventArgs e) {

string fileEmbedVideo;

btn_embvideo.Enabled = false; oriBitmap = new List<Bitmap>();

(2)

A-2

if (brwEmbedVideo.ShowDialog() == DialogResult.OK) {

frameCount = 0; bw1.RunWorkerAsync();

fileEmbedVideo = brwEmbedVideo.FileName; tb_embvideo.Text = fileEmbedVideo; reader = new VideoFileReader(); reader.Open(fileEmbedVideo); while (true)

{

using (var videoFrame = reader.ReadVideoFrame()) {

using (MemoryStream memory = new MemoryStream()) { if (videoFrame == null) break; else { frameCount++; videoFrame.Save(memory, ImageFormat.Bmp); oriBitmap.Add(new Bitmap(videoFrame)); } } } } Thread.Sleep(100);

pb_embvideo.Image = new Bitmap(oriBitmap[0]); } else { bw1.CancelAsync(); btn_embvideo.Enabled = true; }

Console.WriteLine("Framecount : "+frameCount); }

private void btn_embtext_Click(object sender, EventArgs e) {

embedText = ""; string fileEmbedText;

btn_embtext.Enabled = false;

if (brwEmbedText.ShowDialog() == DialogResult.OK) {

bw1.RunWorkerAsync();

fileEmbedText = brwEmbedText.FileName; App app = new App();

Document doc = app.Documents.Open(fileEmbedText); foreach (Paragraph p in doc.Paragraphs)

embedText += p.Range.Text.Trim(); ((_Document)doc).Close();

(3)

A-3

((_Application)app).Quit(); rtb_teks.Text = embedText; tb_embteks.Text = fileEmbedText;

randomList = new uint[embedText.Length];

tb_embperiode.Text = embedText.Length.ToString(); } else { bw1.CancelAsync(); btn_embtext.Enabled = true; } }

private void btn_embembed_Click(object sender, EventArgs e) {

List<uint> randomList = new List<uint>(); stopWatch.Reset(); btn_embembed.Enabled = false; stopWatch.Start(); if (!(tb_embvideo.Text == "" || tb_embteks.Text == "" || tb_embseed.Text == "")) { bw1.RunWorkerAsync();

SEED_State seed_state = SEED_State.Reject; embedBitmap = new List<Bitmap>(oriBitmap); SEED = uint.Parse(tb_embseed.Text);

newSEED = SEED; LFSR.setSEED(SEED); if (embedText.Length <= embedBitmap.Count) {

while (seed_state == SEED_State.Reject) {

for (int j = 0; j < embedText.Length; j++) {

uint random = (uint)(LFSR.getNextInt() % frameCount); if (randomList.Count == 0) { randomList.Add(random); continue; } if (randomList.Contains(random)) { randomList.Clear(); newSEED++; LFSR.setSEED(newSEED); break; } randomList.Add(random); if (j == embedText.Length - 1) seed_state = SEED_State.Accept; }

(4)

A-4

}

Console.WriteLine("New SEED : " + newSEED); Console.WriteLine("Embed SEED Result"); // in case overlapping

if (seed_state == SEED_State.Accept) {

for (int j = 0; j < embedText.Length; j++) {

embedBitmap[(int)randomList[j]] =

SteganographyHelper.embedText("" + embedText[j], embedBitmap[(int)randomList[j]]);

}

stopWatch.Stop(); }

if (saveEmbedVideo.ShowDialog() == DialogResult.OK) {

var writer = new VideoFileWriter();

TimeSpan ts = stopWatch.Elapsed; string elapsedTime =

String.Format("{0:00}:{1:00}:{2:000}.{3:000}",

ts.Hours, ts.Minutes, ts.Seconds,ts.Milliseconds );

writer.Open(saveEmbedVideo.FileName, embedBitmap[0].Width, embedBitmap[0].Height, 30, VideoCodec.Raw); for (int j = 0; j < embedBitmap.Count; j++) { writer.WriteVideoFrame(embedBitmap[j]); } writer.Close();

MessageBox.Show(this, "Penyisipan Berhasil " + elapsedTime, "Berhasil ", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { bw1.CancelAsync(); btn_embembed.Enabled = true; } } } else { bw1.CancelAsync(); string msgText=""; if (tb_embvideo.Text == "")

msgText += "Pilih file video terlebih dahulu"; else if (tb_embteks.Text == "")

msgText += "Pilih file teks terlebih dahulu"; else

msgText += "Pilih SEED terlebih dahulu";

MessageBox.Show(this, msgText, "Error", MessageBoxButtons.OK,

MessageBoxIcon.Exclamation);

btn_embembed.Enabled = true; }

(5)

A-5

randomList.Clear(); }

private void btn_extvideo_Click(object sender, EventArgs e) {

string fileExtractVideo=""; embedBitmap = new List<Bitmap>(); frameCount = 0;

if (brwExtractVideo.ShowDialog() == DialogResult.OK) {

bw1.RunWorkerAsync();

fileExtractVideo = brwExtractVideo.FileName; tb_extvideo.Text = fileExtractVideo;

reader = new VideoFileReader(); reader.Open(fileExtractVideo); while (true)

{

using (var videoFrame = reader.ReadVideoFrame()) {

using (MemoryStream memory = new MemoryStream()) { if (videoFrame == null) break; else { frameCount++; videoFrame.Save(memory, ImageFormat.Bmp); embedBitmap.Add(new Bitmap(videoFrame)); }

} } }

pb_extvideo.Image = new Bitmap(embedBitmap[0]); } else { bw1.CancelAsync(); } } int periode;

private void btn_extextract_Click(object sender, EventArgs e) { btn_extextract.Enabled = false; stopWatch.Reset(); stopWatch.Start(); if (!(tb_extperiode.Text == "" || tb_extseed.Text == "" || tb_extvideo.Text == "")) { bw1.RunWorkerAsync();

periode = int.Parse(tb_extperiode.Text); SEED = uint.Parse(tb_extseed.Text); newSEED = SEED;

(6)

A-6

LFSR.setSEED(SEED);

SEED_State seed_state = SEED_State.Reject; randomList = new uint[periode];

while (seed_state == SEED_State.Reject) {

for (int j = 0; j < periode; j++) {

uint random = (uint)(LFSR.getNextInt() % frameCount); if (randomList.Length == 0) { randomList[j] = random; continue; } if (randomList.Contains(random)) {

Array.Clear(randomList, 0, randomList.Length); newSEED++; LFSR.setSEED(newSEED); break; } randomList[j] = random; if (j == periode - 1) {

seed_state = SEED_State.Accept; break;

} } }

for (int j = 0; j < periode; j++) {

extractText +=

SteganographyHelper.extractText(embedBitmap[(int)randomList[j]]); } rb_extteks.Text = extractText; stopWatch.Stop(); TimeSpan ts = stopWatch.Elapsed; string elapsedTime = String.Format("{0:00}:{1:00}:{2:000}.{3:000}",

ts.Hours, ts.Minutes, ts.Seconds, ts.Milliseconds);

MessageBox.Show(this, "Berhasil mengekstrak teks dari video" + elapsedTime, "Berhasil", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { bw1.CancelAsync(); btn_extextract.Enabled = true; string msgText = ""; if(tb_extvideo.Text=="")

msgText += "Pilih file video terlebih dahulu"; else if(tb_extseed.Text=="")

(7)

A-7

msgText += "Pilih SEED terlebih dahulu"; else

msgText += "Pilih periode terlebih dahulu";

MessageBox.Show(this, msgText, "Error", MessageBoxButtons.OK,

MessageBoxIcon.Exclamation); }

}

private void aplikasiToolStripMenuItem_Click(object sender, EventArgs

e) { Panel.Show(); splashPanel.Hide(); proBar.Show(); }

private void aboutToolStripMenuItem_Click(object sender, EventArgs e) {

splashPanel.Show(); Panel.Hide(); proBar.Hide(); }

private void exitToolStripMenuItem_Click(object sender, EventArgs e) {

Close(); }

private void bw1_DoWork(object sender, DoWorkEventArgs e) {

Thread.Sleep(1000);

for (int i = 0; i < 10000; i++) {

bw1.ReportProgress(i); }

}

private void MainForm_Load(object sender, EventArgs e) {

} } }

(8)

B-1

Lampiran B : Listing Program LFSR

LFSR using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Security.Cryptography; namespace Avi { class LFSR {

private static uint SEED; public static uint getNextInt() {

if (SEED != 0) {

uint start_state = SEED; uint lfsr = start_state; uint bit;

/* Must be 16bit to allow bit<<15 later in the code */

uint int_period = 0; do

{

// taps: 32 30 26 25; feedback polynomial: x^32 + x^30 + x^26 + x^25 + 1 */ bit = ((lfsr >> 0) ^ (lfsr >> 2) ^ (lfsr >> 6) ^ (lfsr >> 7)) & 1; lfsr = (lfsr >> 1) | (bit << 31); ++int_period; } while (lfsr == start_state); SEED = lfsr; return lfsr; } return 0; }

public static void setSEED(uint seed) {

SEED = seed; }

} }

(9)

C-1

Lampiran C : Listing Program Stego-Helper

// code from sourceforge.com

using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Drawing; using System.Threading.Tasks; namespace Avi { class SteganographyHelper {

public enum State

{

Hiding,

Filling_With_Zeros };

public static Bitmap embedText(string text, Bitmap bmp) {

// initially, we'll be hiding characters in the image

State state = State.Hiding;

// holds the index of the character that is being hidden

int charIndex = 0;

// holds the value of the character converted to integer

int charValue = 0;

// holds the index of the color element (R or G or B) that is currently being processed

long pixelElementIndex = 0;

// holds the number of trailing zeros that have been added when finishing the process

int zeros = 0;

// hold pixel elements

int R = 0, G = 0, B = 0; // pass through the rows

for (int i = 0; i < bmp.Height; i++) {

// pass through each row

for (int j = 0; j < bmp.Width; j++) {

// holds the pixel that is currently being processed

Color pixel = bmp.GetPixel(j, i);

// now, clear the least significant bit (LSB) from each pixel element

R = pixel.R - pixel.R % 2; G = pixel.G - pixel.G % 2; B = pixel.B - pixel.B % 2;

(10)

C-2

for (int n = 0; n < 3; n++) {

// check if new 8 bits has been processed

if (pixelElementIndex % 8 == 0) {

// check if the whole process has finished

// we can say that it's finished when 8 zeros are added

if (state == State.Filling_With_Zeros && zeros == 8)

{

// apply the last pixel on the image

// even if only a part of its elements have been affected

if ((pixelElementIndex - 1) % 3 < 2) {

bmp.SetPixel(j, i, Color.FromArgb(R, G, B));

}

// return the bitmap with the text hidden in

return bmp; }

// check if all characters has been hidden

if (charIndex >= text.Length) {

// start adding zeros to mark the end of the text

state = State.Filling_With_Zeros; }

else

{

// move to the next character and process again

charValue = text[charIndex++]; }

}

// check which pixel element has the turn to hide a bit in its LSB

switch (pixelElementIndex % 3) {

case 0: {

if (state == State.Hiding) {

// the rightmost bit in the character will be (charValue % 2) // to put this value instead of the LSB of the pixel element // just add it to it

// recall that the LSB of the pixel element had been cleared // before this operation

R += charValue % 2;

// removes the added rightmost bit of the character

// such that next time we can reach the next one

charValue /= 2; }

} break; case 1: {

(11)

C-3

{ G += charValue % 2; charValue /= 2; } } break; case 2: {

if (state == State.Hiding) {

B += charValue % 2; charValue /= 2; }

bmp.SetPixel(j, i, Color.FromArgb(R, G, B));

} break; }

pixelElementIndex++;

if (state == State.Filling_With_Zeros) {

// increment the value of zeros until it is 8

zeros++; } } } } return bmp; }

public static string extractText(Bitmap bmp) {

int colorUnitIndex = 0; int charValue = 0;

// variable penyimpan hasil ekstraksi

string extractedText = String.Empty; // membaca setiap kolom

for (int i = 0; i < bmp.Height; i++) {

// membaca setiap kolom

for (int j = 0; j < bmp.Width; j++) {

Color pixel = bmp.GetPixel(j, i);

// for each pixel, pass through its elements (RGB)

for (int n = 0; n < 3; n++) { switch (colorUnitIndex % 3) { case 0: {

charValue = charValue * 2 + pixel.R % 2; } break;

(12)

C-4

{

charValue = charValue * 2 + pixel.G % 2; } break;

case 2: {

charValue = charValue * 2 + pixel.B % 2; } break;

}

colorUnitIndex++;

// if 8 bits has been added,

// then add the current character to the result text

if (colorUnitIndex % 8 == 0) {

// reverse? of course, since each time the process occurs

// on the right (for simplicity)

charValue = reverseBits(charValue);

// can only be 0 if it is the stop character (the 8 zeros)

if (charValue == 0) {

return extractedText; }

// convert the character value from int to char

char c = (char)charValue;

// add the current character to the result text

extractedText += c.ToString(); } } } } return extractedText; }

public static int reverseBits(int n) {

int result = 0;

for (int i = 0; i < 8; i++) { result = result * 2 + n % 2; n /= 2; } return result; } } }

(13)

D-1

Lampiran D Angket

Apakah ada perbedaan antara kedua video tersebut?

No

Nama

Jawaban

Keterangan

1

Ya / Tidak

2

Ya / Tidak

3

Ya / Tidak

4

Ya / Tidak

5

Ya / Tidak

6

Ya / Tidak

7

Ya / Tidak

8

Ya / Tidak

9

Ya / Tidak

10

Ya / Tidak

11

Ya / Tidak

12

Ya / Tidak

13

Ya / Tidak

14

Ya / Tidak

15

Ya / Tidak

16

Ya / Tidak

17

Ya / Tidak

18

Ya / Tidak

19

Ya / Tidak

20

Ya / Tidak

(14)

E-1

Nama

: Ricky Steven

Tempat, tanggal Lahir : Medan, 13 Maret 1993

Jenis Kelamin

: Laki-Laki

Umur

: 23 tahun

Tinggi, berat badan

: 178cm , 75 kg

Agama

: Buddha

Alamat

: Jalan Brig. Zein Hamid No 43A LK XI

Status

: Belum Kawin

Telepon

: 083198808098

Email

: [email protected]

Formal

1997 – 2003

: Lulusan SD Sutomo 1 Medan

2003 – 2006

: Lulusan SMP Sutomo 1 Medan

2006 – 2011

: Lulusan SMA Sutomo 1 Medan

Non Formal

2002 – 2010

: Bimbingan bahasa Inggris di Winfield

2011

: Workshop 3D Animation Revolution with DreamArch

Animation

Data Pribadi

Latarbelakang Pendidikan :

(15)

E-2

2011

: Workshop Menggambar Manga by Mieko 2011.

2011

: Workshop Earn Money from Design Artechno

Festival

2011

: Workshop Networking by GONES Artechno Festival

2012

: PPO Basic Training of KMB USU

2012

: Workshop Linux Configuration (KSL USU).

2012

: Workshop Pintar Programming Teknonesia.

2012

: Information Technology Seminar : “Pemanfaatan

Teknologi Open Source sebagai Aplikasi dalam Dunia

Bisnis Global”.

2012

: Information Technology Seminar : “Kupas Tuntas

Blackberry, iOS & Android”.

2012

: Based Training Organization : “Personal Branding –

That’s You”. DJARUM foundation.

2012

: Based Training Organization : “Public Speaking and

Presentation Skill”. Tanoto Foundation.

2012

: Motivation Training : “Masa Orientasi IMILKOM

2012”. Graduate Study Program of Computing Science

2014

: Liason Officer Indonesia, Malaysia, Thailand

Gathering Triangle (IMT-GT)

2015

: Liasion Officer (LO) Kegiatan Forum Rektor Indonesia

XVII di Universitas Sumatera Utara

2016

: Volunteer dalam partisipasi Education Expo

2009 – 2011

: Anggota dari Programming Club Sutomo 1

2012 – 2013

: Anggota Divisi Khusus dari Keluarga Mahasiswa

Buddhis di Universitas Sumatera Utara

(16)

E-3

2013 – 2014

: Anggota Divisi Kewirausahaan dari Keluarga

Mahasiswa Buddhis di Universitas Sumatera Utara

2013 – 2014

: Anggota PEMA Fasilkom-TI divisi kerohanian agama

Buddha

2013 – 2014

: Ketua Komisi Pemilihan Umum (KPU) Imilkom

2013 – 2014

: Ketua Tanoto Scholars Association Medan

2012

: Penghargaan sebagai Juara 1 Programming pada

“Imilkom Contest 2012”

2013

: Penghargaan sebagai “Best Tanoto Association” se-

Indonesia ketika menjabat sebagai ketua

2009-2012

: Bekerja pada perusahaan pengolahan biji kemiri di

Namorambe

Rincian Pekerjaan:

Melakukan pembagian perkerjaan kepada pekerja untuk mencapai

target produksi

Pengoperasian mesin pengaduk, mesin penggiling dan mesin penjahit

Pengoperasian forklift

Melakukan pembagian upah dan absensi terhadap pegawai secara

manual untuk lebih dari 50 pegawai

Pendapatan 3 juta

Praktek Kerja Lapangan di di Kantor Dinas Pendapatan Negara Medan

Periode

: Agustus 2014 – Oktober 2014

Tujuan

: Mata Kuliah Wajib

Posisi

: Konsultan IT dan Programmer

Rincian Pekerjaan:

Mengorganisir data 5 tahun dan lebih dan menyusunnya sehingga

dapat di direkapitulasi.

Membangun sebuah program dengan menggunakan Microsoft Excel

dan Makro untuk menangani tunggakan pajak di seluruh Kabupaten

Kota Medan

Pendapatan : 0

Penghargaan

(17)

E-4

2013-2017

: Bekerja di Scholars Hub sebagai pengajar dan pernah menjadi

kepala divisi

Rincian Pekerjaan:

Melakukan pengajaran terhadap pelajaran Mate, Fisika dan Kimia untuk

tingkat IGCSE, O Level dan A level untuk kurikulum internasional dan

tingkat smp dan sma untuk tingkat nasional

Melakukan pelatihan terhadap guru baru

Melakukan evaluasi terhadap siswa

Pendapatan : 5 juta

Kemampuan Komputer

Office

1. Microsoft Word

2. Microsoft Excel

3. Microsoft Power Point

4. Microsoft Access

Design & Video

1. Adobe Photoshop

2. Adobe Dreamweaver

3. Adobe Ilustrator

Pemrograman

1. Visual Studio

2. Eclipse

3. Visual Basic

4. Unity

5. MatLab

6. FoxPro

Medan, 30 Januari 2017

Hormat saya,

Ricky Steven

Kemampuan

Referensi

Dokumen terkait

[r]

Suku pertama dan suku kelima suatu barisan aritmetika berturut–turut adalah 2 dan 10, jumlah dua puluh suku pertama barisan tersebut adalah ….. Diketahui

Perhatia n siswa saat mengikuti pembelajaran pada kondisi awal sebesar 55,56% dan setelah mendapat tindakan dengan penggunaan metode CTL dalam pembelajaran pada siklus I

Objek-objek tersebut dapat divisualisasikan dengan berbagai cara, pilihlah unsur- unsur rupa (garis, warna, tekstur, bidang, volume, ruang), sesuai dengan kebutuhan interes

[r]

Adapun tujuan dari penelitian ini adalah untuk mengetahui bagaimana kondisi ketersediaan pangan di Indonesia saat ini dan bagaimana pengaruh kontribusi

Pekerjaan yang dikerjakan oleh dua orang atau lebih dengan tujuan agar menjadi ringan disebut…D. Sikap berikut ini yang tidak diperlukan untuk menjaga kerukunan antaranggota

[r]