• Tidak ada hasil yang ditemukan

LAMPIRAN A LISTING PROGRAM

N/A
N/A
Protected

Academic year: 2019

Membagikan "LAMPIRAN A LISTING PROGRAM"

Copied!
21
0
0

Teks penuh

(1)

LAMPIRAN A

LISTING PROGRAM

1. Menu Utama

Public Class frmMenu

Private Sub HelpToolStripMenuItem_Click(ByVal sender As _ System.Object, ByVal e As System.EventArgs) Handles _

HelpToolStripMenuItem.Click frmHelp.Show()

End Sub

Private Sub QuitToolStripMenuItem_Click(ByVal sender As _ System.Object, ByVal

e As System.EventArgs) Handles QuitToolStripMenuItem.Click End

End Sub

Private Sub ZeroCompressionToolStripMenuItem_Click(ByVal sender As _

System.Object, ByVal e As System.EventArgs) Handles _ ZeroCompressionToolStripMenuItem.Click

frmLSB.Show() End Sub

Private Sub DifferenceCodingToolStripMenuItem_Click(ByVal sender As _

System.Object, ByVal e As System.EventArgs) Handles _ DifferenceCodingToolStripMenuItem.Click

frmStegoMLSB.Show() End Sub

Private Sub AboutToolStripMenuItem_Click(ByVal sender As _ System.Object, ByVal e As System.EventArgs) Handles _ AboutToolStripMenuItem.Click

frmAbt.Show() End Sub

End Class

2. Algoritma LSB

Imports System.Data.OleDb Imports Microsoft.VisualBasic

Public Class frmLSB

Dim WAVBuffer As System.IO.FileInfo Dim WAVBuffer1 As System.IO.FileInfo Dim JumSampel1 As Integer

Dim JumSampel2 As Integer Dim BitSampel1 As Integer Dim BitSampel2 As Integer Dim SNR As Single

(2)

Dim LenPesan As Integer Dim jumBitPesan As Integer

Private Sub cmdFileAsal_Click(ByVal sender As System.Object, ByVal e As _

System.EventArgs) Handles cmdFileAsal.Click If RadioButton1.Checked = True Then

openDialog.Title = "Open Cover Audio" openDialog.ShowDialog()

cmdFileText.Enabled = True cmdFileText.Focus()

ElseIf RadioButton2.Checked = True Then openDialog.Filter = "|*.wav"

openDialog.Title = "Open Stego Audio" openDialog.ShowDialog()

cmdProses.Text = "Ekstraksi" cmdSave.Enabled = False Else

MsgBox("Pilih Proses") End If

End Sub

Sub KonversiBIN()

Dim LenPesan As Integer Dim i As Integer

Dim BinerPesan As Long

LenPesan = Len(txtPesan.Text) For i = 1 To LenPesan

Dim bitKey As New ASCIItoBIN(Mid(txtPesan.Text, i, 1)) ListBox1.Items.Add(bitKey.convertASCIItoBIN)

BinerPesan = bitKey.convertASCIItoBIN Next

End Sub Sub Bersih()

JumSampel1 = 0 JumSampel2 = 0 BitSampel1 = 0 BitSampel2 = 0 SNR = 0

cmdProses.Enabled = False cmdSave.Enabled = False cmdFileAsal.Enabled = True txtFileAsal.Text = "" lblSize1.Text = "" lblJumSampel1.Text = "" lblJumSampel2.Text = "" lblSize2.Text = "" lblSNR.Text = ""

lblTotBitSampel1.Text = "" lblTotBitSampel2.Text = "" txtPesan.Text = ""

lblNmStego.Text = "" lblFilePesan.Text = "" ListBox1.Items.Clear() ListBox2.Items.Clear() filePesan = ""

cmdSave.Text = "Save"

(3)

Private Sub cmdProses_Click(ByVal sender As System.Object, ByVal e As _

System.EventArgs) Handles cmdProses.Click cmdProses.Enabled = False

Call KonversiBIN()

Dim Ready As Boolean = True Dim PesanEmbed As String

Dim WAVFileStream As System.IO.FileStream If RadioButton1.Checked = True Then

Try

WAVFileStream = WAVBuffer.OpenRead Catch ex As Exception

Ready = False

MsgBox("Baca File Wav", MsgBoxStyle.Critical, "Error")

End Try

ElseIf RadioButton2.Checked = True Then Try

WAVFileStream = WAVBuffer1.OpenRead Catch ex As Exception

Ready = False

MsgBox("Baca File Wav", MsgBoxStyle.Critical, "Error")

End Try

End If

If Ready = True Then

If RadioButton1.Checked = True Then

Dim WAVBytes As Long = WAVFileStream.Length Dim WAVExt As String = WAVBuffer.Extension Dim WAVByteArray(WAVBytes) As Byte

