KRIPTOGRAFI
Public Class kriptografi_caesar
Private Sub Enkripsi_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles 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
End Sub
Private Sub deskrifsi_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles deskrifsi.Click
Dim f As String = ""
Dim xisi As String = ""
For m = 1 To Len(plain.Text)
f = Mid(plain.Text, m, m)
f = Chr(Asc(f) - 3)
xisi = xisi + f
Next
chiper.Text = xisi
End Sub
End Class
Coding Kriftografi vernam
Public Class kriptografi_vernan
Private Sub kriptografi_vernan_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
plain.Text = ""
kunci.Text = ""
chiper.Text = ""
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.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 65)
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
Coding Kriftografi grosfeld
Public Class kriptografi_grosfeld
Private Sub kriptografi_grosfeld_load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
plain.Text = ""
kunci.Text = ""
chiper.Text = ""
End Sub
Private Sub plain_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles plain.KeyPress
If ((e.KeyChar >= "0" And e.KeyChar <= "9") And e.KeyChar <> vbBack) Then e.Handled = True
End Sub
Private Sub kunci_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles kunci.KeyPress
If Not ((e.KeyChar >= "0" And e.KeyChar <= "9") Or e.KeyChar = vbBack) Then e.Handled = True
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.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)) - 48
nEnc = ((nKata + nKunci) Mod 26)
sPlain = sPlain & Chr((nEnc) + 65)
Next i
chiper.Text = sPlain
End Sub
End Class
Coding Kriftografi VIGENERE
Public Class kriptografi_vigenerePrivate Sub kriptografi_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 Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.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
Create By : Eko Fransisko Manurung
0 comments:
Post a Comment
Isikan Komentar Yang Bermanfaat Untuk Membangun ya Gann....