• Tidak ada hasil yang ditemukan

Implementasi Kombinasi Tiny Encryption Algorithm (TEA) Dan Algoritma Least Significant Bit(LSB)Untuk Keamanan File Text

N/A
N/A
Protected

Academic year: 2019

Membagikan "Implementasi Kombinasi Tiny Encryption Algorithm (TEA) Dan Algoritma Least Significant Bit(LSB)Untuk Keamanan File Text"

Copied!
29
0
0

Teks penuh

(1)

LISTING PROGRAM

Public Class Form1

Inherits System.Windows.Forms.Form Dim gambar As Bitmap

Dim PbAs Integer Dim Pc As Integer

Dim rt, vM, vH, vB As Integer Dim kataku(200) As String

Friend WithEventsbtnAmbil As System.Windows.Forms.Button Friend WithEvents Pic2 AsSystem.Windows.Forms.PictureBox Friend WithEvents Button1 AsSystem.Windows.Forms.Button Friend WithEvents Kata AsSystem.Windows.Forms.TextBox

Friend WithEvents ToolStripMenuItem1 AsSystem.Windows.Forms.ToolStripSeparator

Friend

WithEventsFileToolStripMenuItemAsSystem.Windows.Forms.ToolStripMe nuItem

Friend WithEvents Pic1 AsSystem.Windows.Forms.PictureBox Friend WithEvents SFD AsSystem.Windows.Forms.SaveFileDialog Friend WithEvents MenuStrip1 AsSystem.Windows.Forms.MenuStrip Friend WithEvents GroupBox1 AsSystem.Windows.Forms.GroupBox Friend WithEvents K3 AsSystem.Windows.Forms.TextBox

(2)

Friend WithEvents OFD AsSystem.Windows.Forms.OpenFileDialog

Public Sub New() MyBase.New()

InitializeComponent()

End Sub

If disposing Then

If Not (components Is Nothing) Then components.Dispose()

End If End If

MyBase.Dispose(disposing) End Sub

Private components As System.ComponentModel.IContainer

Friend WithEventskeyLabel As System.Windows.Forms.Label Friend WithEventskeyTextBox As System.Windows.Forms.TextBox Friend WithEventsDataLabelAsSystem.Windows.Forms.Label

Friend WithEventsencryptButton As System.Windows.Forms.Button Friend WithEvents Label1 AsSystem.Windows.Forms.Label

Friend WithEventsDataTextBoxAsSystem.Windows.Forms.TextBox Friend WithEventstxtchiper As System.Windows.Forms.TextBox

<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()

Me.keyLabel = New System.Windows.Forms.Label() Me.keyTextBox = New System.Windows.Forms.TextBox() Me.DataLabel = New System.Windows.Forms.Label() Me.encryptButton = New System.Windows.Forms.Button() Me.Label1 = New System.Windows.Forms.Label() Me.DataTextBox = New System.Windows.Forms.TextBox() Me.txtchiper = New System.Windows.Forms.TextBox() Me.btnAmbil = New System.Windows.Forms.Button()

(3)

Me.Kata = New System.Windows.Forms.TextBox()

Me.ToolStripMenuItem1 = New System.Windows.Forms.ToolStripSeparator()

Me.FileToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem()

Me.Pic1 = New System.Windows.Forms.PictureBox() Me.SFD = New System.Windows.Forms.SaveFileDialog()

Me.MenuStrip1 = New System.Windows.Forms.MenuStrip() Me.OFD = New System.Windows.Forms.OpenFileDialog()

Me.GroupBox1 = New System.Windows.Forms.GroupBox() Me.tk = New System.Windows.Forms.TextBox()

Me.K3 = New System.Windows.Forms.TextBox() Me.K1 = New System.Windows.Forms.TextBox() Me.xkata = New System.Windows.Forms.Label()

Me.K2 = New System.Windows.Forms.TextBox() Me.xjumlah = New System.Windows.Forms.Label()