WAVFileStream.Read(WAVByteArray, 0, WAVBytes) If txtPesan.Text <> "" Then

PlainText = txtPesan.Text

Dim PlainTextByteArray(PlainText.Length) As Byte

'Penyisipan LSB

For i As Integer = 0 To (PlainText.Length - 1)_ PlainTextByteArray(i) =

CByte(AscW(PlainText.Chars(i)))

ListBox2.Items.Add(PlainTextByteArray(i)) Application.DoEvents()

Next

Dim WAVAndText(WAVBytes + PlainText.Length + _ SentinelString.Length) As Byte

For t As Long = 0 To (WAVBytes - 1) WAVAndText(t) = WAVByteArray(t) Application.DoEvents()

ListBox2.Items.Add(WAVAndText(t)) Next

Dim WAVAndText1(WAVBytes + SentinelString.Length) _

As Byte

(4)

Dim count As Integer = 0

For r As Long = WAVBytes To (WAVBytes + _ (SentinelString.Length) - 1)

WAVAndText(r) = SentinelString(count) Application.DoEvents()

ListBox2.Items.Add(WAVAndText(r)) count += 1

Next count = 0

For q As Long = (WAVBytes + SentinelString.Length) To _

(WAVBytes + SentinelString.Length + PlainText.Length - 1)

WAVAndText(q) = PlainTextByteArray(count) Application.DoEvents()

ListBox2.Items.Add(WAVAndText(q)) count += 1

Next

lblJumSampel1.Text = JumSampel1 BitSampel1 = JumSampel1 * 8

lblTotBitSampel1.Text = BitSampel1

CMD = New OleDbCommand("Select * from DataLSB _ order by IDData desc", Conn)

RD = CMD.ExecuteReader() RD.Read()

If RD.HasRows = True Then

IDData = RD.Item("IDData") + 1 Else

IDData = 1 End If

RD.Close() CMD.Dispose()

NewFileName = Application.StartupPath & _

"\StegoAudioLSB\StegoLSB" & IDData & ".wav" My.Computer.FileSystem.WriteAllBytes(NewFileName, _

WAVAndText,False)

lblNmStego.Text = NewFileName cmdSave.Enabled = True

cmdSave.Focus() Else

MsgBox("Masukkan Pesan Penyisip ...") txtPesan.Focus()

End If 'Ekstraksi LSB

ElseIf RadioButton2.Checked Then txtPesan.Clear()

JumSampel1 = 0

Dim WAVBytes As Long = WAVFileStream.Length Dim WAVExt As String = WAVBuffer1.Extension Dim WAVByteArray(WAVBytes) As Byte

WAVFileStream.Read(WAVByteArray, 0, WAVBytes)

Dim OutterSearch, InnerSearch, StopSearch As Boolean OutterSearch = True

(5)

Dim leftCounter As Long Dim rightCounter As Integer leftCounter = 0

rightCounter = 0

Dim WAVAndText(WAVBytes + SentinelString.Length) As Byte

For t As Long = 0 To (WAVBytes - 1) WAVAndText(t) = WAVByteArray(t) Application.DoEvents()

ListBox2.Items.Add(WAVAndText(t)) JumSampel1 = JumSampel1 + 1

Next

Do While (count < (WAVBytes - SentinelString.Length) And _

StopSearch = False)

If (WAVByteArray(count) = SentinelString(0)) Then leftCounter = count + 1

rightCounter = 1 InnerSearch = True

Do While (InnerSearch = True) And (rightCounter < _

SentinelString.Length) _

And (leftCounter < WAVByteArray.Length) If (WAVByteArray(leftCounter) = _

SentinelString(rightCounter)) Then rightCounter += 1

leftCounter += 1 If (rightCounter = _

(SentinelString.Length- 1)) Then StopSearch = True

End If

JumSampel1 = JumSampel1 + 1 Else

InnerSearch = False count += 1

End If Loop

Else

count += 1 End If

Loop

lblJumSampel1.Text = JumSampel1 BitSampel1 = JumSampel1 * 8

lblTotBitSampel1.Text = BitSampel1 If StopSearch = True Then

Do While (leftCounter < WAVBytes) _

txtPesan.AppendText(ChrW(CInt(WAVByteArray(leftCounter)))) PesanEmbed = _

(ChrW(CInt(WAVByteArray(leftCounter)))) leftCounter += 1

Loop

Dim LenPesan As Integer

LenPesan = Len(txtPesan.Text) Dim i As Integer

(6)

i, 1))

ListBox1.Items.Add(bitKey.convertASCIItoBIN) Next

txtPesan.Enabled = True MsgBox("Ekstraksi Berhasil")

Else

txtPesan.Text = "Data tidak ada" End If

Else

MsgBox("Pilih Proses ...") End If

