Public Class Form1
Function Enkripsi(ByVal text As String, ByVal kunci As String) As String
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 skunci As String
Dim nEnc As Integer
Dim splain As String
j = 0
jum = Len(text)
splain = ""
skey = kunci
skata = text
For i = 1 To jum
If j = Len(skey) Then
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) + 65
splain = splain & Chr(nEnc)
Next i
Enkripsi = splain
End Function
Private Sub Btnproses_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Btnproses.Click
chipertext.Text = Enkripsi(plaintext.Text, kunci.Text)
End Sub
End Class
Tidak ada komentar:
Posting Komentar