Me.Button3 = New System.Windows.Forms.Button() Me.Button4 = New System.Windows.Forms.Button() Me.Button5 = New System.Windows.Forms.Button() Me.Label2 = New System.Windows.Forms.Label() Me.Button6 = New System.Windows.Forms.Button() Me.Button7 = New System.Windows.Forms.Button() Me.Button8 = New System.Windows.Forms.Button() Me.Button9 = New System.Windows.Forms.Button()

CType(Me.Pic2, System.ComponentModel.ISupportInitialize).BeginInit() CType(Me.Pic1, System.ComponentModel.ISupportInitialize).BeginInit() Me.MenuStrip1.SuspendLayout()

Me.GroupBox1.SuspendLayout() Me.SuspendLayout()

'

'keyLabel '

Me.keyLabel.Location = New System.Drawing.Point(42, 24) Me.keyLabel.Name = "keyLabel"

Me.keyLabel.Size = New System.Drawing.Size(32, 24) Me.keyLabel.TabIndex = 0

Me.keyLabel.Text = "Key"

Me.keyLabel.TextAlign = System.Drawing.ContentAlignment.MiddleCenter '

(4)

'

Me.keyTextBox.Location = New System.Drawing.Point(80, 28) Me.keyTextBox.MaxLength = 16

Me.keyTextBox.Name = "keyTextBox"

Me.keyTextBox.Size = New System.Drawing.Size(104, 20) Me.keyTextBox.TabIndex = 1

Me.keyTextBox.Text = "12345678" '

'DataLabel '

Me.DataLabel.Location = New System.Drawing.Point(37, 69) Me.DataLabel.Name = "DataLabel"

Me.DataLabel.Size = New System.Drawing.Size(88, 16) Me.DataLabel.TabIndex = 2

Me.DataLabel.Text = "Plaintext" '

'encryptButton '

Me.encryptButton.Location = New System.Drawing.Point(40, 318) Me.encryptButton.Name = "encryptButton"

Me.encryptButton.Size = New System.Drawing.Size(72, 28) Me.encryptButton.TabIndex = 4

Me.encryptButton.Text = "Encrypt" '

'Label1 '

Me.Label1.AutoSize = True

Me.Label1.Location = New System.Drawing.Point(42, 209) Me.Label1.Name = "Label1"

Me.Label1.Size = New System.Drawing.Size(54, 13) Me.Label1.TabIndex = 6

Me.Label1.Text = "Chipertext" '

'DataTextBox '

Me.DataTextBox.Location = New System.Drawing.Point(40, 88) Me.DataTextBox.Multiline = True

Me.DataTextBox.Name = "DataTextBox"

(5)

'

'txtchiper '

Me.txtchiper.Location = New System.Drawing.Point(40, 234) Me.txtchiper.Multiline = True

Me.txtchiper.Name = "txtchiper"

Me.txtchiper.Size = New System.Drawing.Size(248, 78) Me.txtchiper.TabIndex = 7

'

'btnAmbil '

Me.btnAmbil.Location = New System.Drawing.Point(431, 473) Me.btnAmbil.Name = "btnAmbil"

Me.btnAmbil.Size = New System.Drawing.Size(117, 29) Me.btnAmbil.TabIndex = 22

Me.btnAmbil.Text = "AMBIL INFORMASI"

Me.btnAmbil.UseVisualStyleBackColor = True '

'Pic2 '

Me.Pic2.Location = New System.Drawing.Point(558, 58) Me.Pic2.Name = "Pic2"

Me.Pic2.Size = New System.Drawing.Size(242, 248)

Me.Pic2.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage

Me.Pic2.TabIndex = 21 Me.Pic2.TabStop = False '

'Button1 '

Me.Button1.Location = New System.Drawing.Point(440, 318) Me.Button1.Name = "Button1"

Me.Button1.Size = New System.Drawing.Size(111, 29) Me.Button1.TabIndex = 20

Me.Button1.Text = "SIMPAN FILE"