End If End Sub

Private Sub cmdKeluar_Click(ByVal sender As System.Object, ByVal e As _

System.EventArgs) Handles cmdKeluar.Click Close()

End Sub

Private Sub openDialog_FileOk(ByVal sender As System.Object, _ ByVal e As System.ComponentModel.CancelEventArgs) Handles _

openDialog.FileOk

If RadioButton1.Checked = True Then

WAVBuffer = New System.IO.FileInfo(openDialog.FileName) txtFileAsal.Text = openDialog.FileName

Dim fileDetails As System.IO.FileInfo = New _ System.IO.FileInfo(txtFileAsal.Text)

lblSize1.Text = fileDetails.Length.ToString ElseIf RadioButton2.Checked = True Then

WAVBuffer1 = New System.IO.FileInfo(openDialog.FileName) txtFileAsal.Text = openDialog.FileName

NamaFile = openDialog.FileName Dim LenFile As Integer

LenFile = Len(NamaFile) Dim NamaFile1 As String = Microsoft.VisualBasic.Mid(NamaFile, _

LenFile - 12, 8) Dim intPos As Integer

intPos = InStr(1, NamaFile, "StegoLSB") If intPos > 0 Then

Dim fileDetails1 As System.IO.FileInfo = New _ System.IO.FileInfo(txtFileAsal.Text)

lblSize1.Text = fileDetails1.Length.ToString cmdProses.Enabled = True

cmdProses.Focus() Else

MsgBox("File Salah ...") cmdProses.Enabled = False cmdFileAsal.Enabled = True cmdFileAsal.Focus()

End If End If

(7)

Private Sub frmLSB_Load(ByVal sender As System.Object, ByVal e As _

System.EventArgs) Handles MyBase.Load Call Bersih()

cmdFileText.Enabled = False cmdFileAsal.Enabled = False Call KoneKsi()

End Sub

Private Sub txtPesan_TextChanged(ByVal sender As System.Object, _ ByVal e As System.EventArgs) Handles txtPesan.TextChanged

If RadioButton1.Checked = True Then cmdProses.Text = "Sisip"

cmdProses.Enabled = True End If

End Sub

Private Sub cmdSave_Click(ByVal sender As System.Object, ByVal e_ As System.EventArgs) Handles cmdSave.Click

cmdSave.Enabled = False

If RadioButton1.Checked = True Then

WAVBuffer1 = New System.IO.FileInfo(NewFileName) lblNmStego.Text = NewFileName

Dim fileDetails1 As System.IO.FileInfo = New _ System.IO.FileInfo(lblNmStego.Text)

lblSize2.Text = fileDetails1.Length.ToString

