Hasil Tampilan Gronsfeld:
6. Kriptografi Vigenere
Form Desain:
Listing Program:
Public Class Form6
Private Sub kriptrografi_Vigenere_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
plain.Text = ""
chiper.Text = ""
kunci.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)) + 0
nKunci = Asc(Mid(sKey, J, 1)) + 0
nEnc = ((nKata + nKunci) Mod 256)
sPlain = sPlain & Chr((nEnc))
Next i
chiper.Text = sPlain
End Sub
End Class
Hasil Tampilan
6. Kriptografi Vigenere
Form Desain:
Listing Program:
Public Class Form6
Private Sub kriptrografi_Vigenere_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
plain.Text = ""
chiper.Text = ""
kunci.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)) + 0
nKunci = Asc(Mid(sKey, J, 1)) + 0
nEnc = ((nKata + nKunci) Mod 256)
sPlain = sPlain & Chr((nEnc))
Next i
chiper.Text = sPlain
End Sub
End Class
Hasil Tampilan
Tidak ada komentar:
Posting Komentar