1 Steganografi Teks menggunakan Pangram dan Medium Citra pada Enhanced Least Significant Bit

  LAMPIRAN 1 : DAFTAR PUBLIKASI ILMIAH PENULIS (TESIS) No. Judul Artikel Penulis Publikasi Waktu Tempat (Seminar/Jurnal. Publikas dll) i

  1 Steganografi Teks Legito, Jurnal Penelitian April Medan menggunakan Pangram Jamalud Teknik 2014 dan Medium Citra pada din , Informatika Prima Enhanced Least Tasliyah (Vol.7, No.1) Significant Bit

  2 Implementasi Algoritma Tasliyah Jurnal Penelitian April Medan , Teknik Rabin pada Skema

  2014 Jamallu Informatika Prima Three Pass Protokol ddin, (Vol.7, No.1)

  Legito

  3 Rancang Bangun Jamalud Jurnal Penelitian April Medan din, Teknik Kombinasi Hill Cipher

  2014 Tasliyah Informatika Prima dan Vigenere Cipher , Legito (Vol.7, No.1) dalam pengembangan Algoritma Kriptografi Klasik

LAMPIRAN 2 LISTING PROGRAM

  Public Class frmAbout Private Sub frmAbout_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load End Sub End Class Public Class frmEkstrak Private Sub lnkSimpan_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles lnkSimpan.LinkClicked frmEkstrakSimpan.rtb1.Text = rtb1.Text frmEkstrakSimpan.ShowDialog() End Sub Private Sub lnkBuka_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles lnkBuka.LinkClicked If ofdOldFile.ShowDialog() = Windows.Forms.DialogResult.OK Then Dim bm As New Bitmap(ofdOldFile.FileName) Dim nWarna As Color lblLokasi.Text = ofdOldFile.FileName 'Set citra ke variabel PicOriginal = bm picCitra.BackgroundImage = bm picCitra.BackgroundImageLayout = ImageLayout.Stretch lblUkuran.Text = PicOriginal.Width & " x " & PicOriginal.Height 'Simpan warna piksel ke array originalArray = Nothing ReDim originalArray(PicOriginal.Height, PicOriginal.Width, 2) For j = 0 To PicOriginal.Height - 1 For i = 0 To PicOriginal.Width - 1 nWarna = PicOriginal.GetPixel(i, j) originalArray(j, i, 0) = nWarna.R originalArray(j, i, 1) = nWarna.G originalArray(j, i, 2) = nWarna.B Next Next End If End Sub Private Sub lnkProses_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles lnkProses.LinkClicked If txtPassword.Text.Trim.Length < 6 Then

  MsgBox("Panjang password minimal 6 karakter !", MsgBoxStyle.Critical Exit Sub End If ' MsgBox("Ukuran citra asli minimal 100 x 100 !", MsgBoxStyle.Critical) ' Exit Sub 'End If If PicOriginal.Height > 1000 Or PicOriginal.Width > 1000 Then MsgBox("Ukuran citra asli maksimal 1000 x 1000 !", MsgBoxStyle.Critical) Exit Sub End If If rtbIsiPangram.Text.Trim = "" Then MsgBox("Pangram masih kosong !", MsgBoxStyle.Critical) Exit Sub End If If txtPassword.Text = txtVerifikasi.Text Then '------------------ ' Proses ekstrak '------------------ '1. Cari posisi piksel penyimpanan nilai SEED & OFFSET dengan metode LCG 'Tentukan jumlah titik penyimpanan nilai Dim cBit As String = "" Dim cBitR As String Dim cBitG As String Dim cBitB As String Dim cBitWarna As String Dim i As Integer For i = 0 To 1 cBitWarna = FDec2Biner(originalArray(0, i, 0), 8) cBitR = Kanan(cBitWarna, 3) cBitWarna = FDec2Biner(originalArray(0, i, 1), 8) cBitG = Kanan(cBitWarna, 3) cBitWarna = FDec2Biner(originalArray(0, i, 2), 8) cBitB = Kanan(cBitWarna, 3) cBit &= cBitR & cBitG & cBitB Next Dim nJlh As Integer = FBiner2Dec(cBit) Dim cHash As String = Kiri(SHA(txtPassword.Text), 8) Dim nHash As Double = FHex2Dec(cHash) Dim nArrX() As Double = LCG(nHash, nJlh, , , PicOriginal.Width

  • PicOriginal.Height)

  '2. Ambil nilai SEED dan OFFSET Dim strIndeks As String = "" Dim x As Integer Dim y As Integer For i = 1 To nArrX.GetUpperBound(0) y = nArrX(i) \ PicOriginal.Width cBit = FDec2Biner(originalArray(y, x, 0), 8) cBitR = Kanan(cBit, 3) cBit = FDec2Biner(originalArray(y, x, 1), 8) cBitG = Kanan(cBit, 3) cBit = FDec2Biner(originalArray(y, x, 2), 8) cBitB = Kanan(cBit, 3) If i Mod 2 = 1 Then 'SEED strIndeks &= FBiner2Dec(cBitR & cBitG & cBitB) & "," Else 'OFFSET strIndeks &= FBiner2Dec(cBitR & cBitG & cBitB) & IIf(i < nArrX.GetUpperBound(0), ";", "") End If Next '3. Ekstrak pesan Dim cPesan As String = ExtractMessage(rtbIsiPangram.Text, strIndeks, True) rtb1.Text = cPesan lnkSimpan.Enabled = True Else MsgBox("Data password dan verifikasi password tidak sama !", MsgBoxStyle.Critical) lnkSimpan.Enabled = False Exit Sub End If End Sub Private Sub lnkBukaP_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles lnkBukaP.LinkClicked On Error GoTo errLoad With Open1 .InitialDirectory = My.Application.Info.DirectoryPath .FileName = "" If .ShowDialog() = Windows.Forms.DialogResult.OK Then lblLokasiP.Text = .FileName rtbIsiPangram.LoadFile(.FileName, RichTextBoxStreamType.RichText) 'RichTextBoxStreamType.PlainText) End If End With Exit Sub errLoad: lblLokasiP.Text = Open1.FileName rtbIsiPangram.LoadFile(Open1.FileName, RichTextBoxStreamType.PlainText) End Sub Private Sub lnkX_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles lnkX.LinkClicked Me.Close() End Sub Private Sub frmEkstrak_FormClosed(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosedEventArgs) Handles Me.FormClosed Me.Dispose() End Sub Private Sub lnkLaporan_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles lnkLaporan.LinkClicked With frmLaporan .rtb1.Text = strLap .ShowDialog() End With End Sub Private Sub frmEkstrak_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load strLap = "" End Sub End Class Public Class frmEkstrakSimpan Private Sub btnInputFile_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnInputFile.Click With SFD .InitialDirectory = My.Application.Info.DirectoryPath .FileName = "" If .ShowDialog() = Windows.Forms.DialogResult.OK Then txtFileTerekstrak.Text = .FileName End If End With End Sub Private Sub lnkBatal_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles lnkBatal.LinkClicked Me.Close() End Sub Private Sub lnkSimpan_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles lnkSimpan.LinkClicked Dim i As Byte

  If txtFileTerekstrak.Text = "" Then MessageBox.Show("Nama file pangram masih kosong !", "Simpan Pangram", MessageBoxButtons.OK, MessageBoxIcon.Warning) Else For i = 0 To 1 rtb1.SaveFile(txtFileTerekstrak.Text, Next MessageBox.Show("Pangram Tersimpan !", "Simpan Pangram", MessageBoxButtons.OK, MessageBoxIcon.Information) Me.Close() End If End Sub End Class Public Class frmInputPangram Public cTeksPangram1 As String Private Sub lnkBatal_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles lnkBatal.LinkClicked Me.Close() End Sub Sub SavePangram() rtb2.LoadFile(My.Application.Info.DirectoryPath & "\pangram.dat", RichTextBoxStreamType.PlainText) Dim cTemp() As String = Split(rtb2.Text, "|") Dim i As Integer rtbSave.Text = "" For i = 0 To cTemp.GetUpperBound(0) If cTemp(i) = cTeksPangram1 Then 'Pangram ini yang diganti Else 'Simpan pangram rtbSave.Text &= cTemp(i) & "|" End If Next rtbSave.Text &= txtPangram.Text For i = 1 To 2 rtbSave.SaveFile(My.Application.Info.DirectoryPath & "\pangram.dat", RichTextBoxStreamType.TextTextOleObjs) Next End Sub Private Sub lnkSimpan_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles lnkSimpan.LinkClicked Dim i As Integer Dim cKar As String If txtPangram.Text.Trim = "" Then MsgBox("Kalimat pangram masih kosong !", MsgBoxStyle.Critical)

  Else For i = 1 To strAlfabet1.Length cKar = Mid(strAlfabet1, i, 1) If InStr(txtPangram.Text.Trim, cKar) = 0 Then MsgBox("Pangram harus mengandung karakter a sampai z !", MsgBoxStyle.Critical) End If Next 'If cTeksPangram1 <> "" Then ' 'Edit --> berarti hapus sebelumnya dulu ' strSQL = "Delete From Pangram Where Kalimat = '" & cTeksPangram1 & "'" ' oConn.Execute(strSQL) 'End If 'strSQL = "Insert Into Pangram(Kalimat) values('" & _ ' txtPangram.Text.Trim & "')" 'oConn.Execute(strSQL) Call SavePangram() MsgBox("Data Pangram Tersimpan !", MsgBoxStyle.Information) Me.Close() End If End Sub Private Sub frmInputPangram_FormClosed(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosedEventArgs) Handles Me.FormClosed Me.Dispose() End Sub Private Sub frmInputPangram_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load End Sub End Class Public Class frmLaporan Private Sub lnkKeluar_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles lnkKeluar.LinkClicked Me.Close() End Sub Private Sub lnkSimpan_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles lnkSimpan.LinkClicked With SFD .InitialDirectory = My.Application.Info.DirectoryPath .FileName = "" If .ShowDialog() = Windows.Forms.DialogResult.OK Then rtb1.SaveFile(.FileName, RichTextBoxStreamType.TextTextOleObjs) End If

  End With End Sub Private Sub rtb1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles rtb1.KeyPress e.KeyChar = "" End Class Public Class frmMain Private Sub frmMain_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load 'Buka koneksi ke database access oConn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & _ My.Application.Info.DirectoryPath & "\Pangram.mdb;Persist Security Info=False" oConn.Open() End Sub Private Sub lnkPangram_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles lnkPangram.LinkClicked Me.Hide() frmPangram.lnkSet.Visible = False frmPangram.ShowDialog() Me.Show() End Sub Private Sub lnkTempel_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles lnkTempel.LinkClicked Me.Hide() frmTempel.ShowDialog() Me.Show() End Sub Private Sub lnkAbout_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles lnkAbout.LinkClicked Me.Hide() frmAbout.ShowDialog() Me.Show() End Sub Private Sub lnkEkstraksi_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles lnkEkstraksi.LinkClicked Me.Hide() frmEkstrak.ShowDialog() Me.Show() End Sub

  Private Sub lnkPTempel_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles lnkPTempel.LinkClicked Me.Hide() frmTempel.ShowDialog() Me.Show() Private Sub lnkPEkstrak_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles lnkPEkstrak.LinkClicked Me.Hide() frmEkstrak.ShowDialog() Me.Show() End Sub Private Sub lnkTeori_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles lnkBanding.LinkClicked frmPerbandingan.ShowDialog() End Sub Private Sub lnkTeoriS_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles lnkTeoriS.LinkClicked With frmTeori .cID = "T" .nPage = 3 .ShowDialog() End With End Sub Private Sub lnkTeoriLSB_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles lnkTeoriLSB.LinkClicked With frmTeori .cID = "L" .nPage = 2 .ShowDialog() End With End Sub Private Sub lnkTPangram_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles lnkTPangram.LinkClicked With frmTeori .cID = "T" .nPage = 3 .ShowDialog() End With End Sub Private Sub lnkInfoEkstrak_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles lnkInfoEkstrak.LinkClicked MsgBox("Proses ini digunakan untuk mengekstrak pesan keluar dari media citra dan pangram !", MsgBoxStyle.Information)

  End Sub Private Sub lnkInfoTempel_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles lnkInfoTempel.LinkClicked MsgBox("Proses ini digunakan untuk menempelkan pesan ke dalam media End Sub End Class Public Class frmPangram Dim nHal As Integer Dim nTotalHal As Integer Dim cArrPangram() As String Private Sub lnkX_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles lnkX.LinkClicked Me.Close() End Sub Private Sub lnkInput_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles lnkInput.LinkClicked Me.Hide() frmInputPangram.ShowDialog() Me.Show() End Sub Private Sub frmPangram_Activated(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Activated Call LoadPangram() Call ShowPangram() End Sub Private Sub frmPangram_FormClosed(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosedEventArgs) Handles Me.FormClosed Me.Dispose() End Sub Private Sub frmPangram_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load nHal = 1 Call LoadPangram() cboFilter.Text = cboFilter.Items.Item(0) End Sub Sub LoadPangram() Dim rS As New ADODB.Recordset Dim i As Integer Dim cTipe As String = cboFilter.Text '= IIf(cboFilter.Text = "Alfabet", "", IIf(cboFilter.Text = "Alfanumerik", "", "")) ReDim cArrPangram(0)

  'strSQL = "Select Kalimat From Pangram Order By Kalimat" 'rS.Open(strSQL, oConn, ADODB.CursorTypeEnum.adOpenStatic, ADODB.LockTypeEnum.adLockReadOnly) rtb1.LoadFile(My.Application.Info.DirectoryPath & "\pangram.dat", RichTextBoxStreamType.PlainText) If rtb1.Text.Trim <> "" Then ReDim cArrPangram(0) For i = 0 To cTemp.GetUpperBound(0) 'rS.RecordCount If cTipe = "Universal" Then ReDim Preserve cArrPangram(cArrPangram.GetUpperBound(0)

  • 1) cArrPangram(cArrPangram.GetUpperBound(0)) = cTemp(i) 'rS(0).Value ElseIf cTipe = "Alfabet" Then If IsAlfabet(cTemp(i)) Then ReDim Preserve cArrPangram(cArrPangram.GetUpperBound(0) + 1) cArrPangram(cArrPangram.GetUpperBound(0)) = cTemp(i) 'rS(0).Value End If Else If IsAlfaNumerik(cTemp(i)) Then ReDim Preserve cArrPangram(cArrPangram.GetUpperBound(0) + 1) cArrPangram(cArrPangram.GetUpperBound(0)) = cTemp(i) 'rS(0).Value End If End If 'rS.MoveNext() Next

  nTotalHal = (cTemp.GetUpperBound(0) + 1) \ 5 If (cTemp.GetUpperBound(0) + 1) Mod 5 > 0 Then nTotalHal += 1 End If lblHalaman.Text = "Halaman : 1 / " & nTotalHal 'rS.RecordCount lblTotalPangram.Text = (cTemp.GetUpperBound(0) + 1) 'rS.Close() nHal = 1 Call ShowPangram() End Sub Sub ShowPangram() Dim nIndeks As Integer rboP1.Checked = False rboP2.Checked = False rboP3.Checked = False rboP4.Checked = False rboP5.Checked = False lblIsi1.Text = "" lblIsi2.Text = "" lblIsi3.Text = "" lblIsi4.Text = "" lblIsi5.Text = "" nIndeks = (nHal - 1) * 5 If nIndeks + 1 <= cArrPangram.GetUpperBound(0) Then lblIsi1.Text = cArrPangram(nIndeks + 1) cArrPangram(nIndeks + 2) If nIndeks + 3 <= cArrPangram.GetUpperBound(0) Then lblIsi3.Text = cArrPangram(nIndeks + 3) If nIndeks + 4 <= cArrPangram.GetUpperBound(0) Then lblIsi4.Text = cArrPangram(nIndeks + 4) If nIndeks + 5 <= cArrPangram.GetUpperBound(0) Then lblIsi5.Text = cArrPangram(nIndeks + 5) lblHalaman.Text = "Halaman : " & nHal & " / " & nTotalHal End Sub Private Sub lnkKembali_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles lnkKembali.LinkClicked nHal = nHal - 1 If nHal <= 1 Then lnkKembali.Enabled = False lnkLanjut.Enabled = True Else lnkKembali.Enabled = True lnkLanjut.Enabled = True End If Call ShowPangram() End Sub Private Sub lnkLanjut_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles lnkLanjut.LinkClicked nHal = nHal + 1 If nHal >= nTotalHal Then lnkKembali.Enabled = True lnkLanjut.Enabled = False Else lnkKembali.Enabled = True lnkLanjut.Enabled = True End If Call ShowPangram() End Sub Private Sub lnkHapus_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles lnkHapus.LinkClicked Dim cTeks As String = "" If rboP1.Checked = True Then cTeks = lblIsi1.Text

  ElseIf rboP2.Checked = True Then cTeks = lblIsi2.Text ElseIf rboP3.Checked = True Then cTeks = lblIsi3.Text ElseIf rboP4.Checked = True Then cTeks = lblIsi4.Text cTeks = lblIsi5.Text End If If cTeks = "" Then MsgBox("Tidak ada kalimat pangram yang dipilih !", MsgBoxStyle.Critical) Else strSQL = "Delete From Pangram Where Kalimat = '" & cTeks & "'" oConn.Execute(strSQL) End If Call LoadPangram() End Sub Private Sub lnkEdit_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles lnkEdit.LinkClicked Dim cTeks As String = "" If rboP1.Checked = True Then cTeks = lblIsi1.Text ElseIf rboP2.Checked = True Then cTeks = lblIsi2.Text ElseIf rboP3.Checked = True Then cTeks = lblIsi3.Text ElseIf rboP4.Checked = True Then cTeks = lblIsi4.Text ElseIf rboP5.Checked = True Then cTeks = lblIsi5.Text End If If cTeks = "" Then Else With frmInputPangram .cTeksPangram1 = cTeks .txtPangram.Text = cTeks .ShowDialog() End With End If Call LoadPangram() End Sub Private Sub lnkSet_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles lnkSet.LinkClicked Dim cTeks As String = "" If rboP1.Checked = True Then cTeks = lblIsi1.Text

  ElseIf rboP2.Checked = True Then cTeks = lblIsi2.Text ElseIf rboP3.Checked = True Then cTeks = lblIsi3.Text ElseIf rboP4.Checked = True Then cTeks = lblIsi4.Text cTeks = lblIsi5.Text End If cPangram = cTeks Me.Close() End Sub Private Sub cboFilter_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cboFilter.SelectedIndexChanged Call cboFilter_TextChanged(sender, e) End Sub Private Sub cboFilter_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles cboFilter.TextChanged nHal = 1 Call LoadPangram() Call ShowPangram() End Sub End Class Public Class frmPerbandingan Dim Original As Bitmap Dim Original1 As Bitmap Dim nMax As Integer Private Sub lnkTutup_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles lnkTutup.LinkClicked Me.Close() End Sub Private Sub lnkBuka_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles lnkBuka.LinkClicked If ofdOldFile.ShowDialog() = Windows.Forms.DialogResult.OK Then Dim bm As New Bitmap(ofdOldFile.FileName) Dim nWarna As Color 'Set citra ke variabel Original = bm picCitraAsli.BackgroundImage = bm picCitraAsli.BackgroundImageLayout = ImageLayout.Stretch 'Simpan warna piksel ke array originalArray = Nothing ReDim originalArray(Original.Height - 1, Original.Width - 1, 2) For j = 0 To Original.Height - 1 For i = 0 To Original.Width - 1 If j <= bm.Height - 1 And i <= bm.Width - 1 Then nWarna = bm.GetPixel(i, j) originalArray(j, i, 0) = nWarna.R originalArray(j, i, 1) = nWarna.G originalArray(j, i, 2) = nWarna.B Else originalArray(j, i, 0) = 255 originalArray(j, i, 2) = 255 End If Next Next End If End Sub Private Sub lnkBuka1_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles lnkBuka1.LinkClicked If ofdOldFile.ShowDialog() = Windows.Forms.DialogResult.OK Then Dim bm As New Bitmap(ofdOldFile.FileName) Dim nWarna As Color 'Set citra ke variabel Original1 = bm picCitraUnScrambling.BackgroundImage = bm picCitraUnScrambling.BackgroundImageLayout = ImageLayout.Stretch 'Simpan warna piksel ke array originalArray1 = Nothing ReDim originalArray1(Original1.Height - 1, Original1.Width - 1, 2) For j = 0 To Original1.Height - 1 For i = 0 To Original1.Width - 1 If j <= bm.Height - 1 And i <= bm.Width - 1 Then nWarna = bm.GetPixel(i, j) originalArray1(j, i, 0) = nWarna.R originalArray1(j, i, 1) = nWarna.G originalArray1(j, i, 2) = nWarna.B Else originalArray1(j, i, 0) = 255 originalArray1(j, i, 1) = 255 originalArray1(j, i, 2) = 255 End If Next Next End If End Sub Private Sub lnkBandingkan_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles lnkBandingkan.LinkClicked Dim i As Integer Dim j As Integer Dim nSama As Integer Dim nTidak As Integer Dim nTotal As Integer

  If Original Is Nothing Then MsgBox("Masukkan Citra Asli Terlebih Dahulu") Exit Sub End If If Original1 Is Nothing Then Exit Sub End If lblUkuran1.Text = "Ukuran : " & Original.Width & " x " & Original.Height lblUkuran2.Text = "Ukuran : " & Original1.Width & " x " & Original1.Height 'Perbandingan If Original.Width = Original1.Width And Original.Height = Original1.Height Then For j = 0 To Original.Height - 1 For i = 0 To Original.Width - 1 If originalArray(j, i, 0) = originalArray1(j, i, 0) And _ originalArray(j, i, 1) = originalArray1(j, i, 1) And _ originalArray(j, i, 2) = originalArray1(j, i, 2) Then nSama += 1 Else nTidak += 1 End If Next Next nTotal = nSama + nTidak lblSama.Text = nSama lblBerbeda.Text = nTidak lblTotal.Text = nTotal lblMirip.Text = Math.Round(nSama * 100 / nTotal, 2) Else MsgBox("Ukuran citra tidak sama !", MsgBoxStyle.Critical) End If End Sub End Class Public Class frmTempel Private Sub lnkSimpan_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles lnkSimpan.LinkClicked frmTempelSimpan.ShowDialog() End Sub Private Sub lnkProses_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles lnkProses.LinkClicked If txtPassword.Text.Trim.Length < 6 Then MsgBox("Panjang password minimal 6 karakter !", MsgBoxStyle.Critical)

  Exit Sub End If 'If PicOriginal.Height < 100 Or PicOriginal.Width < 100 Then ' MsgBox("Ukuran citra asli minimal 100 x 100 !", MsgBoxStyle.Critical) 'End If If PicOriginal.Height > 1000 Or PicOriginal.Width > 1000 Then MsgBox("Ukuran citra asli maksimal 1000 x 1000 !", MsgBoxStyle.Critical) Exit Sub End If If txtPangram.Text.Trim = "" Then MsgBox("Pangram masih kosong !", MsgBoxStyle.Critical) Exit Sub End If If rtb1.Text.Trim = "" Then MsgBox("Pesan masih kosong !", MsgBoxStyle.Critical) Exit Sub End If If txtPassword.Text = txtVerifikasi.Text Then '-------------------- ' Proses penempelan '-------------------- '1. Text Stego Dim cStego As String = TextSteganography(rtb1.Text.Trim, txtPangram.Text, True) If cStego = "-" Then MsgBox("Kalimat pangram tidak dapat menyimpan pesan rahasia !", MsgBoxStyle.Critical) Exit Sub End If '2. LCG Dim cArrNilai() As String = Split(cStego, ";") Dim cHash As String = Kiri(SHA(txtPassword.Text), 8) Dim nHash As Double = FHex2Dec(cHash) Dim nArrX() As Double = LCG(nHash, cArrNilai.Count * 2, , , PicOriginal.Width * PicOriginal.Height) 'Cek apakah password mampu menghasilkan jumlah titik yang mencukupi untuk menempelkan pesan rahasia If IsSame(nArrX) Then MsgBox("Password yang dimasukkan tidak mampu menempelkan pesan pada citra !", MsgBoxStyle.Critical) lnkSimpan.Enabled = False Exit Sub End If '3. Tempel Dim i As Integer

  Dim x As Integer Dim y As Integer Dim nArrSEED(cArrNilai.GetUpperBound(0)) As Integer Dim nArrOFFSET(cArrNilai.GetUpperBound(0)) As Integer Dim cTemp() As String Dim cBit As String Dim cBitG As String Dim cBitB As String Dim nIndeksSEED As Integer = 0 Dim nIndeksOFFSET As Integer = 0 Dim cBitWarna As String 'Ambil nilai SEED dan OFFSET For i = 0 To cArrNilai.GetUpperBound(0) cTemp = Split(cArrNilai(i), ",") nArrSEED(i) = CInt(0 & cTemp(0)) nArrOFFSET(i) = CInt(0 & cTemp(1)) Next 'Tempel nilai SEED & OFFSET berdasarkan pada posisi nArrX PicResult = New Bitmap(PicOriginal.Width, PicOriginal.Height, System.Drawing.Imaging.PixelFormat.Format32bppArgb) originalArray1 = originalArray For i = 1 To nArrX.GetUpperBound(0) If i Mod 2 = 1 Then 'SEED cBit = FDec2Biner(nArrSEED(nIndeksSEED), 9) nIndeksSEED += 1 Else 'OFFSET cBit = FDec2Biner(nArrOFFSET(nIndeksOFFSET), 9) nIndeksOFFSET += 1 End If x = nArrX(i) Mod PicOriginal.Width y = nArrX(i) \ PicOriginal.Width 'Sisip nilai bit ke dalam bit warna piksel cBitR = Mid(cBit, 1, 3) cBitG = Mid(cBit, 4, 3) cBitB = Mid(cBit, 7, 3) cBitWarna = FDec2Biner(originalArray(y, x, 0), 8) originalArray1(y, x, 0) = FBiner2Dec(Kiri(cBitWarna, 5) & cBitR) cBitWarna = FDec2Biner(originalArray(y, x, 1), 8) originalArray1(y, x, 1) = FBiner2Dec(Kiri(cBitWarna, 5) & cBitG) cBitWarna = FDec2Biner(originalArray(y, x, 2), 8) originalArray1(y, x, 2) = FBiner2Dec(Kiri(cBitWarna, 5) & cBitB) Next

  'Sisipkan jumlah titik yang digunakan pada piksel 0 dan piksel

  1 Dim nJlh As Integer = nArrX.GetUpperBound(0) cBit = FDec2Biner(nJlh, 18) For i = 0 To 1 cBitR = Mid(cBit, i * 9 + 1, 3) originalArray1(0, i, 0) = FBiner2Dec(Kiri(cBitWarna, 5) & cBitR) cBitG = Mid(cBit, i * 9 + 4, 3) cBitWarna = FDec2Biner(originalArray(0, i, 1), 8) originalArray1(0, i, 1) = FBiner2Dec(Kiri(cBitWarna, 5) & cBitG) cBitB = Mid(cBit, i * 9 + 7, 3) cBitWarna = FDec2Biner(originalArray(0, i, 2), 8) originalArray1(0, i, 2) = FBiner2Dec(Kiri(cBitWarna, 5) & cBitB) Next 'Susun ulang citra hasil For j = 0 To PicOriginal.Height - 1 For i = 0 To PicOriginal.Width - 1 'Ambil setiap posisi piksel hasil PicResult.SetPixel(i, j, Color.FromArgb(originalArray1(j, i, 0), originalArray1(j, i, 1), originalArray1(j, i, 2))) Next Next MsgBox("Proses penempelan pesan telah selesai dilakukan !" & vbCrLf & _ "Klik link simpan untuk menyimpan hasil !", MsgBoxStyle.Information) lnkSimpan.Enabled = True Else MsgBox("Data password dan verifikasi password tidak sama !", MsgBoxStyle.Critical) Exit Sub End If End Sub Private Sub lnkBuka_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles lnkBuka.LinkClicked If ofdOldFile.ShowDialog() = Windows.Forms.DialogResult.OK Then Dim bm As New Bitmap(ofdOldFile.FileName) Dim nWarna As Color lblLokasi.Text = ofdOldFile.FileName 'Set citra ke variabel PicOriginal = bm picCitra.BackgroundImage = bm picCitra.BackgroundImageLayout = ImageLayout.Stretch lblUkuran.Text = PicOriginal.Width & " x " & PicOriginal.Height

  'Simpan warna piksel ke array originalArray = Nothing ReDim originalArray(PicOriginal.Height, PicOriginal.Width, 2) For j = 0 To PicOriginal.Height - 1 For i = 0 To PicOriginal.Width - 1 nWarna = PicOriginal.GetPixel(i, j) originalArray(j, i, 1) = nWarna.G originalArray(j, i, 2) = nWarna.B Next Next End If End Sub Private Sub btnPilih_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPilih.Click cPangram = txtPangram.Text frmPangram.lnkSet.Visible = True frmPangram.ShowDialog() If cPangram <> "" Then txtPangram.Text = cPangram End If End Sub Private Sub lnkX_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles lnkX.LinkClicked Me.Close() End Sub Private Sub frmTempel_FormClosed(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosedEventArgs) Handles Me.FormClosed Me.Dispose() End Sub Private Sub lnkLaporan_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles lnkLaporan.LinkClicked With frmLaporan .rtb1.Text = strLap .ShowDialog() End With End Sub Private Sub frmTempel_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load strLap = "" End Sub End Class Public Class frmTempelSimpan Private Sub lnkBatal_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles lnkBatal.LinkClicked Me.Close() End Sub

  Private Sub frmTempelSimpan_FormClosed(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosedEventArgs) Handles Me.FormClosed Me.Dispose() End Sub As System.EventArgs) Handles MyBase.Load rtb1.Text = cPangram End Sub Private Sub btnCitra_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCitra.Click dlgSavePicture.Filter = "Graphics Files|*.bmp;*.jpg;*.jpeg|All Files|*.*" If dlgSavePicture.ShowDialog() = Windows.Forms.DialogResult.OK Then 'Simpan citra hasil enkripsi txtFileCitra.Text = dlgSavePicture.FileName End If End Sub Private Sub btnPangram_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPangram.Click With SFD .InitialDirectory = My.Application.Info.DirectoryPath .FileName = "" If .ShowDialog() = Windows.Forms.DialogResult.OK Then txtFilePangram.Text = .FileName End If End With End Sub Private Sub lnkSimpan_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles lnkSimpan.LinkClicked Dim i As Byte If txtFileCitra.Text.Trim <> "" Then Try PicResult.Save(txtFileCitra.Text) MessageBox.Show("Citra Tersimpan !", "Simpan Citra", MessageBoxButtons.OK, MessageBoxIcon.Information) Catch ex As Exception MessageBox.Show(ex.Message) End Try Else MessageBox.Show("Nama file citra hasil masih kosong !", "Simpan Citra", MessageBoxButtons.OK, MessageBoxIcon.Warning) End If If txtFilePangram.Text = "" Then MessageBox.Show("Nama file pangram masih kosong !", "Simpan Pangram", MessageBoxButtons.OK, MessageBoxIcon.Warning) Else For i = 0 To 1 rtb1.SaveFile(txtFilePangram.Text, RichTextBoxStreamType.TextTextOleObjs)

  Next MessageBox.Show("Pangram Tersimpan !", "Simpan Pangram", MessageBoxButtons.OK, MessageBoxIcon.Information) Me.Close() End If End Class Public Class frmTeori Public cID As String Public cName As String Public nPage As Integer Private nP As Integer Private Sub frmTeori_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load nP = 1 picT.BackgroundImage = System.Drawing.Image.FromFile(My.Application.Info.DirectoryPath & "\TEORI\" & cID & "-" & nP & ".jpg") lnkSebelumnya.Enabled = False If nPage = 1 Then lnkSelanjutnya.Enabled = False Else lnkSelanjutnya.Enabled = True End If lblHal.Text = "Halaman " & nP & " dari " & nPage End Sub Private Sub lnkSelanjutnya_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles lnkSelanjutnya.LinkClicked nP = nP + 1 If nP >= nPage Then lnkSebelumnya.Enabled = True lnkSelanjutnya.Enabled = False Else lnkSebelumnya.Enabled = True lnkSelanjutnya.Enabled = True End If lblHal.Text = "Halaman " & nP & " dari " & nPage picT.BackgroundImage = System.Drawing.Image.FromFile(My.Application.Info.DirectoryPath & "\TEORI\" & cID & "-" & nP & ".jpg") End Sub

  Private Sub lnkSebelumnya_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles lnkSebelumnya.LinkClicked nP = nP - 1 lnkSebelumnya.Enabled = False lnkSelanjutnya.Enabled = True Else lnkSebelumnya.Enabled = True lnkSelanjutnya.Enabled = True End If lblHal.Text = "Halaman " & nP & " dari " & nPage picT.BackgroundImage = System.Drawing.Image.FromFile(My.Application.Info.DirectoryPath & "\TEORI\" & cID & "-" & nP & ".jpg") End Sub Private Sub lnkX_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles lnkX.LinkClicked Me.Close() End Sub End Class Module Module1 Public Const strAlfabet1 = "abcdefghijklmnopqrstuvwxyz" Const strAlfabet = "abcdefghijklmnopqrstuvwxyz.,!? " Const strNumerik = "0123456789" Public originalArray(,,) As Byte Public originalArray1(,,) As Byte Public PicOriginal As Bitmap Public PicResult As Bitmap Public cPangram As String Public cPesan As String Public cPwd As String Public strLap As String Public Function IsSame(ByVal X() As Double) As Boolean Dim i As Long Dim j As Long For i = 1 To X.GetUpperBound(0) - 1 For j = i + 1 To X.GetUpperBound(0) If X(i) = X(j) Or X(i) = 0 Or X(j) = 0 Or X(i) = 1 Or X(j) = 1 Then Return True Next

  Next Return False End Function Public Function LCG(ByVal X0 As Double, ByVal N As Long, Optional ByVal Optional ByVal C As Double = 11, Optional ByVal M As Double = 281474976710656) As Array Dim X(N) As Double Dim i As Long X(0) = X0 strLap &= "X(0) = " & X(0) & vbCrLf For i = 1 To N X(i) = (A * X(i - 1) + C) Mod M strLap &= "X(" & i & ") = " & A & " * X(" & i - 1 & ") + " & C & " mod " & M & vbCrLf & _ "X(" & i & ") = " & A & " * " & X(i - 1) & " + " & C & " mod " & M & vbCrLf & _ "X(" & i & ") = " & X(i) & vbCrLf & vbCrLf Next Return X End Function Public Function TextSteganography(ByVal Message As String, ByVal Pangram As String, Optional ByVal pbLaporan As Boolean = False) As String Dim n As Integer = Message.Length Dim max_length_pan = Pangram.Length Dim SEED(n) As Integer Dim OFFSET(n) As Integer Dim i As Integer Dim Hasil As String = "" Dim Pos As Integer strLap = "" For i = 1 To n 'Ambil sebuah nilai acak untuk SEED Randomize() SEED(i) = Int(Rnd() * max_length_pan) + 1 If pbLaporan Then strLap &= "Karakter ke-" & i & ": (huruf '" & Mid(Message, i, 1) & "')" & vbCrLf & _ "SEED(" & i & ") = " & SEED(i) & vbCrLf End If 'Cari kemunculan dari karakter-i pada Pangram Pos = InStr(LCase(Pangram), LCase(Message(i - 1))) If Pos = 0 Then 'Error : Karakter-i tidak terdapat pada pangram Return "-" Else OFFSET(i) = FModulus(Pos - SEED(i), max_length_pan)

  If pbLaporan Then strLap &= "OFFSET(" & i & ") = ([Posisi kemunculan pertama dari karakter] - SEED(" & i & "))" & vbCrLf & _ "OFFSET(" & i & ") = (" & Pos & " - " & SEED(i) & ") " & _ max_length_pan, "") & vbCrLf & _ "OFFSET(" & i & ") = " & OFFSET(i) & vbCrLf & vbCrLf End If End If 'Gabungkan nilai SEED dan OFFSET ke Hasil Hasil &= IIf(Hasil = "", "", ";") & SEED(i) & "," & OFFSET(i) Next Return Hasil End Function Public Function ExtractMessage(ByVal Pangram As String, ByVal StringIndex As String, Optional ByVal pbLaporan As Boolean = False) As String Dim Temp() As String Dim Temp1() As String Dim i As Integer Dim Hasil As String = "" Dim Pos As Integer Dim max_length_pan = Pangram.Length Temp = Split(StringIndex, ";") 'Set jumlah nilai SEED & OFFSET Dim n As Integer = Temp.GetUpperBound(0) + 1 Dim SEED(n) As Integer Dim OFFSET(n) As Integer For i = 0 To Temp.GetUpperBound(0) Temp1 = Split(Temp(i), ",") 'Ambil nilai SEED & OFFSET SEED(i + 1) = CInt(Temp1(0)) OFFSET(i + 1) = CInt(0 & Temp1(1)) 'Cari karakter di pangram Pos = FModulus(SEED(i + 1) + OFFSET(i + 1), max_length_pan) If pbLaporan Then strLap &= "SEED(" & i & ") = " & SEED(i) & vbCrLf & _ "OFFSET(" & i & ") = " & OFFSET(i) & vbCrLf & vbCrLf & _ "Pos = (" & SEED(i + 1) & " + " & OFFSET(i + 1) & ") mod " & max_length_pan & vbCrLf & _ "Pos = " & Pos & vbCrLf End If If Pos = 0 Then Pos = max_length_pan

  Hasil &= LCase(Mid(Pangram, Pos, 1)) If pbLaporan Then strLap &= "Karakter ke-" & i + 1 & " = '" & Mid(Pangram, Pos, 1) & "'" & vbCrLf & vbCrLf End If Return Hasil End Function 'Fungsi modulus untuk nilai < 0 Public Function FModulus(ByVal pnValue1 As Double, ByVal pnValue2 As Double) As Double Dim nKali As Double Dim nHasil As Double If pnValue1 < 0 Then nKali = Math.Abs(pnValue1 \ pnValue2) nHasil = pnValue1 + (nKali * pnValue2) nHasil = (nHasil + pnValue2) Mod pnValue2 Else nHasil = pnValue1 Mod pnValue2 End If Return nHasil End Function 'Biner ke desimal Public Function FBiner2Dec(ByVal pcText As String) As Double Dim nLoop As Double Dim nHasil As Double nHasil = 0 'Konversi dari belakang For nLoop = Len(pcText) To 1 Step -1 If Mid(pcText, nLoop, 1) = "1" Then nHasil = nHasil + (2 ^ (Len(pcText) - nLoop)) End If Next nLoop 'Angka Desimal FBiner2Dec = nHasil End Function 'Desimal ke Biner Public Function FDec2Biner(ByVal pnAngka As Double, Optional ByVal pnLength As Double = -1) As String Dim nLoop As Double Dim nHasilBagi As Double Dim nSisaBagi As Double Dim cBiner1 As String Dim cBiner2 As String nHasilBagi = pnAngka cBiner1 = ""

  While nHasilBagi <> 0 nSisaBagi = FMod(nHasilBagi, 2) cBiner1 = cBiner1 & Format(nSisaBagi) 'format = CStr nHasilBagi = FDiv(nHasilBagi, 2) 'div = \ End While If cBiner1 = "" Then cBiner1 = "0" 'Ambil Terbalik cBiner2 = "" For nLoop = Len(cBiner1) To 1 Step -1 cBiner2 = cBiner2 & Mid(cBiner1, nLoop, 1) Next nLoop If pnLength = -1 Then 'Angka Biner FDec2Biner = cBiner2 Else If Len(cBiner2) <= pnLength Then 'Angka Biner Kurang dari pnLength FDec2Biner = FString(pnLength - Len(cBiner2), "0") & cBiner2 Else 'Angka Biner Melebihi pnLength FDec2Biner = Left(cBiner2, pnLength) End If End If End Function 'Operasi modulo untuk bilangan besar Public Function FMod(ByVal pnA1 As Double, ByVal pnA2 As Double) As Double Dim nMod As Double nMod = pnA1 / pnA2 FMod = pnA1 - (pnA2 * Int(nMod)) End Function 'Operasi div untuk bilangan besar Public Function FDiv(ByVal pnA1 As Double, ByVal pnA2 As Double) As Double Dim nDiv As Double nDiv = pnA1 / pnA2 FDiv = Int(nDiv) End Function Public Function FString(ByVal pnValue As Double, ByVal pcChar As String) As String Dim nI As Double Dim cTemp As String cTemp = "" For nI = 1 To pnValue cTemp = cTemp & pcChar Next

  FString = cTemp End Function Public Function IsAlfabet(ByVal pcText As String) As Boolean Dim i As Integer Dim nPos As Integer For i = 1 To pcText.Length cKar = LCase(Mid(pcText, i, 1)) nPos = InStr(strAlfabet, cKar) If nPos = 0 Then 'Bukan alfabet tuh ...

  Return False End If Next Return True End Function Public Function IsAlfaNumerik(ByVal pcText As String) As Boolean Dim i As Integer Dim cKar As String = "" Dim nPos As Integer For i = 1 To pcText.Length cKar = LCase(Mid(pcText, i, 1)) nPos = InStr(strNumerik, cKar) If nPos > 0 Then 'Numerik tuh ...

  Return True End If Next Return False End Function End Module Module Module2 Public Structure word Dim b0 As Byte Dim b1 As Byte Dim b2 As Byte Dim b3 As Byte End Structure Public Function AndW(ByVal w1 As word, ByVal w2 As word) As word AndW.b0 = w1.b0 And w2.b0 AndW.b1 = w1.b1 And w2.b1 AndW.b2 = w1.b2 And w2.b2 AndW.b3 = w1.b3 And w2.b3 End Function

  Public Function OrW(ByVal w1 As word, ByVal w2 As word) As word OrW.b0 = w1.b0 Or w2.b0 OrW.b1 = w1.b1 Or w2.b1 OrW.b2 = w1.b2 Or w2.b2 OrW.b3 = w1.b3 Or w2.b3 End Function Public Function XorW(ByVal w1 As word, ByVal w2 As word) As word XorW.b0 = w1.b0 Xor w2.b0 XorW.b1 = w1.b1 Xor w2.b1 XorW.b2 = w1.b2 Xor w2.b2 XorW.b3 = w1.b3 Xor w2.b3 End Function Public Function NotW(ByVal w As word) As word NotW.b0 = Not w.b0 NotW.b1 = Not w.b1 NotW.b2 = Not w.b2 NotW.b3 = Not w.b3 End Function Public Function AddW(ByVal w1 As word, ByVal w2 As word) As word Dim I As Integer, w As word I = CInt(w1.b3) + w2.b3 w.b3 = I Mod 256 I = CInt(w1.b2) + w2.b2 + (I \ 256) w.b2 = I Mod 256 I = CInt(w1.b1) + w2.b1 + (I \ 256) w.b1 = I Mod 256 I = CInt(w1.b0) + w2.b0 + (I \ 256) w.b0 = I Mod 256 AddW = w End Function Public Function CircShiftLeftW(ByVal w As word, ByVal n As Integer) As word Dim d1 As Double, d2 As Double d1 = WordToDouble(w) d2 = d1 d1 = d1 * (2 ^ n) d2 = d2 / (2 ^ (32 - n)) CircShiftLeftW = OrW(DoubleToWord(d1), DoubleToWord(d2)) End Function Public Function HexToWord(ByVal H As String) As word HexToWord = DoubleToWord(Val("&H" & H & "#")) End Function Public Function DoubleToWord(ByVal n As Double) As word DoubleToWord.b0 = Int(DMod(n, 2 ^ 32) / (2 ^ 24)) DoubleToWord.b1 = Int(DMod(n, 2 ^ 24) / (2 ^ 16)) DoubleToWord.b2 = Int(DMod(n, 2 ^ 16) / (2 ^ 8)) DoubleToWord.b3 = Int(DMod(n, 2 ^ 8)) End Function

  Public Function WordToDouble(ByVal w As word) As Double WordToDouble = (w.b0 * (2 ^ 24)) + (w.b1 * (2 ^ 16)) + (w.b2 * (2 ^ 8)) + w.b3 End Function Double DMod = value - (Int(value / divisor) * divisor) If DMod < 0 Then DMod = DMod + divisor End Function Public Function F(ByVal t As Integer, ByVal B As word, ByVal C As word, ByVal D As word) As word Select Case t Case Is <= 19 F = OrW(AndW(B, C), AndW(NotW(B), D)) Case Is <= 39 F = XorW(XorW(B, C), D) Case Is <= 59 F = OrW(OrW(AndW(B, C), AndW(B, D)), AndW(C, D)) Case Else F = XorW(XorW(B, C), D) End Select End Function Public Function WordToHex(ByVal w As word) As String WordToHex = Hex(w.b0).PadLeft(2, "0") & Hex(w.b1).PadLeft(2, "0") & Hex(w.b2).PadLeft(2, "0") & Hex(w.b3).PadLeft(2, "0") End Function Public Function SHA(ByVal Msg As String) As String Dim w(79) As word Dim WordText, hasil As String Dim k(3) As word Dim h0, h1, h2, h3, h4, inLenW As word Dim a, b, c, d, e, temp As word Dim PadMsg, BlockText As String Dim inLen, NumBlocks, t, i As Integer inLen = Msg.Length inLenW = DoubleToWord(CDbl(inLen) * 8) k(0) = HexToWord("5A827999") k(1) = HexToWord("6ED9EBA1") k(2) = HexToWord("8F1BBCDC") k(3) = HexToWord("CA62C1D6") h0 = HexToWord("67452301") h1 = HexToWord("EFCDAB89") h2 = HexToWord("98BADCFE") h3 = HexToWord("10325476") h4 = HexToWord("C3D2E1F0") a = h0 b = h1 c = h2 d = h3 e = h4

  PadMsg = Msg PadMsg &= Chr(128) PadMsg &= StrDup((128 - (inLen Mod 64) - 9) Mod 64, Chr(0)) PadMsg &= StrDup(4, Chr(0)) PadMsg &= Chr(inLenW.b0) PadMsg &= Chr(inLenW.b2) PadMsg &= Chr(inLenW.b3) NumBlocks = Len(PadMsg) / 64 For i = 0 To NumBlocks - 1 BlockText = Mid$(PadMsg, (i * 64) + 1, 64) For t = 0 To 15 WordText = Mid$(BlockText, (t * 4) + 1, 4) w(t).b0 = Asc(Mid$(WordText, 1, 1)) w(t).b1 = Asc(Mid$(WordText, 2, 1)) w(t).b2 = Asc(Mid$(WordText, 3, 1)) w(t).b3 = Asc(Mid$(WordText, 4, 1)) Next t For t = 16 To 79 w(t) = CircShiftLeftW(XorW(XorW(XorW(w(t - 3), w(t - 8)), w(t - 14)), w(t - 16)), 1) Next t a = h0 b = h1 c = h2 d = h3 e = h4 For t = 0 To 79 temp = AddW(AddW(AddW(AddW(CircShiftLeftW(a, 5), F(t, b, c, d)), e), w(t)), k(t \ 20)) e = d d = c c = CircShiftLeftW(b, 30) b = a a = temp Next t h0 = AddW(h0, a) h1 = AddW(h1, b) h2 = AddW(h2, c) h3 = AddW(h3, d) h4 = AddW(h4, e) Next i hasil = Left(WordToHex(h0) & WordToHex(h1) & WordToHex(h2) & WordToHex(h3) & WordToHex(h4), 8) Return hasil End Function 'Heksa ke desimal Public Function FHex2Dec(ByVal pcText As String) As Double Dim i As Integer

  For i = 1 To Len(pcText) Select Case Mid(pcText, i, 1) Case "1" To "9" : FHex2Dec = FHex2Dec + CDec(Mid(pcText, i, 1)) * 16 ^ (Len(pcText) - i) Case "A", "a" : FHex2Dec = FHex2Dec + 10 * 16 ^ Case "B", "b" : FHex2Dec = FHex2Dec + 11 * 16 ^ (Len(pcText) - i) Case "C", "c" : FHex2Dec = FHex2Dec + 12 * 16 ^ (Len(pcText) - i) Case "D", "d" : FHex2Dec = FHex2Dec + 13 * 16 ^ (Len(pcText) - i) Case "E", "e" : FHex2Dec = FHex2Dec + 14 * 16 ^ (Len(pcText) - i) Case "F", "f" : FHex2Dec = FHex2Dec + 15 * 16 ^ (Len(pcText) - i) End Select Next i End Function Public Function Kiri(ByVal pcText As String, ByVal pnValue As Integer) As String Return Left(pcText, pnValue) End Function Public Function Kanan(ByVal pcText As String, ByVal pnValue As Integer) As String Return Right(pcText, pnValue) End Function End Module Module Module3 'Variabel database 'Koneksi ADO Public oConn As New ADODB.Connection 'SQL Expression dalam bentuk String Public strSQL As String End Module

Dokumen yang terkait

I. Identitas Responden - Pengaruh Stress Kerja, Motivasi Kerja dan Iklim Organisasi Terhadap Keinginan untuk Keluar (Intention to Leave) Karyawan pada PT. Infomedia Nusantara Medan

0 0 19

BAB II TINJAUAN PUSTAKA 2.1 Tinjauan Pustaka 2.1.1 Stress Kerja 2.1.1.1 Pengertian Stress Kerja - Pengaruh Stress Kerja, Motivasi Kerja dan Iklim Organisasi Terhadap Keinginan untuk Keluar (Intention to Leave) Karyawan pada PT. Infomedia Nusantara Medan

0 2 32

BAB I PENDAHULUAN 1.1 Latar Belakang Masalah - Pengaruh Stress Kerja, Motivasi Kerja dan Iklim Organisasi Terhadap Keinginan untuk Keluar (Intention to Leave) Karyawan pada PT. Infomedia Nusantara Medan

0 0 9

Pengaruh Stress Kerja, Motivasi Kerja dan Iklim Organisasi Terhadap Keinginan untuk Keluar (Intention to Leave) Karyawan pada PT. Infomedia Nusantara Medan

0 0 15

BAB II TINJAUAN PUSTAKA 2.1 Kinerja Keuangan 2.1.1 Pengertin Kinerja Keuangan - Pengaruh Capital Adequacy Ratio(CAR), Non Performing Loan (NPL), Operating Ratio (BOPO), dan Loan to Deposit Ratio(LDR) Terhadap Pertumbuhan Laba Pada Perusahaan Perbankan Yan

0 0 15

Pengaruh Capital Adequacy Ratio(CAR), Non Performing Loan (NPL), Operating Ratio (BOPO), dan Loan to Deposit Ratio(LDR) Terhadap Pertumbuhan Laba Pada Perusahaan Perbankan Yang Terdaftar Di Bursa Efek Indonesia

0 0 11

Dukungan Keluarga dalam Pelaksanaan Pijat Oksitosin untuk Meningkatkan Produksi ASI pada Ibu Nifas di Wilayah Kerja Puskesmas Medan Johor

0 0 49

BAB 2 TINJAUAN PUSTAKA 2.1. Keluarga - Dukungan Keluarga dalam Pelaksanaan Pijat Oksitosin untuk Meningkatkan Produksi ASI pada Ibu Nifas di Wilayah Kerja Puskesmas Medan Johor

0 0 19

BAB 1 PENDAHULUAN 1.1. Latar Belakang - Dukungan Keluarga dalam Pelaksanaan Pijat Oksitosin untuk Meningkatkan Produksi ASI pada Ibu Nifas di Wilayah Kerja Puskesmas Medan Johor

0 0 8

Dukungan Keluarga dalam Pelaksanaan Pijat Oksitosin Untuk Meningkatkan Produksi ASI pada Ibu Nifas di Wilayah Kerja Puskesmas Medan Johor

0 0 13