CMD = New OleDbCommand("Insert into DataLSB (IDData) values _

(" & IDData & ")", Conn)

RD = CMD.ExecuteReader() IDData = 0

RD.Close() CMD.Dispose()

Dim Ready As Boolean = True

Dim WAVFileStream1 As System.IO.FileStream Try

WAVFileStream1 = WAVBuffer1.OpenRead Catch ex As Exception

Ready = False

MsgBox("Baca File Wav", MsgBoxStyle.Critical, "Error")

End Try

Dim WAVBytes1 As Long = WAVFileStream1.Length Dim WAVExt1 As String = WAVBuffer1.Extension Dim WAVByteArray1(WAVBytes1) As Byte

WAVFileStream1.Read(WAVByteArray1, 0, WAVBytes1)

For t As Long = 0 To (WAVBytes1 - 1) Application.DoEvents()

JumSampel2 = JumSampel2 + 1 Next

(8)

lblTotBitSampel2.Text = BitSampel1

Dim BitBerubah As Integer = jumBitPesan

SNR = ((BitSampel1 - BitBerubah) / BitSampel1) * 100 lblSNR.Text = Format(SNR, "##.#####") & " %"

End If End Sub

Private Sub cmdBersih_Click(ByVal sender As System.Object, _ ByVal e As System.EventArgs) Handles cmdBersih.Click

Call Bersih() End Sub

Private Sub RadioButton1_CheckedChanged(ByVal sender As _ System.Object, ByVal e As System.EventArgs) Handles _

RadioButton1.CheckedChanged GroupBox3.Visible = True

cmdFileAsal.Enabled = True End Sub

Private Sub RadioButton2_CheckedChanged(ByVal sender As System.Object,_

ByVal e As System.EventArgs) Handles RadioButton2.CheckedChanged

GroupBox3.Visible = False cmdFileAsal.Enabled = True End Sub

Sub AppHIT()

JumSampel2 = JumSampel2 + 1.01 End Sub

Private Sub cmdFileText_Click(ByVal sender As System.Object, _ ByVal e As System.EventArgs) Handles cmdFileText.Click

OpenFileDialog1.Filter = "|*.txt" OpenFileDialog1.Title = "File Pesan" OpenFileDialog1.ShowDialog()

End Sub

Private Sub OpenFileDialog1_FileOk(ByVal sender As System.Object, _

ByVal e As System.ComponentModel.CancelEventArgs) Handles _ OpenFileDialog1.FileOk

filePesan = OpenFileDialog1.FileName

lblFilePesan.Text = filePesan 'OpenFileDialog1.FileName Dim fileDetailsPesan As System.IO.FileInfo = New _

System.IO.FileInfo(filePesan)

Dim SizePesan As Single = fileDetailsPesan.Length.ToString If filePesan = "" Then MsgBox("Pesan tidak ada", , "ERR") : _

Exit Sub

Dim pdllAF As New AdvanceFunction

pdllAF.ReadFromFile(filePesan, txtPesan) LenPesan = Len(txtPesan.Text)

jumBitPesan = LenPesan * 8 End Sub

Sub CnvBITS()

(9)

End Class

3. Algoritma MLSB

Imports System.Data.OleDb Imports Microsoft.VisualBasic Public Class frmStegoMLSB

Dim WAVBuffer As System.IO.FileInfo Dim WAVBuffer1 As System.IO.FileInfo Dim JumSampel1 As Integer

Dim JumSampel2 As Integer Dim BitSampel1 As Integer Dim BitSampel2 As Integer Dim SNR As Single

Dim PlainText As String Dim IDData As Integer Dim NewFileName As String Dim filePesan As String Dim LenPesan As Integer Dim jumBitPesan As Integer

Private Sub cmdBuka_Click(ByVal sender As System.Object, ByVal e _

As System.EventArgs) Handles cmdBuka.Click openWAV.Title = "Open WAV Files"

openWAV.ShowDialog()

If RadioButton1.Checked = True Then TextBox1.Enabled = True

cmdProses.Text = "Proses" cmdFilePesan.Enabled = True cmdFilePesan.Focus()

ElseIf RadioButton2.Checked = True Then cmdProses.Text = "Ekstraksi"

cmdSave.Enabled = False Else

MsgBox("Pilih Proses") End If

End Sub

Private Sub openWAV_FileOk(ByVal sender As System.Object, ByVal e _

As System.ComponentModel.CancelEventArgs) Handles openWAV.FileOk

Dim NamaFile As String NamaFile = openWAV.FileName

If RadioButton1.Checked = True Then

WAVBuffer = New System.IO.FileInfo(openWAV.FileName)_ TextBox2.Text = openWAV.FileName

Dim fileDetails As System.IO.FileInfo = New _ System.IO.FileInfo(TextBox2.Text)

lblSize.Text = fileDetails.Length.ToString ElseIf RadioButton2.Checked = True Then

Dim intPos As Integer

intPos = InStr(1, NamaFile, "StegoMLSB") If intPos > 0 Then

WAVBuffer = New System.IO.FileInfo(openWAV.FileName) TextBox2.Text = openWAV.FileName

(10)

lblSize.Text = fileDetails.Length.ToString cmdProses.Enabled = True

cmdProses.Focus() Else

MsgBox("File Salah") cmdProses.Enabled = False cmdBuka.Enabled = True cmdBuka.Focus()

End If End If End Sub

Sub KonversiBIN()

Dim LenPesan As Integer Dim i As Integer

Dim ASCII5BITS As New ASCIItoBIN(TextBox1.Text) LenPesan = Len(TextBox1.Text)

For i = 1 To LenPesan

Dim bitKey As New ASCIItoBIN(Mid(TextBox1.Text, i, 1)) Dim Bit5 As New ASCIItoBIN(Mid(TextBox1.Text, i, 1)) ListBox1.Items.Add(bitKey.convertASCIItoBIN)

Next i = 0 End Sub

Private Sub cmdProses_Click(ByVal sender As System.Object, _ ByVal e As System.EventArgs) Handles cmdProses.Click

cmdProses.Enabled = False cmdBuka.Enabled = False Call KonversiBIN()

Dim HEXKey As New ASCIItoBIN(TextBox1.Text & " ") Dim Str As String

Dim MyPesan As String Dim LenPesan As Integer Dim i As Integer

Dim strCS As String, strCS1 As String, strCS2 As String Dim Ready As Boolean = True

Dim PesanEmbed As String

Dim WAVFileStream As System.IO.FileStream Dim Pengurang As Integer

Dim strCSS As Integer

Try

WAVFileStream = WAVBuffer.OpenRead Catch ex As Exception

Ready = False

MsgBox("Baca File Wav", MsgBoxStyle.Critical, "Error") End Try

If Ready = True Then

Dim WAVBytes As Long = WAVFileStream.Length Dim WAVExt As String = WAVBuffer.Extension Dim WAVByteArray(WAVBytes) As Byte

WAVFileStream.Read(WAVByteArray, 0, WAVBytes) 'Penyisipan MLSB

If RadioButton1.Checked = True Then If TextBox1.Text <> "" Then

MyPesan = TextBox1.Text & " " LenPesan = Len(MyPesan)

(11)

i = 0

For i = 0 To ListBox2.Items.Count - 1 Str = ListBox2.Items(i) If Str <> "20" Then

If Microsoft.VisualBasic.Left(Str, 1) = "6" _

Or Microsoft.VisualBasic.Left(Str, 1) = "7" Then strCS = "1B " ' & Str Huruf kecil Pengurang = 60

ElseIf Microsoft.VisualBasic.Left(Str, 1) = _

"4" Or Microsoft.VisualBasic.Left(Str, 1) = "5" Then

strCS = "1C " '& Str Huruf Besar Pengurang = 40

ElseIf Microsoft.VisualBasic.Left(Str, 2) = _

"20" Then

strCS = "1D " '& Str Spasi

ElseIf Microsoft.VisualBasic.Left(Str, 2) >= _

"30" And Microsoft.VisualBasic.Left(Str, 2) <= "39" Then

Pengurang = 30

strCS = "1E " '& Str Angka Else

strCS = "1F " End If

strCSS = Integer.Parse(Str, _

Globalization.NumberStyles.HexNumber) - _

Integer.Parse(Pengurang, _

Globalization.NumberStyles.HexNumber) ListBox3.Items.Add(Hex(strCSS))

strCS = "" Else

strCS2 = ""

ListBox3.Items.Add("1D")

'ListBox3.Items.Add("---")

End If

Next

ListBox3.Items.Add("1F") i = 0

CMD = New OleDbCommand("Select * from Data", Conn)

RD = CMD.ExecuteReader() ListBox1.Items.Clear() While RD.Read

ListBox1.Items.Add(RD.Item("Data")) End While

Dim PlainText As String = TextBox1.Text

Dim PlainTextByteArray(PlainText.Length) As Byte

For i = 0 To (PlainText.Length - 1) PlainTextByteArray(i) = _

(12)

Application.DoEvents() Next

Dim WAVAndText(WAVBytes + PlainText.Length + _ SentinelString.Length) As Byte

For t As Long = 0 To (WAVBytes - 1) WAVAndText(t) = WAVByteArray(t) Next

Dim WAVAndText1(WAVBytes + SentinelString.Length) _

As Byte

For t As Long = 0 To (WAVBytes - 1) WAVAndText1(t) = WAVByteArray(t) JumSampel1 = JumSampel1 + 1 Next

Dim count As Integer = 0

For r As Long = WAVBytes To (WAVBytes + _ (SentinelString.Length) - 1)

WAVAndText(r) = SentinelString(count) count += 1

Next

count = 0

For q As Long = (WAVBytes + SentinelString.Length) _

To (WAVBytes + SentinelString.Length + _ PlainText.Length - 1)

WAVAndText(q) = PlainTextByteArray(count) count += 1

Next

lblJumSampel1.Text = JumSampel1 BitSampel1 = JumSampel1 * 8

lblTotBitSampel1.Text = BitSampel1

CMD = New OleDbCommand("Select * from DataMLSB _ order by IDData desc", Conn)

RD = CMD.ExecuteReader() RD.Read()

If RD.HasRows = True Then

IDData = RD.Item("IDData") + 1 Else

IDData = 1 End If

RD.Close() CMD.Dispose()

NewFileName = Application.StartupPath & _

"\StegoAudioMLSB\StegoMLSB" & IDData & ".wav" My.Computer.FileSystem.WriteAllBytes(NewFileName, _

WAVAndText, False)

lblNmStego.Text = NewFileName cmdSave.Enabled = True

cmdSave.Focus() Else

(13)

End If

'Ekstraksi MLSB

ElseIf RadioButton2.Checked Then TextBox1.Clear()

Dim OutterSearch, InnerSearch, StopSearch As Boolean OutterSearch = True

InnerSearch = True StopSearch = False Dim count As Long = 0 Dim leftCounter As Long Dim rightCounter As Integer leftCounter = 0

rightCounter = 0

Do While (count < (WAVBytes - SentinelString.Length) And _

StopSearch = False)

If (WAVByteArray(count) = SentinelString(0)) Then leftCounter = count + 1

rightCounter = 1 InnerSearch = True

Do While (InnerSearch = True) And (rightCounter_

< SentinelString.Length) _

And (leftCounter < WAVByteArray.Length) If (WAVByteArray(leftCounter) = _

SentinelString(rightCounter)) Then rightCounter += 1

leftCounter += 1 If (rightCounter = (SentinelString.Length_

- 1)) Then

StopSearch = True End If

Else

InnerSearch = False count += 1

End If Loop

Else

count += 1 End If

Loop

If StopSearch = True Then

Do While (leftCounter < WAVBytes)

TextBox1.AppendText(ChrW(CInt(WAVByteArray(leftCounter))) )

PesanEmbed = _

(ChrW(CInt(WAVByteArray(leftCounter)))) leftCounter += 1

Loop

LenPesan = Len(TextBox1.Text) Dim strEmbed As String

(14)

'Ekstraksi

For i = 1 To LenPesan Dim bitKey As New ASCIItoBIN(Mid(TextBox1.Text, i,_

1))

ListBox1.Items.Add(bitKey.convertASCIItoBIN) strEmbed = TextBox1.Text

If Microsoft.VisualBasic.Left(strEmbed1B, 2) _

= "1B" Then AddEmbed = 60 bol1B = True End If

If Microsoft.VisualBasic.Left(strEmbed1C, 2)_ = "1C" Then

AddEmbed = 40 bol1C = True End If

If Microsoft.VisualBasic.Left(strEmbed1E, 2) _

= "1E" Then AddEmbed = 30 bol1E = True End If

If Microsoft.VisualBasic.Left(strEmbed1D, 2) _

= "1D" Then bol1D = True strEmbed = " " Else

Exit For End If

Next

If bol1B = True Then If bol1C = True Then If bol1E = True Then If bol1D = True Then

TextBox1.Enabled = True MsgBox("Ekstraksi Berhasil") Else

TextBox1.Text = "Pesan tidak ada" End If

Else

TextBox1.Text = "Pesan tidak ada" End If

Else

TextBox1.Text = "Pesan tidak ada" End If

Else

TextBox1.Text = "Pesan tidak ada" End If

Else

(15)

Else

MsgBox("Pilih Proses ...") End If

End If End Sub

Private Sub cmdKeluar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdKeluar.Click

Close() End Sub

Private Sub cmdBersih_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdBersih.Click

TextBox2.Text = "" TextBox1.Text = "" TextBox3.Text = "" TextBox4.Text = "" ListBox1.Items.Clear() ListBox2.Items.Clear() ListBox3.Items.Clear() lblSize.Text = "" lblNmStego.Text = "" lblJumSampel1.Text = "" lblTotBitSampel1.Text = "" lblSize2.Text = ""

lblJumSampel2.Text = "" lblTotBitSampel2.Text = "" lblSNR.Text = ""

lblFilePesan.Text = "" SNR = 0

JumSampel1 = 0 JumSampel2 = 0 BitSampel1 = 0 BitSampel2 = 0 Call Mate()

cmdBuka.Enabled = True End Sub

Sub Mate()

TextBox2.Enabled = False TextBox1.Enabled = False TextBox3.Enabled = False cmdProses.Enabled = False cmdSave.Enabled = False End Sub

Private Sub TextBox1_TextChanged(ByVal sender As System.Object, _ ByVal e As System.EventArgs) Handles TextBox1.TextChanged

If RadioButton1.Checked = True Then cmdProses.Enabled = True

End If End Sub

Private Sub frmStego_Load(ByVal sender As System.Object, ByVal e_ As System.EventArgs) Handles MyBase.Load

Call Mate() Call KoneKsi()

CMD = New OleDbCommand("Delete from Data", Conn) RD = CMD.ExecuteReader()

(16)

CMD.Dispose()

CMD = New OleDbCommand("Delete from Data2", Conn) RD = CMD.ExecuteReader()

RD.Close() CMD.Dispose()

cmdProses.Enabled = False cmdFilePesan.Enabled = False End Sub

Private Sub cmdSave_Click(ByVal sender As System.Object, ByVal e _

As System.EventArgs) Handles cmdSave.Click cmdSave.Enabled = False

If RadioButton1.Checked = True Then

WAVBuffer1 = New System.IO.FileInfo(NewFileName) lblNmStego.Text = NewFileName

Dim fileDetails1 As System.IO.FileInfo = New _ System.IO.FileInfo(lblNmStego.Text)

lblSize2.Text = fileDetails1.Length.ToString

CMD = New OleDbCommand("Insert into DataMLSB (IDData) _ values (" & IDData & ")", Conn)

IDData = 0

RD = CMD.ExecuteReader() RD.Close()

CMD.Dispose()

Dim Ready As Boolean = True

Dim WAVFileStream1 As System.IO.FileStream Try

WAVFileStream1 = WAVBuffer1.OpenRead Catch ex As Exception

Ready = False

MsgBox("Baca File Wav", MsgBoxStyle.Critical, "Error")

End Try

Dim WAVBytes1 As Long = WAVFileStream1.Length Dim WAVExt1 As String = WAVBuffer1.Extension Dim WAVByteArray1(WAVBytes1) As Byte

WAVFileStream1.Read(WAVByteArray1, 0, WAVBytes1) 'Penyisipan bit

For t As Long = 0 To (WAVBytes1 - 1) Application.DoEvents()

JumSampel2 = JumSampel2 + 1 Next

Dim jumHexPesan As Integer Dim jumBitPesan As Integer

For i = 0 To ListBox3.Items.Count - 1 jumHexPesan = jumHexPesan + 1 Next

jumBitPesan = jumHexPesan * 5 lblJumSampel2.Text = JumSampel1 BitSampel2 = JumSampel2 * 8

(17)

lblTotBitSampel2.Text = BitSampel1

Dim BitBerubah As Integer = jumBitPesan

SNR = ((BitSampel1 - BitBerubah) / BitSampel1) * 100 lblSNR.Text = Format(SNR, "##.#####") & " %"

End If End Sub

Private Sub cmdFilePesan_Click(ByVal sender As System.Object, _ ByVal e As System.EventArgs) Handles cmdFilePesan.Click

OpenFileDialog1.Filter = "|*.txt" OpenFileDialog1.Title = "File Pesan" OpenFileDialog1.ShowDialog()

End Sub

Private Sub OpenFileDialog1_FileOk(ByVal sender As System.Object, _

ByVal e As System.ComponentModel.CancelEventArgs) Handles _ OpenFileDialog1.FileOk

filePesan = OpenFileDialog1.FileName

lblFilePesan.Text = filePesan 'OpenFileDialog1.FileName Dim fileDetailsPesan As System.IO.FileInfo = New _

System.IO.FileInfo(filePesan)

Dim SizePesan As Single = fileDetailsPesan.Length.ToString If filePesan = "" Then MsgBox("Pesan tidak ada", , _

"ERR") : Exit Sub

Dim pdllAF As New AdvanceFunction

pdllAF.ReadFromFile(filePesan, TextBox1) cmdProses.Enabled = True

LenPesan = Len(TextBox1.Text) jumBitPesan = LenPesan * 5

End Sub

Sub CnvBITS()

BitSampel2 = 0.85 * BitSampel2 End Sub

Private Sub RadioButton2_Click(ByVal sender As Object, ByVal e As _

System.EventArgs) Handles RadioButton2.Click GroupBox3.Visible = False

End Sub

Private Sub RadioButton1_CheckedChanged(ByVal sender As System.Object,_

ByVal e As System.EventArgs) Handles RadioButton1.CheckedChanged

GroupBox3.Visible = True End Sub

End Class

4. Module ASCII2BIN

Imports System.Text

Imports System.Data.OleDb Public Class ASCIItoBIN Dim jumBit As Integer Dim jumByte As Integer Private ASCIIstr As String

(18)

End Sub

Public Function convertASCIItoBIN() As String Dim ASCII_DECcode As String

Dim DECnum As Double

Dim counter As Integer = 0I Dim BINstr As String = "" Dim BINmessage As String jumByte = 0

jumBit = 0

Dim ASCIIencode As New ASCIIEncoding

For counter1 As Integer = 0 To ASCIIstr.Length - 1 Dim encodedBytes As Byte() = _

ASCIIencode.GetBytes(ASCIIstr.Substring(counter1, 1)) ASCII_DECcode += CStr(encodedBytes(0)) + " "

Next

Dim stringCounter As Integer = 0I

For counter2 As Integer = stringCounter To ASCII_DECcode.Length - 1

Dim DECnumAsString As String

While ASCII_DECcode.Substring(counter2, 1) <> " "

DECnumAsString += ASCII_DECcode.Substring(counter2, 1)

DECnum = CInt(DECnumAsString) counter2 += 1

End While

While DECnum > 0

If counter = 4 Then counter = 0 End If

DECnum = DECnum / 2

If Int(DECnum) = DECnum Then BINstr = "0" & BINstr counter = counter + 1 Else

BINstr = "1" & BINstr counter = counter + 1 End If

DECnum = Int(DECnum) End While

Select Case counter Case 1

BINstr = "000" & BINstr Case 2

BINstr = "00" & BINstr Case 3

BINstr = "0" & BINstr Case Else

BINstr = "0000" + BINstr End Select

BINmessage = BINmessage & BINstr & " " DECnumAsString = Nothing

(19)

jumBit = jumByte * 8

BINmessage = BINmessage.Remove(BINmessage.Length - 1, 1) Return BINmessage

End Function

Function ASC2HEX(ByVal StrName As String) As String Dim loopCount As Integer, strHold As String For loopCount = 1 To Len(StrName)

strHold = strHold & " " & Hex(Asc(Mid(StrName, loopCount, 1)))

frmStegoMLSB.ListBox2.Items.Add(Hex(Asc(Mid(StrName, _ loopCount, 1))))

Next loopCount ASC2HEX = strHold End Function

End Class

5. Module APP

Imports System.Data.OleDb Module ModAPP1

Public CMD As OleDbCommand = Nothing Public RD As OleDbDataReader = Nothing Public strConn As String

Public Conn As OleDbConnection Public bolLogin As Boolean Public bolTambah As Boolean Public bolCari As Boolean

Public X As String, Y As String Public strProses As String

Public myProcess As New Process() Public maxSampel As Single = 255 Public maxSampel1 As Single = 326 Public Sub KoneKsi()

strConn = ("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & _

Application.StartupPath & "\dbStegano.mdb") Conn = New OleDbConnection(strConn)

If Conn.State = ConnectionState.Closed Then Conn.Open()

End If End Sub

Sub Main()

Dim arr(5) As Integer Dim i As Integer

For i = 0 To arr.GetUpperBound(0) arr(i) = i * i

Next i

For i = 0 To arr.GetUpperBound(0)

Console.WriteLine("arr(" & i & ") = " & arr(i)) Next i

End Sub

Public Function Embeded(ByVal Key1 As String, ByVal txtcode As String)

Dim i, j, k As Integer, thekey Dim a, b, CryptText As String On Error Resume Next

(20)

i = 0

For j = 1 To Len(txtcode) i = i + 1

If i > Len(thekey) Then i = 1 a = Mid(txtcode, j, 1)

k = Asc(a)

b = Mid(thekey, i, 1) k = k + Asc(b)

If k > maxSampel1 Then k = k - maxSampel1 CryptText = CryptText & Chr(k)

Next j

txtcode = CryptText Embeded = txtcode End If

End Function

Public Function Extract(ByVal Key1 As String, ByVal txtcode As String)

Dim i, j, k As Integer, thekey Dim a, b, CryptText As String On Error Resume Next

CryptText = "" If Key1 <> "" Then thekey = Key1 i = 0

For j = 1 To Len(txtcode) i = i + 1

If i > Len(thekey) Then i = 1 a = Mid(txtcode, j, 1)

k = Asc(a)

b = Mid(thekey, i, 1) k = k - Asc(b)

If k < 0 Then k = k + maxSampel1 CryptText = CryptText & Chr(k) Next j

txtcode = CryptText Extract = txtcode End If

End Function

(21)

LAMPIRAN B

CURRICULUM VITAE

Nama

: Nicolas O Barus

Alamat Sekarang

: Jalan Besar No 73 Delitua

Alamat Orang tua

: Jalan Besar No 73 Delitua

Telp/Hp

: 085762068655

Email

: nicolas.oct@gmail.com

Riwayat Pendidikan

2008-2014

: S1 Ilmu Komputer Universitas Sumatera Utara, Medan

2005-2008

: SMA Santa Maria, Medan

2002-2005

: SMP Singosari, Delitua

2000-2002

: SD Singosari, Delitua

1996-2000

: SD Bonapasogit Sejahtera, Porsea

1994-1996

: TK Bonapasogit Sejahtera, Porsea

Keahlian/Kursus yang diikuti

1.

Editing Photo, Bitmap, Web Design with Adobe Photoshop,

2.

Office Document, SpreadSheet, Presentation with Microsoft Office

3.

Computer Progamming with Visual Basic .Net 2010

Referensi

Dokumen terkait

Sebab ada tiga yang memberi kesaksian (di dalam sorga: Bapa, Firman dan Roh Kudus; dan ketiganya adalah satu. Dan ada tiga yang memberi kesaksian di bumi): Roh dan air dan darah

Pola ~lahan tanaman Tabu di  Jawe. Perban~ produkl;ivitas beberapa pabrik

Dari tabel 6 diatas dapat dilihat bahwa kabupaten Mandailing Natal memiliki sektor- sektor yang memiliki nilai negatif yaitu sektor peranian, pertambangan dan

Pendekatan kualitatif dalam penelitian ini dilakukan dalam bentuk r eview audit dengan menggunakan metode t r iangulat ion t est atas audit manajemen fungsi

Kegiatan penelitian mendukung pengembangan ilmu serta terapannya. Dalarn ha1 ini, Lembaga Penelitian Universitas Negeri Padang berusaha mendorong dosen untuk melakukan

Tiga tahapan penting dalam pembuatan tempe yaitu (1) hidrasi dan pengasaman biji kedelai dengan direndam beberapa lama (satu malam); (2) pemanasan biji kedelai, yaitu dengan

Pada intinya poster memuat apa yang dituangkan pada ringkasan penelitian dan ringkasan pengmas dalam visualisasi yang

The next aim is to determine the minimum concentration of young betel fruit extract that is required to inhibit the growth of Staphylococcus aureus bacteria while determining