Buatkan MenuStrip pada Form1
Buat dan isi MenuStrip yang ada pada Form 1
menjadi seperti ini :
Listing Program
Public Class menu
Private Sub
AplikasiKriptograpiCaesarToolStripMenuItem_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles
AplikasiKriptograpiCaesarToolStripMenuItem.Click
Caesar.Show()
End Sub
Private Sub
EnkripsiKriptograpiVernamToolStripMenuItem_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles
EnkripsiKriptograpiVernamToolStripMenuItem.Click
Vernam.Show()
End Sub
Private Sub
GrosnfeilToolStripMenuItem_Click(ByVal sender As System.Object, ByVal
e As System.EventArgs) Handles
GrosnfeilToolStripMenuItem.Click
Gronsfeld.Show()
End Sub
Private Sub
KriptografiVigenereToolStripMenuItem_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles
KriptografiVigenereToolStripMenuItem.Click
Vigenere.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
End Class
Hasil Program
Program Caesar Cipher
Listing Program
Public Class Caesar
Private Sub
enkripsi_Click(ByVal sender As System.Object, ByVal
e As System.EventArgs) Handles
enkripsi.Click
Dim x As String = ""
Dim kalimat As String = ""
For i = 1 To
Len(plain.Text)
x =
Mid(plain.Text, i, i)
x =
Chr(Asc(x) + 3)
kalimat =
kalimat + x
Next
chiper.Text =
kalimat
End Sub
Private Sub
dekripsi_Click(ByVal sender As System.Object, ByVal
e As System.EventArgs) Handles
dekripsi.Click
Dim x As String = ""
Dim kalimat As String = ""
For i = 1 To
Len(chiper.Text)
x =
Mid(chiper.Text, i, i)
x =
Chr(Asc(x) - 3)
kalimat =
kalimat + x
Next
plain.Text =
kalimat
End Sub
End Class
Hasil Program
Vernam Chiper (One Time Pad)
Listing Program
Public Class Vernam
Private Sub
Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles
MyBase.Load
plain.Text = ""
kunci.Text = ""
chiper.Text = ""
End Sub
Private Sub
enkripsi_Click(ByVal sender As System.Object, ByVal
e As System.EventArgs) Handles
enkripsi.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 =
plain.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
chiper.Text =
splain
End Sub
Private Sub
plain_KeyPress(ByVal sender As Object, ByVal e As
System.Windows.Forms.KeyPressEventArgs) Handles
plain.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
End Class
Hasil Program
Kriptografi Gronsfeld
Buatlah design Form
Seperti Kriptografi Vernam Chiper !
Listing Program
Public Class Gronsfeld
Private Sub
Form3_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles
MyBase.Load
plain.Text = ""
kunci.Text = ""
chiper.Text = ""
End Sub
Private Sub
enkripsi_Click(ByVal sender As System.Object, ByVal
e As System.EventArgs) Handles
enkripsi.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 =
plain.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
chiper.Text =
splain
End Sub
Private Sub
plain_KeyPress(ByVal sender As Object, ByVal e As
System.Windows.Forms.KeyPressEventArgs) Handles
plain.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
End Class
Hasil Program
Kriptografi Vigenere
Design Form
Seperti Kriptografi Vernam Chiper
Listing Program
Public Class Vigenere
Private Sub
btnenkripsi_Click(ByVal sender As System.Object, ByVal
e As System.EventArgs) Handles
btnenkripsi.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 =
plain.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))
nKunci =
Asc(Mid(sKey, j, 1))
nEnc =
((nKata + nKunci) Mod 256)
sPlain =
sPlain & Chr((nEnc))
Next i
chiper.Text =
sPlain
End Sub
End Class
Hasil Program