Me.Button1.UseVisualStyleBackColor = True '

'Kata '

(6)

Me.Kata.Multiline = True Me.Kata.Name = "Kata"

Me.Kata.ScrollBars = System.Windows.Forms.ScrollBars.Vertical Me.Kata.Size = New System.Drawing.Size(242, 77)

Me.Kata.TabIndex = 14 '

'ToolStripMenuItem1 '

Me.ToolStripMenuItem1.Name = "ToolStripMenuItem1"

Me.ToolStripMenuItem1.Size = New System.Drawing.Size(57, 6) '

'FileToolStripMenuItem '

Me.FileToolStripMenuItem.DropDownItems.AddRange(New

System.Windows.Forms.ToolStripItem() {Me.ToolStripMenuItem1}) Me.FileToolStripMenuItem.Name = "FileToolStripMenuItem"

Me.FileToolStripMenuItem.Size = New System.Drawing.Size(37,20) Me.FileToolStripMenuItem.Text = "exit"

' 'Pic1 '

Me.Pic1.Location = New System.Drawing.Point(310, 58) Me.Pic1.Name = "Pic1"

Me.Pic1.Size = New System.Drawing.Size(242, 248)

Me.Pic1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage

Me.Pic1.TabIndex = 13 Me.Pic1.TabStop = False '

'MenuStrip1 '

Me.MenuStrip1.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.FileToolStripMenuItem})

Me.MenuStrip1.Location = New System.Drawing.Point(0, 0) Me.MenuStrip1.Name = "MenuStrip1"

Me.MenuStrip1.Size = New System.Drawing.Size(808, 24) Me.MenuStrip1.TabIndex = 12

Me.MenuStrip1.Text = "MenuStrip1" '

(7)

'

Me.OFD.FileName = "OpenFileDialog1" '

'GroupBox1 '

Me.GroupBox1.Controls.Add(Me.tk) Me.GroupBox1.Controls.Add(Me.K3) Me.GroupBox1.Controls.Add(Me.K1) Me.GroupBox1.Controls.Add(Me.xkata) Me.GroupBox1.Controls.Add(Me.K2) Me.GroupBox1.Controls.Add(Me.xjumlah)

Me.GroupBox1.Location = New System.Drawing.Point(37, 738) Me.GroupBox1.Name = "GroupBox1"

Me.GroupBox1.Size = New System.Drawing.Size(738, 199) Me.GroupBox1.TabIndex = 24

Me.GroupBox1.TabStop = False Me.GroupBox1.Text = "GroupBox1" '

'tk '

Me.tk.Location = New System.Drawing.Point(580, 28) Me.tk.Multiline = True

Me.tk.Name = "tk"

Me.tk.ScrollBars = System.Windows.Forms.ScrollBars.Vertical Me.tk.Size = New System.Drawing.Size(152, 139)

Me.tk.TabIndex = 26 '

'K3 '

Me.K3.Location = New System.Drawing.Point(214, 66) Me.K3.Multiline = True

Me.K3.Name = "K3"

Me.K3.ScrollBars = System.Windows.Forms.ScrollBars.Vertical Me.K3.Size = New System.Drawing.Size(164, 101)

Me.K3.TabIndex = 24 '

'K1 '

(8)

Me.K1.Name = "K1"

Me.K1.ScrollBars = System.Windows.Forms.ScrollBars.Vertical Me.K1.Size = New System.Drawing.Size(146, 138)

Me.K1.TabIndex = 20 '

'xkata '

Me.xkata.AutoSize = True

Me.xkata.Location = New System.Drawing.Point(105, 25) Me.xkata.Name = "xkata"

Me.xkata.Size = New System.Drawing.Size(39, 13) Me.xkata.TabIndex = 21

Me.xkata.Text = "Label1" '

'K2 '

Me.K2.Location = New System.Drawing.Point(12, 62) Me.K2.Multiline = True

Me.K2.Name = "K2"

