Design Form Menu Utama:
Berikut
Listing Programnya :
Public Class Form1
Private Sub KriptografiCaesarToolStripMenuItem_Click(ByVal sender As
System.Object, ByVal e As
System.EventArgs) Handles
KriptografiCaesarToolStripMenuItem.Click
Kriptografi_Caesar.MdiParent = Me
Kriptografi_Caesar.Show()
End Sub
Private Sub KriptografiVernamToolStripMenuItem_Click(ByVal sender As
System.Object, ByVal e As
System.EventArgs) Handles
KriptografiVernamToolStripMenuItem.Click
Kriptografi_Vernam.MdiParent = Me
Kriptografi_Vernam.Show()
End Sub
Private Sub KriptografiGonsfeldToolStripMenuItem_Click(ByVal sender As
System.Object, ByVal e As
System.EventArgs) Handles
KriptografiGonsfeldToolStripMenuItem.Click
Kriptografi_Gonsfeld.MdiParent = Me
Kriptografi_Gonsfeld.Show()
End Sub
Private Sub KriptografiVigeneriToolStripMenuItem_Click(ByVal sender As
System.Object, ByVal e As
System.EventArgs) Handles
KriptografiVigeneriToolStripMenuItem.Click
Kriptografi_Vigeneri.MdiParent = Me
Kriptografi_Vigeneri.Show()
End Sub
Private Sub KeluarToolStripMenuItem1_Click(ByVal sender As
System.Object, ByVal e As
System.EventArgs) Handles
KeluarToolStripMenuItem1.Click
End
End Sub
Private Sub KeluarToolStripMenuItem_Click(ByVal sender As
System.Object, ByVal e As
System.EventArgs) Handles
KeluarToolStripMenuItem.Click
End
End Sub
Private Sub ToolStripButton5_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles
ToolStripButton5.Click
End
End Sub
Private Sub ToolStripButton1_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles ToolStripButton1.Click
KriptografiCaesarToolStripMenuItem.PerformClick()
End Sub
Private Sub ToolStripButton2_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles
ToolStripButton2.Click
KriptografiVernamToolStripMenuItem.PerformClick()
End Sub
Private Sub ToolStripButton3_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles
ToolStripButton3.Click
KriptografiGonsfeldToolStripMenuItem.PerformClick()
End Sub
Private Sub ToolStripButton4_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles
ToolStripButton4.Click
KriptografiVigeneriToolStripMenuItem.PerformClick()
End Sub
Private Sub Form1_Load(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
End Sub
End Class
Hasil
Programnya:
1.Kriptografi Caesar
Desain
Form Berikut :
1.
Kriptografi Caesar
Desainlah Form Berikut ini :
Berikut Listing
Programnya :
Public Class Kriptografi_Caesar
Private Sub
Button1_Click(ByVal sender As System.Object, ByVal
e As System.EventArgs) Handles
Button1.Click
Dim x As String = ""
Dim xkalimat As String = ""
For i = 1 To
Len(Plain.Text)
x = Mid(Plain.Text, i, i)
x = Chr(Asc(x) + 3)
xkalimat = xkalimat + x
Next
Chiper.Text = xkalimat
End Sub
Private Sub
Button2_Click(ByVal sender As System.Object, ByVal
e As System.EventArgs) Handles
Button2.Click
Dim x As String = ""
Dim xkalimat As String = ""
For i = 1 To
Len(Plain.Text)
x = Mid(Plain.Text, i, i)
x = Chr(Asc(x) - 3)
xkalimat = xkalimat + x
Next
Chiper.Text = xkalimat
End Sub
Private Sub
Kriptografi_Caesar_Load(ByVal sender As System.Object, ByVal
e As System.EventArgs) Handles
MyBase.Load
End Sub
End Class
Berikut HasiL Enkripsi :
Berikut HasiL Dekripsi :
2.Kriptografi
Vernam
Desain
Form Berikut :
Berikut Listing Programnya :
Public Class
Kriptografi_Gonsfeld
Private Sub
Button1_Click(ByVal sender As System.Object, ByVal
e As System.EventArgs) Handles
Button1.Click
Dim j As Integer
Dim jum As Integer
Dim skey As String
Dim nkata As Integer
Dim nkunci As Integer
Dim skata As String
Dim splain As String = ""
Dim nEnc As Integer
j
= 0
skata = Plainteks.Text
jum = Len(skata)
skey = Kunci.Text
For i = 1 To jum
If j = Len(skey) Then
j = 1
Else
j = j + 1
End If
nkata = Asc(Mid(skata, i, 1)) - 65
nkunci = Asc(Mid(skey, j, 1)) - 65
nEnc = ((nkata + nkunci) Mod 26)
splain = splain & Chr((nEnc) + 65)
Next i
Chiperteks.Text = splain
End Sub
Private Sub
Plainteks_KeyPress(ByVal sender As Object, ByVal e As
System.Windows.Forms.KeyPressEventArgs) Handles
Plainteks.KeyPress
e.KeyChar = UCase(e.KeyChar)
Dim tombol As Integer = Asc(e.KeyChar)
If Not (((tombol
>= 65) And (tombol <= 90)) Or (tombol = 8)) Then
e.Handled = True
End If
End Sub
Private Sub
Kunci_KeyPress(ByVal sender As Object, ByVal e As
System.Windows.Forms.KeyPressEventArgs) Handles
Kunci.KeyPress
e.KeyChar = UCase(e.KeyChar)
Dim tombol As Integer = Asc(e.KeyChar)
If Not (((tombol
>= 65) And (tombol <= 90)) Or (tombol = 8)) Then
e.Handled = True
End If
End Sub
Private Sub
Kriptografi_Vernam_Load(ByVal sender As System.Object, ByVal
e As System.EventArgs) Handles
MyBase.Load
Plainteks.Text = ""
Kunci.Text = ""
Chiperteks.Text = ""
End Sub
End Class
Berikut
Hasilnya :
3.Kiptografi
Gonsfield
Desain Form Berikut :
Berikut Listing Programnya :
Public Class Kriptografi_Vernam
Private Sub
Button1_Click(ByVal sender As System.Object, ByVal
e As System.EventArgs) Handles
Button1.Click
Dim j As Integer
Dim jum As Integer
Dim skey As String
Dim nkata As Integer
Dim nkunci As Integer
Dim skata As String
Dim splain As String = ""
Dim nEnc As Integer
j
= 0
skata = Plainteks.Text
jum = Len(skata)
skey = Kunci.Text
For i = 1 To jum
If j = Len(skey) Then
j = 1
Else
j = j + 1
End If
nkata = Asc(Mid(skata, i, 1)) - 65
nkunci = (Mid(skey, j, 1))
nEnc = ((nkata + nkunci) Mod 26)
splain = splain & Chr((nEnc) + 65)
Next i
Chiperteks.Text = splain
End Sub
Private Sub
Plainteks_KeyPress(ByVal sender As Object, ByVal e As
System.Windows.Forms.KeyPressEventArgs) Handles
Plainteks.KeyPress
e.KeyChar = UCase(e.KeyChar)
Dim tombol
As Integer =
Asc(e.KeyChar)
If Not (((tombol
>= 65) And (tombol <= 90)) Or (tombol = 8)) Then
e.Handled = True
End If
End Sub
Private Sub
Kunci_KeyPress(ByVal sender As Object, ByVal e As
System.Windows.Forms.KeyPressEventArgs) Handles
Kunci.KeyPress
Dim tombol As Integer = Asc(e.KeyChar)
If Not (tombol >=
65) And (tombol = 1) Then
e.Handled = True
End If
End Sub
Private Sub
Kriptografi_Gonsfeld_Load(ByVal sender As System.Object, ByVal
e As System.EventArgs) Handles
MyBase.Load
Plainteks.Text = ""
Kunci.Text = ""
Chiperteks.Text = ""
End Sub
End Class
Berikut
Hasilnya :
4.Kiptografi
Vigeneri
Desain Form Berikut :
Berikut Listing Programnya :
Public Class Kriptografi_Vigeneri
Private Sub
Button1_Click(ByVal sender As System.Object, ByVal
e As System.EventArgs) Handles
Button1.Click
chiper.Text = Enkripsi(plain.Text, kunci.Text)
End Sub
Function Enkripsi(ByVal
Teks As String,
ByVal Kunci As String) As String
Dim j As Integer
Dim jum As Integer
Dim sKey As String
Dim nKata As Integer
Dim nKunci As Integer
Dim sKata As String
Dim sPlain As String
Dim nEnc As Integer
j
= 0
jum = Len(Teks)
sPlain = ""
sKey = Kunci
sKata = Teks
For i = 1 To jum
If j = Len(sKey) Then
j = 1
Else
j = j + 1
End If
nKata = Asc(Mid(sKata, i, 1))
nKunci = Asc(Mid(sKey, j, 1))
nEnc = ((nKata + nKunci) Mod 256)
sPlain = sPlain & Chr((nEnc))
Next i
Enkripsi = sPlain
End Function
End Class
Berikut Hasilnya :
Tidak ada komentar:
Posting Komentar