Pada program saya mendesain hanya karakter saja yang bisa di terima.
Design dahulu form program enkripsi vernam (one time pad) menggunakan vb net, berikut ini
Berikut listing program enkripsi vernam (one time pad) menggunakan vb net
Public Class OneTimePad
Private Sub OneTimePad_Load(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Plainteks.Text = ""
Kunci.Text = ""
Chiperteks.Text = ""
End Sub
Private Sub btnEnkripsi_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles btnEnkripsi.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 = Plainteks.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 26)
sPlain = sPlain & Chr((nEnc) +
65)
Next i
Chiperteks.Text = sPlain
End Sub
Private Sub Plainteks_KeyPress(ByVal
sender As Object,
ByVal e As
System.Windows.Forms.KeyPressEventArgs) Handles
Plainteks.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
Silahkan anda tekan F5, dan isikan data berikut :
Plainteks : SAYANGAKUCINTAKAMU
Kunci : ALDYAN
Chiperteks: SLBYNTAVXAIATLNYMH
Hasil form program enkripsi vernam (one time pad) menggunakan vb net
Bagaimana asik bukan program enkripsi vernam (one time pad) menggunakan vb net?
mlm pak mesran.. saya kagum sekali dgn artikel" bapak..
ReplyDeletesaya lg memulai belajar algoritma kriptografi OTP (One Time Pad).
di artikel ini bapak kan menggunakan vb net.
semisal aplikasi diatas di buat menggunakan bahasa PHP kira" bisa gag ya pak?
karena saya hanya menguasai bahasa PHP,,
saya ingin membuat aplikasi seperti yg bapak contohkan tetapi pakai bahasa PHP..
mohon saran nya..
fendie.fendie@gmail.com
Mantap artikelnya pak
Delete