Assalamu'alaikum..
Kali ini saya akan berbagi kepada anda tentang cara Membuat Program Aplikasi Kriptografi Vernam Pada VB.net. Aplikasi Kriptografi Vernam ini bertujuan untuk menyamarkan id kita saat kita membuat disebuah web atau program.
Berikut ini adalah tampilan Aplikasi Kriptografi Vernam :
Berikut adalah Listing Programnya:
Public Class Kriptografi_Vernam
Private Sub Kriptografi_Vernam_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 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 (((tombol >= 65) And (tombol <= 90)) Or (tombol = 8)) Then
e.Handled = True
End If
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, i, 1)) - 65
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)) - 65
nenc = ((nkata + nkunci) Mod 26)
splaint = splaint & Chr((nenc) + 65)
Next i
Chiper_teks.Text = splaint
End Sub
End Class
Demikianlah Artikel saya tentang Membuat Program Aplikasi Kriptografi Vernam Pada VB.net. Semoga Artikel ini dapat bermanfaat bagi para pembaca.
Wassalamu'alaikum. wr. wb
Post a Comment