Me.K2.ScrollBars = System.Windows.Forms.ScrollBars.Vertical Me.K2.Size = New System.Drawing.Size(177, 105)

Me.K2.TabIndex = 23 '

'xjumlah '

Me.xjumlah.AutoSize = True

Me.xjumlah.Location = New System.Drawing.Point(273, 25) Me.xjumlah.Name = "xjumlah"

Me.xjumlah.Size = New System.Drawing.Size(39, 13) Me.xjumlah.TabIndex = 22

Me.xjumlah.Text = "Label1" '

'Button3 '

Me.Button3.Location = New System.Drawing.Point(145, 424) Me.Button3.Name = "Button3"

Me.Button3.Size = New System.Drawing.Size(75, 27) Me.Button3.TabIndex = 26

Me.Button3.Text = "Sisipkan"

(9)

'

'Button4 '

Me.Button4.Location = New System.Drawing.Point(304, 515) Me.Button4.Name = "Button4"

Me.Button4.Size = New System.Drawing.Size(242, 28) Me.Button4.TabIndex = 27

Me.Button4.Text = "Kirim Kata keChipertext" Me.Button4.UseVisualStyleBackColor = True '

'Button5 '

Me.Button5.Location = New System.Drawing.Point(304, 318) Me.Button5.Name = "Button5"

Me.Button5.Size = New System.Drawing.Size(111, 28) Me.Button5.TabIndex = 28

Me.Button5.Text = "BUKA GAMBAR"

Me.Button5.UseVisualStyleBackColor = True '

'Label2 '

Me.Label2.BackColor = System.Drawing.SystemColors.ButtonShadow

Me.Label2.Location = New System.Drawing.Point(303, 53) Me.Label2.Name = "Label2"

Me.Label2.Size = New System.Drawing.Size(503, 259) Me.Label2.TabIndex = 29

'

'Button6 '

Me.Button6.Location = New System.Drawing.Point(695, 319) Me.Button6.Name = "Button6"

Me.Button6.Size = New System.Drawing.Size(111, 28) Me.Button6.TabIndex = 30

Me.Button6.Text = "Kembali"

Me.Button6.UseVisualStyleBackColor = True '

'Button7 '

(10)

Me.Button7.Name = "Button7"

Me.Button7.Size = New System.Drawing.Size(75, 23) Me.Button7.TabIndex = 31

Me.Button7.Text = "Button7"

Me.Button7.UseVisualStyleBackColor = True '

'Button8 '

Me.Button8.Location = New System.Drawing.Point(196, 480) Me.Button8.Name = "Button8"

Me.Button8.Size = New System.Drawing.Size(75, 23) Me.Button8.TabIndex = 32

Me.Button8.Text = "Button8"

Me.Button8.UseVisualStyleBackColor = True '

'Button9 '

Me.Button9.Location = New System.Drawing.Point(40, 169) Me.Button9.Name = "Button9"

Me.Button9.Size = New System.Drawing.Size(110, 23) Me.Button9.TabIndex = 33

Me.Button9.Text = "Buka File Text"

Me.Button9.UseVisualStyleBackColor = True '

'Form1 '

Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13) Me.BackColor = System.Drawing.Color.WhiteSmoke

Me.ClientSize = New System.Drawing.Size(808, 386) Me.Controls.Add(Me.Button9)

(11)

Me.Controls.Add(Me.Kata) Me.Controls.Add(Me.Pic1)

Me.Controls.Add(Me.MenuStrip1) Me.Controls.Add(Me.txtchiper) Me.Controls.Add(Me.Label1)

Me.Controls.Add(Me.encryptButton) Me.Controls.Add(Me.DataTextBox) Me.Controls.Add(Me.DataLabel) Me.Controls.Add(Me.keyTextBox) Me.Controls.Add(Me.keyLabel) Me.Controls.Add(Me.Label2)

Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Fixed3D Me.MaximizeBox = False

Me.Name = "Form1"

Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen

Me.Text = "Enkripsi"

