Assalamu'alaikum Wr. Wb.
Kali ini saya akan berbagi cara Membuat Program Aplikasi Kriptografi Gronsfield Pada Vb.net . Apllikasi ini hampir sama dengan Kriptografi Vernam hanya bedanya pada kata kunci,, Aplikasi Kriptografi Gronsfeld kata kuncinya menggunakan angka sedangkan Kriptografi Vernam menggunakan huruf.
Berikut adalah tampilan Aplikasi Kriptografi Gronsfield:
Berikut adalah Listing Program Aplikasi Kriptografi Gronsfield:
Public Class Kriptografi_Gronsfield
Private Sub Kriptografi_Gronsfield_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
plain_teks.Text = ""
Kunci.Text = ""
Chiper_teks.Text = ""
End Sub
Private Sub Button_Enkripsi_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button_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 splaint As String = ""
Dim nenc As Integer
j = 0
skata = plain_teks.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)) - 48
nenc = ((nkata + nkunci) Mod 26)
splaint = splaint & Chr((nenc) + 65)
Next i
Chiper_teks.Text = splaint
End Sub
Private Sub Button_Deskripsi_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button_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 splaint As String = ""
Dim nenc As Integer
j = 0
skata = plain_teks.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, i, 1)) - 48
nenc = ((nkata + nkunci) Mod 26)
splaint = splaint & Chr(nenc - 65)
Next i
Chiper_teks.Text = splaint
End Sub
Private Sub plain_teks_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles plain_teks.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_KeyPress1(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 ((e.KeyChar >= "0" And e.KeyChar <= "9") Or e.KeyChar = vbBack) Then
e.Handled = True
End If
End Sub
End Class
Demikian Artikel saya tentang Membuat Program Aplikasi Kriptografi Gronsfield Pada Vb.net. Semoga artikel ini bermanfaat bagi para pembaca.
Wassalamu'alaikum. wr. wb...
Post a Comment