Form Menu
Public Class Form2
Private Sub CaesarChipperToolStripMenuItem_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CaesarChipperToolStripMenuItem.Click
Form1.Show()
End Sub
Private Sub VernamChipperToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles VernamChipperToolStripMenuItem.Click
Form3.Show()
End Sub
Private Sub ExitToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ExitToolStripMenuItem.Click
End
End Sub
Private Sub KodeASCIIToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KodeASCIIToolStripMenuItem.Click
Form4.Show()
End Sub
Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
End Class
Form Kriptografi Chipper
Public Class Form1
Private Sub Btn_Enkripsi_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Btn_Enkripsi.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
Plain.Text = ""
End Sub
Private Sub Btn_Deskripsi_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Btn_Deskripsi.Click
Dim x As String
Dim xkalimat As String = ""
For i = 1 To Len(Chiper.Text)
x = Mid(Chiper.Text, i, i)
x = Chr(Asc(x) - 3)
xkalimat = xkalimat + x
Next
Plain.Text = xkalimat
Chiper.Text = ""
End Sub
End Class
Form Kriptografi Vernam
Public Class Form3
Private Sub Form3_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Plainteks.Text = ""
Kunci.Text = ""
Chiperteks.Text = ""
End Sub
Private Sub Btn_Enkripsi_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Btn_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 = 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
Plainteks.Text = ""
Btn_Deskripsi.Enabled = True
Btn_Enkripsi.Enabled = False
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 Btn_Deskripsi_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Btn_Deskripsi.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 nDsc As Integer
j = 0
skata = Chiperteks.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
nDsc = ((nkata - nkunci) Mod 26)
sPlain = sPlain & Chr((nDsc) + 65)
Next i
Plainteks.Text = sPlain
Chiperteks.Text = ""
Btn_Enkripsi.Enabled = True
Btn_Deskripsi.Enabled = False
End Sub
End Class
Form Kode ASCII
Public Class Form4
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim skata As String
skata = TextBox1.Text
TextBox2.Text = Asc(skata)
End Sub
End Class
Public Class Form2
Private Sub CaesarChipperToolStripMenuItem_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CaesarChipperToolStripMenuItem.Click
Form1.Show()
End Sub
Private Sub VernamChipperToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles VernamChipperToolStripMenuItem.Click
Form3.Show()
End Sub
Private Sub ExitToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ExitToolStripMenuItem.Click
End
End Sub
Private Sub KodeASCIIToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KodeASCIIToolStripMenuItem.Click
Form4.Show()
End Sub
Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
End Class
Form Kriptografi Chipper
Public Class Form1
Private Sub Btn_Enkripsi_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Btn_Enkripsi.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
Plain.Text = ""
End Sub
Private Sub Btn_Deskripsi_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Btn_Deskripsi.Click
Dim x As String
Dim xkalimat As String = ""
For i = 1 To Len(Chiper.Text)
x = Mid(Chiper.Text, i, i)
x = Chr(Asc(x) - 3)
xkalimat = xkalimat + x
Next
Plain.Text = xkalimat
Chiper.Text = ""
End Sub
End Class
Form Kriptografi Vernam
Public Class Form3
Private Sub Form3_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Plainteks.Text = ""
Kunci.Text = ""
Chiperteks.Text = ""
End Sub
Private Sub Btn_Enkripsi_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Btn_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 = 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
Plainteks.Text = ""
Btn_Deskripsi.Enabled = True
Btn_Enkripsi.Enabled = False
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 Btn_Deskripsi_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Btn_Deskripsi.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 nDsc As Integer
j = 0
skata = Chiperteks.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
nDsc = ((nkata - nkunci) Mod 26)
sPlain = sPlain & Chr((nDsc) + 65)
Next i
Plainteks.Text = sPlain
Chiperteks.Text = ""
Btn_Enkripsi.Enabled = True
Btn_Deskripsi.Enabled = False
End Sub
End Class
Form Kode ASCII
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim skata As String
skata = TextBox1.Text
TextBox2.Text = Asc(skata)
End Sub
End Class