CType(Me.Pic2, System.ComponentModel.ISupportInitialize).EndInit() CType(Me.Pic1, System.ComponentModel.ISupportInitialize).EndInit() Me.MenuStrip1.ResumeLayout(False)

Me.MenuStrip1.PerformLayout() Me.GroupBox1.ResumeLayout(False) Me.GroupBox1.PerformLayout() Me.ResumeLayout(False)

Me.PerformLayout()

End Sub

#End Region

Private Sub encryptButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles encryptButton.Click

'Me.decryptButton.Enabled = False

Dim X AsXTeaCrypto.XTea = New XTeaCrypto.XTea

Me.txtchiper.Text = X.encrypt(Me.DataTextBox.Text, Me.keyTextBox.Text)

(12)

For a = 1 To Len(txtchiper.Text)

b = Microsoft.VisualBasic.Mid(txtchiper.Text, a, 1) tk.Text = tk.Text&DesToBin(Asc(b))

'Kata.Text = Kata.Text& b Next

Kata.Text = txtchiper.Text End Sub

Private Sub decryptButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)

'Me.encryptButton.Enabled = False

Dim X AsXTeaCrypto.XTea = New XTeaCrypto.XTea

Me.DataTextBox.Text = X.decrypt(Me.txtchiper.Text, Me.keyTextBox.Text)

'Me.encryptButton.Enabled = True ' Me.decryptButton.Enabled = False

End Sub

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

Pic1.Image = Nothing Pic2.Image = Nothing Kata.Text = ""

txtchiper.Text = "" DataTextBox.Text = "" End Sub

Private Sub OpenFileToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)

OFD.Filter = "JPG |*.jpg|BMP| *.bmp|TIF |*.tif" OFD.ShowDialog()

If OFD.FileName = "" Then Exit Sub

Pic1.Image = Image.FromFile(OFD.FileName) gambar = New Bitmap(Pic1.Image)

Me.Text = gambar.Height&" x " &gambar.Width End Sub

Function KataToBiner(ByVal txt As String) As String Dim nDes As Long

(13)

Dim nBin As String Dim chex As String Dim i As Double Dim ckata As String KataBiner = ""

For i = 1 To Len(txt) ckata = Mid(txt, i, 1)

nDes = Asc(ckata) chex = Hex(nDes)

nBin = HEXA_2_BIN(chex) KataBiner = KataBiner&nBin Next

KataToBiner = KataBiner End Function

Function HEXA_2_BIN(ByRef SHEX_DIGIT As String) As String Dim xBin As String

Dim xbin2 As String Dim xkata As String Dim i As Integer

For i = 1 To Len(SHEX_DIGIT) xBin = ""

xkata = Mid(SHEX_DIGIT, i, 1)

Select Case UCase(xkata) Case "0"

xBin = "0000"

Case "1" xBin = "0001"

Case "2" xBin = "0010"

Case "3" xBin = "0011"

Case "4" xBin = "0100"

Case "5" xBin = "0101"

Case "6" xBin = "0110"

Case "7" xBin = "0111"

(14)

xBin = "1000"

Case "9" xBin = "1001"

Case "A" xBin = "1010"

Case "B" xBin = "1011"

Case "C" xBin = "1100"

Case "D" xBin = "1101"

Case "E" xBin = "1110"

Case "F" xBin = "1111"

Case "h", "H" xBin = ""

Case Else xBin = ""

End Select

xbin2 = xbin2 + xBin Next

HEXA_2_BIN = xbin2 End Function

Function DesimalToBiner(ByRefJumlah As Long) As String Dim nBin As String

Dim chex As String chex = Hex(Jumlah)

nBin = HEXA_2_BIN(chex)

If Jumlah<= 15 Then nBin = "0000" &nBin DesimalToBiner = nBin

End Function

Function toLSB(ByValxBin As String, ByValxhuruf As String) As String

If xhuruf = "" Then toLSB = xBin

Else

