Sabtu, 29 Juni 2013

Tugas Kriptografi



Tampilan awal form kriptografi




Tampilan setelah di input.,
syntax:

 Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        plaintext.Text = ""
        chipertext.Text = ""

    End Sub

    Private Sub btnenskripsi_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnenskripsi.Click
        Dim x As String
        Dim bil As Integer
        chipertext.Text = ""
        For i = 1 To Len(plaintext.Text)
            x = Microsoft.VisualBasic.Mid(plaintext.Text, i, 1)
            bil = Asc(x)
            bil = bil + 3
            x = Chr(bil)
            chipertext.Text = chipertext.Text & x
        Next
    End Sub

    Private Sub btndeskripsi_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btndeskripsi.Click
        Dim x As String
        Dim xkalimat As String = ""
        For i = 1 To Len(plaintext.Text)
            x = Microsoft.VisualBasic.Mid(plaintext.Text, i, 1)
            x = Chr(Asc(x) - 3)
            xkalimat = xkalimat + x
        Next
        plaintext.Text = (xkalimat)
    End Sub
End Class

Tidak ada komentar:

Posting Komentar