toLSB = Mid(xBin, 1, 7) &xhuruf End If

(15)

Public Function toDecimal(ByValInptB As Object) As Object Dim b, D, C, A, e, f, baseB As Object

baseB = 2

b = InptB e = 0 f = 0 Do

A = Microsoft.VisualBasic.Right(b, 1)

b = Microsoft.VisualBasic.Left(b, Len(b) - 1)

C = baseB ^ f D = A * C e = e + D

f = f + 1 Loop Until b = "" toDecimal = e

End Function

Function GetJumlahData() As Double Dim xpix As Long

Dim jBit As String jBit = ""

Pic1.Image = gambar Pc = 0

For Pb = 0 Togambar.Width - 1 vM = gambar.GetPixel(Pb, Pc).R

vH = gambar.GetPixel(Pb, Pc).G vB = gambar.GetPixel(Pb, Pc).B

jBit = jBit&Microsoft.VisualBasic.Mid((DesimalToBiner(vM)), 8, 1) & _ Microsoft.VisualBasic.Mid((DesimalToBiner(vH)), 8, 1) & _

Microsoft.VisualBasic.Mid((DesimalToBiner(vB)), 8, 1) xpix = xpix + 1

If xpix> 3 Then Exit For Next

GetJumlahData = toDecimal(Mid(jBit, 1, 8)) 'MsgBox(GetJumlahData)

End Function

Function GetPesan(ByValpesan As String, ByValjBit As Long) As String

(16)

Dim xbyte As String Dim i, j As Integer GetPesan = ""

kata = ""

For i = 9 TojBit Step 8 xbyte = Mid(pesan, i, 8)

j = j + 8

kata = kata &Chr(toDecimal(xbyte)) Next i

GetPesan = kata End Function

Function GETPESANAN(ByValpesan As String, ByValjBit As Long) As String

Dim kata As String Dim xbyte As String Dim i, j As Integer GETPESANAN = "" kata = ""

For i = 9 TojBit Step 8 xbyte = Mid(pesan, i, 8)

j = j + 8

kata = kata &Chr(toDecimal(xbyte)) Next i

GETPESANAN = kata End Function

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

Dim X AsXTeaCrypto.XTea = New XTeaCrypto.XTea Dim sijones As String = ""

'sijones = X.decrypt(Me.Kata.Text, "12345678") sijones = X.decrypt(Me.Kata.Text, keyTextBox.Text) 'xkata.Text = Len(Kata.Text)

'K1.Text = KataToBiner(Kata.Text) 'xjumlah.Text = Len(K1.Text) If Len(Trim(Kata.Text)) = 0 Then

MsgBox("Kata yang maudisisipkanpadagambartidakada!", vbCritical, "Error")

(17)

Dim xpx As Long Dim xpix As Long Dim i As Long

Dim xhuruf1 As String Dim xhuruf2 As String Dim xhuruf3 As String xkata.Text = Len(sijones)

K1.Text = DesimalToBiner(Len(sijones)) &KataToBiner(sijones) 'K1.Text = DesimalToBiner(Len(Kata.Text))

'K1.Text = DesimalToBiner(Len(Kata.Text)) &tk.Text xjumlah.Text = Len(K1.Text)

xpx = Int(Len(K1.Text) / 3) Me.Refresh()

'K2.Text = "" 'K3.Text = ""

Pic2.Image = gambar i = 1

For Pc = 0 Togambar.Height - 1 For Pb = 0 Togambar.Width - 1 vM = gambar.GetPixel(Pb, Pc).R

vH = gambar.GetPixel(Pb, Pc).G vB = gambar.GetPixel(Pb, Pc).B

'K2.Text = K2.Text & " " &DesimalToBiner(vM) & " " &DesimalToBiner(vH) & " " &DesimalToBiner(vB) &vbCrLf

xhuruf1 = Mid(K1.Text, i, 1) xhuruf2 = Mid(K1.Text, i + 1, 1) xhuruf3 = Mid(K1.Text, i + 2, 1)

' K3.Text = K3.Text & " " &toLSB(DesimalToBiner(vM), xhuruf1) & " " &toLSB(DesimalToBiner(vH), xhuruf2) & " " &toLSB(DesimalToBiner(vB), xhuruf3) &vbCrLf

vM = toDecimal(toLSB(DesimalToBiner(vM), xhuruf1)) vH = toDecimal(toLSB(DesimalToBiner(vH), xhuruf2)) vB = toDecimal(toLSB(DesimalToBiner(vB), xhuruf3)) gambar.SetPixel(Pb, Pc, Color.FromArgb(vM, vH, vB)) xpix = xpix + 1

If xpix>xpx Then Exit For i = i + 3

(18)

Next

'bagianmenyimpan SFD.Filter = "BMP|*.bmp" SFD.ShowDialog()

If SFD.FileName = "" Then Exit Sub 'If SFD.FilterIndex = 1 Then

' gambar.Save(SFD.FileName + ".jpg", System.Drawing.Imaging.ImageFormat.Jpeg)

' End If

If SFD.FilterIndex = 1 Then

gambar.Save(SFD.FileName, System.Drawing.Imaging.ImageFormat.Bmp) End If

End Sub

Private Sub btnAmbil_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAmbil.Click

Dim X AsXTeaCrypto.XTea = New XTeaCrypto.XTea Dim sihelen As String = ""

Dim xpx As Long Dim xpix As Long

xkata.Text = GetJumlahData()

xpx = Int(((Val(xkata.Text) + 1) * 8) / 3) 'bagianmengambl pixel

Pic1.Image = gambar K2.Text = ""

For Pc = 0 Togambar.Height - 1 For Pb = 0 Togambar.Height - 1 vM = gambar.GetPixel(Pb, Pc).R

vH = gambar.GetPixel(Pb, Pc).G vB = gambar.GetPixel(Pb, Pc).B

K2.Text = K2.Text &Microsoft.VisualBasic.Mid((DesimalToBiner(vM)), 8, 1) & _

Microsoft.VisualBasic.Mid((DesimalToBiner(vH)), 8, 1) & _ Microsoft.VisualBasic.Mid((DesimalToBiner(vB)), 8, 1) xpix = xpix + 1

If xpix>xpx Then Exit For K2.Refresh()

(19)

'sihelen = X.encrypt(GetPesan(K2.Text, (xkata.Text + 1) * 8), "12345678")

sihelen = X.encrypt(GetPesan(K2.Text, (xkata.Text + 1) * 8), keyTextBox.Text)

Kata.Text = sihelen

'txtchiper.Text = GETPESANAN(K2.Text, (xkata.Text + 1) * 8) txtchiper.Text = sihelen

End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)

Pic1.Image = Nothing Pic2.Image = Nothing Kata.Text = ""

txtchiper.Text = "" DataTextBox.Text = "" End Sub

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click

Kata.Text = txtchiper.Text End Sub

Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click

txtchiper.Text = Kata.Text End Sub

Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click

OFD.Filter = "JPG |*.jpg|BMP| *.bmp|TIF |*.tif" OFD.ShowDialog()

If OFD.FileName = " " Then Exit Sub

Pic1.Image = Image.FromFile(OFD.FileName) gambar = New Bitmap(Pic1.Image)

(20)

Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click

Me.Close() End Sub

Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button7.Click

Dim a As Integer, b As String tk.Text = ""

For a = 1 To Len(txtchiper.Text)

b = Microsoft.VisualBasic.Mid(txtchiper.Text, a, 1) tk.Text = tk.Text&DesToBin(Asc(b))

'Kata.Text = Kata.Text& b Next

End Sub

Public Function DesToBin(ByValNDesimal As Long) As String Dim C As Byte

Dim D As Long Dim NilaiAs String Dim pjg As Integer Dim bitawal As String Dim a As Integer

On Error GoToErrorHandler D = (2 ^ 31) - 1

While D > 0

If NDesimal - D >= 0 Then NDesimal = NDesimal - D

Nilai = Nilai& "1" Else

If Val(Nilai) > 0 Then Nilai = Nilai& "0" End If

D = D / 2 End While bitawal = ""

If Len(Trim(Nilai)) < 8 Then pjg = 8 - Len(Nilai)

For a = 1 Topjg bitawal = bitawal& "0" Next

(21)

DesToBin = bitawal&Nilai Exit Function ErrorHandler:

DesToBin = 0 End Function

Private Sub Button8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button8.Click

MsgBox(Len(K1.Text) & "-" & Len(tk.Text)) End Sub

Function revisikata(ByVal key As String) As String Dim a As Integer, k As String, hasil As String For a = 1 To Len(key)

k = Microsoft.VisualBasic.Mid(key, a, 1) If k = "?" Then

Else hasil = hasil& k End If Next

revisikata = hasil End Function

Sub LoadFileNotepad()

Dim i As Integer = FreeFile() Dim s As String, s1 As String s = "" : s1 = ""

'

OFD.Filter = "txt |*.txt| *.txt |*.txt" OFD.ShowDialog()

If OFD.FileName = " " Then Exit Sub

'Pic1.Image = Image.FromFile(OFD.FileName) '

Me.Text = OFD.FileName

FileOpen(i, OFD.FileName, OpenMode.Input) Do Until EOF(i)

Input(i, s) 'tiapbaris d tampung d variabel "s" s1 &= s &IIf(EOF(i), "", vbCrLf) Loop

FileClose(i)

(22)

'Me.Text = s1 End Sub

Private Sub Button9_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button9.Click

LoadFileNotepad() End Sub

Private Sub FileToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles FileToolStripMenuItem.Click

Application.Exit() End Sub

(23)

CURRICULUM VITAE

DATA PRIBADI

Nama

: Helen Sri Maharani

Tempatlahir

: Parsiburan

Tanggallahir

: 26Maret 1992

Jeniskelamin

: Perempuan

Golongandarah

: B

KONTAK

Alamat

: jl.JaminGinting, Gg.Kamboja no.9 Padang Bulan, Medan

No. HP

: 082361590035

Email

PENDIDIKAN

TK

: -

SD

: SD Negeri NO:044855Parsaoran (1998 – 2004)

SMP

: SMP Negeri 1 LaweSigala-gala (2004 – 2007)

(24)
(25)
(26)
(27)
(28)
(29)

Referensi

Dokumen terkait

Bantuan Sosial Beras Sejahtera (Bansos Rastra) adalah bantuan pangan dalam bentuk beras (natura) yang diberikan oleh pemerintah untuk disalurkan setiap bulannya kepada Keluarga

Menurut David Kolb dalam (Ghufron dan Risnawati, 2014: 101) gaya belajar siswa dipengaruhi oleh tipe kepribadian, kebiasaan atau habit, serta berkembang sejalan dengan waktu

tindak lanjut pembelajaran. Peserta didik dapat menentukan gagasan/ide penulisan berdasarkan minat atau hal lainnya yang sedang menjadi pusat perhatiannya, peserta

Berdasarkan uraian kesimpulan di atas, selanjutnya peneliti mengemukakan saran agar pembelajaran IPA, khususnya pada materi sumber daya alam di kelas ada

[r]

Salah satu manfaat mengimplementasikan manajemen pengetahuan adalah untuk meningkatkan kompetensi SDM (pustakawan). Berdasarkan hasil penelitian terdahulu, diketahui bahwa

Berdasarkan hasil analisis ekologis pada penelitian ini menunujukkan bahwa di lokasi Gilisulat, kondisi mangrove alarni masih bagus, sedangkan pada penelitian Idrus

Satuan kegiatan harian (SKH) dapat disusun dalam bentuk, antara lain SKH model pembelajaran kelompok, SKH pembelajaran berdasarkan minat dengan sudut kegiatan, dan SKH