Home » » Listing Program

Listing Program

Listing Program


Form Menu
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjCnVmJRptSUnHsElsVT2kQw5lO5gfa-MzROoMoLoqgDYyJjpgFVtwoBYgkPgewHMFfT0rzgT4E0SMtGyDisrpOu0A9pdt933tghFhvK0nYQO9Xs_UNP0_lx4TOgSkDDTRcY-bfl_JjZmEf/s1600/Menu.jpg


Public Class Menu

    Private Sub ClloseToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ClloseToolStripMenuItem.Click
        End
    End Sub

    Private Sub KriptografiCaesarToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KriptografiCaesarToolStripMenuItem.Click
        Kriptografi_Caesar.Show()
    End Sub

    Private Sub KriptografiVernamToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KriptografiVernamToolStripMenuItem.Click
        Kriptografi_Vernam_Chiper.Show()
    End Sub

    Private Sub KriptografiGronsfeldToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KriptografiGronsfeldToolStripMenuItem.Click
        Kriptografi_Gronsfeld.Show()
    End Sub

    Private Sub KriptografiViginereToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KriptografiViginereToolStripMenuItem.Click
        Kriptografi_Viginere.Show()
    End Sub
End Class

Form Kriptografi Caesar
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgeJlVoCRye2mssSChFBho3bLDZuYrc7AWOFx5XcmlIuJskeQ1S7IS7jlJmvDvSw2b75zwR-TLyp-SbxJwxV6_JaF_ektmOoOye0vD_6_Lr6iKUDLrkZY7cGJbolqOsUf0ZDqKejBIHNciZ/s1600/Caesar.jpg



Public Class Kriptografi_Caesar

    Private Sub btnenkripsi_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnenkripsi.Click
        Dim x As String = ""
        Dim xkalimat As String = ""
        For i = 1 To Len(plainteks.Text)
            x = Mid(plainteks.Text, i, i)
            x = Chr(Asc(x) + 3)
            xkalimat = xkalimat + x
        Next
        Chiperteks.Text = xkalimat
    End Sub

    Private Sub btndekripsi_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btndekripsi.Click
        Dim x As String = ""
        Dim xkalimat As String = ""
        For i = 1 To Len(plainteks.Text)
            x = Mid(plainteks.Text, i, i)
            x = Chr(Asc(x) - 3)
            xkalimat = xkalimat + x
        Next
        Chiperteks.Text = xkalimat
    End Sub

    Private Sub Kriptografi_Caesar_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    End Sub
End Class


Form Kriptografi Vernam
Public Class Kriptografi_Vernam_Chiper

    Private Sub Form3_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 plainteks_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles plainteks.TextChanged

    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

    Private Sub kunci_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles kunci.TextChanged

    End Sub
End Class

Form Kriptografi Gronsfeld
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg-WqYUOgy2RmR2gp3StaWLaxJP1H-63GOdXpKSRsdOd9f-ifrxbu6q20zVmp3pAXYqaE1K5yENZEmNbo7p-yrSSpeMQZxm9MdSH10hZtz5AZE5Igsyk1sDiIS7H0aUrNoFY_WAY_3FChK_/s1600/Gronsfeld.jpg


Public Class Kriptografi_Gronsfeld

    Private Sub Form4_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        plainteks.Text = ""
        kunci.Text = ""
        chiperteks.Text = ""

    End Sub

    Private Sub plainteks_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles plainteks.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 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)) - 48

            nEnc = ((nKata + nKunci) Mod 26)
            sPlain = sPlain & Chr((nEnc) + 65)
        Next i
        chiperteks.Text = sPlain
    End Sub
End Class


Form Kriptografi Viginere
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgtKTEAV70wopPBbh9flzgyHP82yfB6_VeYnIbiCTF0vAMHhbY8Dt8BkA5EPnitgyhwB74dqfUKVAM1vqkwy0gmwxeoNTG9Ku-NEhFgAE4OATmR1BPla9TcUnUWz-_j8qKfWJGMMjamN5CD/s1600/Vernam.jpg


Public Class Kriptografi_Viginere

    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

    Function Enkripsi(ByVal Teks 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 sPlain As String
        Dim nEnc As Integer
        j = 0
        jum = Len(Teks)
        sPlain = ""
        sKey = Kunci
        sKata = Teks
        For i = 1 To jum
            If j = Len(sKey) Then
                j = 1
            Else
                j = j + 1
            End If
            nKata = Asc(Mid(sKata, i, 1))

            nKunci = Asc(Mid(sKey, j, 1))

            nEnc = ((nKata + nKunci) Mod 256)

            sPlain = sPlain & Chr((nEnc))
        Next i
        Enkripsi = sPlain
    End Function

    Private Sub Kriptografi_Viginere_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    End Sub
End Class

Hasil Printout
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhRheXwZ5AuxN28EWabzF43wRTplQFNEL-UxVVnU_UQQnr93KklNHK5t6Vr2AEkJTr10Qmxn2c0VLwpiAjVbEJI1NKJsYeqLUgFHoNBLJbFUgVL55ouQZu_KxRSXRRsQIjC_9OoYPua-L7d/s1600/hasil.png

https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjc24plNIZlEB6KZLbGkMalhMc7CoApE0U-wmOzxn8x9GZqyZe6Sqc0AmtQoBFT4qN7cFEQcG6hEAnzjAq5Y64KRgZOBTB8UIJzJT-jUJSrft8zTb5Glbrb6qS5JiTichQ31YC3Oeh3ZgPC/s1600/hasil2.png
 
Listing Program


Form Menu


Public Class Menu

    Private Sub ClloseToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ClloseToolStripMenuItem.Click
        End
    End Sub

    Private Sub KriptografiCaesarToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KriptografiCaesarToolStripMenuItem.Click
        Kriptografi_Caesar.Show()
    End Sub

    Private Sub KriptografiVernamToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KriptografiVernamToolStripMenuItem.Click
        Kriptografi_Vernam_Chiper.Show()
    End Sub

    Private Sub KriptografiGronsfeldToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KriptografiGronsfeldToolStripMenuItem.Click
        Kriptografi_Gronsfeld.Show()
    End Sub

    Private Sub KriptografiViginereToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KriptografiViginereToolStripMenuItem.Click
        Kriptografi_Viginere.Show()
    End Sub
End Class

Form Kriptografi Caesar




Public Class Kriptografi_Caesar

    Private Sub btnenkripsi_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnenkripsi.Click
        Dim x As String = ""
        Dim xkalimat As String = ""
        For i = 1 To Len(plainteks.Text)
            x = Mid(plainteks.Text, i, i)
            x = Chr(Asc(x) + 3)
            xkalimat = xkalimat + x
        Next
        Chiperteks.Text = xkalimat
    End Sub

    Private Sub btndekripsi_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btndekripsi.Click
        Dim x As String = ""
        Dim xkalimat As String = ""
        For i = 1 To Len(plainteks.Text)
            x = Mid(plainteks.Text, i, i)
            x = Chr(Asc(x) - 3)
            xkalimat = xkalimat + x
        Next
        Chiperteks.Text = xkalimat
    End Sub

    Private Sub Kriptografi_Caesar_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    End Sub
End Class


Form Kriptografi Vernam

Public Class Kriptografi_Vernam_Chiper

    Private Sub Form3_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 plainteks_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles plainteks.TextChanged

    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

    Private Sub kunci_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles kunci.TextChanged

    End Sub
End Class

Form Kriptografi Gronsfeld



Public Class Kriptografi_Gronsfeld

    Private Sub Form4_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        plainteks.Text = ""
        kunci.Text = ""
        chiperteks.Text = ""

    End Sub

    Private Sub plainteks_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles plainteks.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 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)) - 48

            nEnc = ((nKata + nKunci) Mod 26)
            sPlain = sPlain & Chr((nEnc) + 65)
        Next i
        chiperteks.Text = sPlain
    End Sub
End Class


Form Kriptografi Viginere



Public Class Kriptografi_Viginere

    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

    Function Enkripsi(ByVal Teks 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 sPlain As String
        Dim nEnc As Integer
        j = 0
        jum = Len(Teks)
        sPlain = ""
        sKey = Kunci
        sKata = Teks
        For i = 1 To jum
            If j = Len(sKey) Then
                j = 1
            Else
                j = j + 1
            End If
            nKata = Asc(Mid(sKata, i, 1))

            nKunci = Asc(Mid(sKey, j, 1))

            nEnc = ((nKata + nKunci) Mod 256)

            sPlain = sPlain & Chr((nEnc))
        Next i
        Enkripsi = sPlain
    End Function

    Private Sub Kriptografi_Viginere_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    End Sub
End Class

Hasil Printout


- See more at: http://ericksaruksuk.blogspot.com/2014/01/pemograman-kriptografi.html#sthash.pzyNlDFw.dpuf
Listing Program


Form Menu


Public Class Menu

    Private Sub ClloseToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ClloseToolStripMenuItem.Click
        End
    End Sub

    Private Sub KriptografiCaesarToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KriptografiCaesarToolStripMenuItem.Click
        Kriptografi_Caesar.Show()
    End Sub

    Private Sub KriptografiVernamToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KriptografiVernamToolStripMenuItem.Click
        Kriptografi_Vernam_Chiper.Show()
    End Sub

    Private Sub KriptografiGronsfeldToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KriptografiGronsfeldToolStripMenuItem.Click
        Kriptografi_Gronsfeld.Show()
    End Sub

    Private Sub KriptografiViginereToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KriptografiViginereToolStripMenuItem.Click
        Kriptografi_Viginere.Show()
    End Sub
End Class

Form Kriptografi Caesar




Public Class Kriptografi_Caesar

    Private Sub btnenkripsi_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnenkripsi.Click
        Dim x As String = ""
        Dim xkalimat As String = ""
        For i = 1 To Len(plainteks.Text)
            x = Mid(plainteks.Text, i, i)
            x = Chr(Asc(x) + 3)
            xkalimat = xkalimat + x
        Next
        Chiperteks.Text = xkalimat
    End Sub

    Private Sub btndekripsi_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btndekripsi.Click
        Dim x As String = ""
        Dim xkalimat As String = ""
        For i = 1 To Len(plainteks.Text)
            x = Mid(plainteks.Text, i, i)
            x = Chr(Asc(x) - 3)
            xkalimat = xkalimat + x
        Next
        Chiperteks.Text = xkalimat
    End Sub

    Private Sub Kriptografi_Caesar_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    End Sub
End Class


Form Kriptografi Vernam

Public Class Kriptografi_Vernam_Chiper

    Private Sub Form3_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 plainteks_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles plainteks.TextChanged

    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

    Private Sub kunci_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles kunci.TextChanged

    End Sub
End Class

Form Kriptografi Gronsfeld



Public Class Kriptografi_Gronsfeld

    Private Sub Form4_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        plainteks.Text = ""
        kunci.Text = ""
        chiperteks.Text = ""

    End Sub

    Private Sub plainteks_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles plainteks.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 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)) - 48

            nEnc = ((nKata + nKunci) Mod 26)
            sPlain = sPlain & Chr((nEnc) + 65)
        Next i
        chiperteks.Text = sPlain
    End Sub
End Class


Form Kriptografi Viginere



Public Class Kriptografi_Viginere

    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

    Function Enkripsi(ByVal Teks 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 sPlain As String
        Dim nEnc As Integer
        j = 0
        jum = Len(Teks)
        sPlain = ""
        sKey = Kunci
        sKata = Teks
        For i = 1 To jum
            If j = Len(sKey) Then
                j = 1
            Else
                j = j + 1
            End If
            nKata = Asc(Mid(sKata, i, 1))

            nKunci = Asc(Mid(sKey, j, 1))

            nEnc = ((nKata + nKunci) Mod 256)

            sPlain = sPlain & Chr((nEnc))
        Next i
        Enkripsi = sPlain
    End Function

    Private Sub Kriptografi_Viginere_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    End Sub
End Class

Hasil Printout


- See more at: http://ericksaruksuk.blogspot.com/2014/01/pemograman-kriptografi.html#sthash.pzyNlDFw.dpuf
Listing Program


Form Menu


Public Class Menu

    Private Sub ClloseToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ClloseToolStripMenuItem.Click
        End
    End Sub

    Private Sub KriptografiCaesarToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KriptografiCaesarToolStripMenuItem.Click
        Kriptografi_Caesar.Show()
    End Sub

    Private Sub KriptografiVernamToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KriptografiVernamToolStripMenuItem.Click
        Kriptografi_Vernam_Chiper.Show()
    End Sub

    Private Sub KriptografiGronsfeldToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KriptografiGronsfeldToolStripMenuItem.Click
        Kriptografi_Gronsfeld.Show()
    End Sub

    Private Sub KriptografiViginereToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KriptografiViginereToolStripMenuItem.Click
        Kriptografi_Viginere.Show()
    End Sub
End Class

Form Kriptografi Caesar




Public Class Kriptografi_Caesar

    Private Sub btnenkripsi_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnenkripsi.Click
        Dim x As String = ""
        Dim xkalimat As String = ""
        For i = 1 To Len(plainteks.Text)
            x = Mid(plainteks.Text, i, i)
            x = Chr(Asc(x) + 3)
            xkalimat = xkalimat + x
        Next
        Chiperteks.Text = xkalimat
    End Sub

    Private Sub btndekripsi_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btndekripsi.Click
        Dim x As String = ""
        Dim xkalimat As String = ""
        For i = 1 To Len(plainteks.Text)
            x = Mid(plainteks.Text, i, i)
            x = Chr(Asc(x) - 3)
            xkalimat = xkalimat + x
        Next
        Chiperteks.Text = xkalimat
    End Sub

    Private Sub Kriptografi_Caesar_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    End Sub
End Class


Form Kriptografi Vernam

Public Class Kriptografi_Vernam_Chiper

    Private Sub Form3_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 plainteks_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles plainteks.TextChanged

    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

    Private Sub kunci_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles kunci.TextChanged

    End Sub
End Class

Form Kriptografi Gronsfeld



Public Class Kriptografi_Gronsfeld

    Private Sub Form4_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        plainteks.Text = ""
        kunci.Text = ""
        chiperteks.Text = ""

    End Sub

    Private Sub plainteks_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles plainteks.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 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)) - 48

            nEnc = ((nKata + nKunci) Mod 26)
            sPlain = sPlain & Chr((nEnc) + 65)
        Next i
        chiperteks.Text = sPlain
    End Sub
End Class


Form Kriptografi Viginere



Public Class Kriptografi_Viginere

    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

    Function Enkripsi(ByVal Teks 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 sPlain As String
        Dim nEnc As Integer
        j = 0
        jum = Len(Teks)
        sPlain = ""
        sKey = Kunci
        sKata = Teks
        For i = 1 To jum
            If j = Len(sKey) Then
                j = 1
            Else
                j = j + 1
            End If
            nKata = Asc(Mid(sKata, i, 1))

            nKunci = Asc(Mid(sKey, j, 1))

            nEnc = ((nKata + nKunci) Mod 256)

            sPlain = sPlain & Chr((nEnc))
        Next i
        Enkripsi = sPlain
    End Function

    Private Sub Kriptografi_Viginere_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    End Sub
End Class

Hasil Printout


- See more at: http://ericksaruksuk.blogspot.com/2014/01/pemograman-kriptografi.html#sthash.pzyNlDFw.dpuf
Listing Program


Form Menu


Public Class Menu

    Private Sub ClloseToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ClloseToolStripMenuItem.Click
        End
    End Sub

    Private Sub KriptografiCaesarToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KriptografiCaesarToolStripMenuItem.Click
        Kriptografi_Caesar.Show()
    End Sub

    Private Sub KriptografiVernamToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KriptografiVernamToolStripMenuItem.Click
        Kriptografi_Vernam_Chiper.Show()
    End Sub

    Private Sub KriptografiGronsfeldToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KriptografiGronsfeldToolStripMenuItem.Click
        Kriptografi_Gronsfeld.Show()
    End Sub

    Private Sub KriptografiViginereToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KriptografiViginereToolStripMenuItem.Click
        Kriptografi_Viginere.Show()
    End Sub
End Class

Form Kriptografi Caesar




Public Class Kriptografi_Caesar

    Private Sub btnenkripsi_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnenkripsi.Click
        Dim x As String = ""
        Dim xkalimat As String = ""
        For i = 1 To Len(plainteks.Text)
            x = Mid(plainteks.Text, i, i)
            x = Chr(Asc(x) + 3)
            xkalimat = xkalimat + x
        Next
        Chiperteks.Text = xkalimat
    End Sub

    Private Sub btndekripsi_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btndekripsi.Click
        Dim x As String = ""
        Dim xkalimat As String = ""
        For i = 1 To Len(plainteks.Text)
            x = Mid(plainteks.Text, i, i)
            x = Chr(Asc(x) - 3)
            xkalimat = xkalimat + x
        Next
        Chiperteks.Text = xkalimat
    End Sub

    Private Sub Kriptografi_Caesar_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    End Sub
End Class


Form Kriptografi Vernam

Public Class Kriptografi_Vernam_Chiper

    Private Sub Form3_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 plainteks_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles plainteks.TextChanged

    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

    Private Sub kunci_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles kunci.TextChanged

    End Sub
End Class

Form Kriptografi Gronsfeld



Public Class Kriptografi_Gronsfeld

    Private Sub Form4_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        plainteks.Text = ""
        kunci.Text = ""
        chiperteks.Text = ""

    End Sub

    Private Sub plainteks_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles plainteks.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 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)) - 48

            nEnc = ((nKata + nKunci) Mod 26)
            sPlain = sPlain & Chr((nEnc) + 65)
        Next i
        chiperteks.Text = sPlain
    End Sub
End Class


Form Kriptografi Viginere



Public Class Kriptografi_Viginere

    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

    Function Enkripsi(ByVal Teks 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 sPlain As String
        Dim nEnc As Integer
        j = 0
        jum = Len(Teks)
        sPlain = ""
        sKey = Kunci
        sKata = Teks
        For i = 1 To jum
            If j = Len(sKey) Then
                j = 1
            Else
                j = j + 1
            End If
            nKata = Asc(Mid(sKata, i, 1))

            nKunci = Asc(Mid(sKey, j, 1))

            nEnc = ((nKata + nKunci) Mod 256)

            sPlain = sPlain & Chr((nEnc))
        Next i
        Enkripsi = sPlain
    End Function

    Private Sub Kriptografi_Viginere_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    End Sub
End Class

Hasil Printout


- See more at: http://ericksaruksuk.blogspot.com/2014/01/pemograman-kriptografi.html#sthash.pzyNlDFw.dpuf
Listing Program


Form Menu


Public Class Menu

    Private Sub ClloseToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ClloseToolStripMenuItem.Click
        End
    End Sub

    Private Sub KriptografiCaesarToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KriptografiCaesarToolStripMenuItem.Click
        Kriptografi_Caesar.Show()
    End Sub

    Private Sub KriptografiVernamToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KriptografiVernamToolStripMenuItem.Click
        Kriptografi_Vernam_Chiper.Show()
    End Sub

    Private Sub KriptografiGronsfeldToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KriptografiGronsfeldToolStripMenuItem.Click
        Kriptografi_Gronsfeld.Show()
    End Sub

    Private Sub KriptografiViginereToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KriptografiViginereToolStripMenuItem.Click
        Kriptografi_Viginere.Show()
    End Sub
End Class

Form Kriptografi Caesar




Public Class Kriptografi_Caesar

    Private Sub btnenkripsi_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnenkripsi.Click
        Dim x As String = ""
        Dim xkalimat As String = ""
        For i = 1 To Len(plainteks.Text)
            x = Mid(plainteks.Text, i, i)
            x = Chr(Asc(x) + 3)
            xkalimat = xkalimat + x
        Next
        Chiperteks.Text = xkalimat
    End Sub

    Private Sub btndekripsi_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btndekripsi.Click
        Dim x As String = ""
        Dim xkalimat As String = ""
        For i = 1 To Len(plainteks.Text)
            x = Mid(plainteks.Text, i, i)
            x = Chr(Asc(x) - 3)
            xkalimat = xkalimat + x
        Next
        Chiperteks.Text = xkalimat
    End Sub

    Private Sub Kriptografi_Caesar_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    End Sub
End Class


Form Kriptografi Vernam

Public Class Kriptografi_Vernam_Chiper

    Private Sub Form3_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 plainteks_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles plainteks.TextChanged

    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

    Private Sub kunci_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles kunci.TextChanged

    End Sub
End Class

Form Kriptografi Gronsfeld



Public Class Kriptografi_Gronsfeld

    Private Sub Form4_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        plainteks.Text = ""
        kunci.Text = ""
        chiperteks.Text = ""

    End Sub

    Private Sub plainteks_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles plainteks.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 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)) - 48

            nEnc = ((nKata + nKunci) Mod 26)
            sPlain = sPlain & Chr((nEnc) + 65)
        Next i
        chiperteks.Text = sPlain
    End Sub
End Class


Form Kriptografi Viginere



Public Class Kriptografi_Viginere

    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

    Function Enkripsi(ByVal Teks 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 sPlain As String
        Dim nEnc As Integer
        j = 0
        jum = Len(Teks)
        sPlain = ""
        sKey = Kunci
        sKata = Teks
        For i = 1 To jum
            If j = Len(sKey) Then
                j = 1
            Else
                j = j + 1
            End If
            nKata = Asc(Mid(sKata, i, 1))

            nKunci = Asc(Mid(sKey, j, 1))

            nEnc = ((nKata + nKunci) Mod 256)

            sPlain = sPlain & Chr((nEnc))
        Next i
        Enkripsi = sPlain
    End Function

    Private Sub Kriptografi_Viginere_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    End Sub
End Class

Hasil Printout


- See more at: http://ericksaruksuk.blogspot.com/2014/01/pemograman-kriptografi.html#sthash.pzyNlDFw.dpuf
Listing Program


Form Menu


Public Class Menu

    Private Sub ClloseToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ClloseToolStripMenuItem.Click
        End
    End Sub

    Private Sub KriptografiCaesarToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KriptografiCaesarToolStripMenuItem.Click
        Kriptografi_Caesar.Show()
    End Sub

    Private Sub KriptografiVernamToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KriptografiVernamToolStripMenuItem.Click
        Kriptografi_Vernam_Chiper.Show()
    End Sub

    Private Sub KriptografiGronsfeldToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KriptografiGronsfeldToolStripMenuItem.Click
        Kriptografi_Gronsfeld.Show()
    End Sub

    Private Sub KriptografiViginereToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KriptografiViginereToolStripMenuItem.Click
        Kriptografi_Viginere.Show()
    End Sub
End Class

Form Kriptografi Caesar




Public Class Kriptografi_Caesar

    Private Sub btnenkripsi_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnenkripsi.Click
        Dim x As String = ""
        Dim xkalimat As String = ""
        For i = 1 To Len(plainteks.Text)
            x = Mid(plainteks.Text, i, i)
            x = Chr(Asc(x) + 3)
            xkalimat = xkalimat + x
        Next
        Chiperteks.Text = xkalimat
    End Sub

    Private Sub btndekripsi_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btndekripsi.Click
        Dim x As String = ""
        Dim xkalimat As String = ""
        For i = 1 To Len(plainteks.Text)
            x = Mid(plainteks.Text, i, i)
            x = Chr(Asc(x) - 3)
            xkalimat = xkalimat + x
        Next
        Chiperteks.Text = xkalimat
    End Sub

    Private Sub Kriptografi_Caesar_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    End Sub
End Class


Form Kriptografi Vernam

Public Class Kriptografi_Vernam_Chiper

    Private Sub Form3_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 plainteks_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles plainteks.TextChanged

    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

    Private Sub kunci_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles kunci.TextChanged

    End Sub
End Class

Form Kriptografi Gronsfeld



Public Class Kriptografi_Gronsfeld

    Private Sub Form4_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        plainteks.Text = ""
        kunci.Text = ""
        chiperteks.Text = ""

    End Sub

    Private Sub plainteks_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles plainteks.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 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)) - 48

            nEnc = ((nKata + nKunci) Mod 26)
            sPlain = sPlain & Chr((nEnc) + 65)
        Next i
        chiperteks.Text = sPlain
    End Sub
End Class


Form Kriptografi Viginere



Public Class Kriptografi_Viginere

    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

    Function Enkripsi(ByVal Teks 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 sPlain As String
        Dim nEnc As Integer
        j = 0
        jum = Len(Teks)
        sPlain = ""
        sKey = Kunci
        sKata = Teks
        For i = 1 To jum
            If j = Len(sKey) Then
                j = 1
            Else
                j = j + 1
            End If
            nKata = Asc(Mid(sKata, i, 1))

            nKunci = Asc(Mid(sKey, j, 1))

            nEnc = ((nKata + nKunci) Mod 256)

            sPlain = sPlain & Chr((nEnc))
        Next i
        Enkripsi = sPlain
    End Function

    Private Sub Kriptografi_Viginere_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    End Sub
End Class

Hasil Printout


- See more at: http://ericksaruksuk.blogspot.com/2014/01/pemograman-kriptografi.html#sthash.pzyNlDFw.dpuf
Listing Program


Form Menu


Public Class Menu

    Private Sub ClloseToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ClloseToolStripMenuItem.Click
        End
    End Sub

    Private Sub KriptografiCaesarToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KriptografiCaesarToolStripMenuItem.Click
        Kriptografi_Caesar.Show()
    End Sub

    Private Sub KriptografiVernamToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KriptografiVernamToolStripMenuItem.Click
        Kriptografi_Vernam_Chiper.Show()
    End Sub

    Private Sub KriptografiGronsfeldToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KriptografiGronsfeldToolStripMenuItem.Click
        Kriptografi_Gronsfeld.Show()
    End Sub

    Private Sub KriptografiViginereToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KriptografiViginereToolStripMenuItem.Click
        Kriptografi_Viginere.Show()
    End Sub
End Class

Form Kriptografi Caesar




Public Class Kriptografi_Caesar

    Private Sub btnenkripsi_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnenkripsi.Click
        Dim x As String = ""
        Dim xkalimat As String = ""
        For i = 1 To Len(plainteks.Text)
            x = Mid(plainteks.Text, i, i)
            x = Chr(Asc(x) + 3)
            xkalimat = xkalimat + x
        Next
        Chiperteks.Text = xkalimat
    End Sub

    Private Sub btndekripsi_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btndekripsi.Click
        Dim x As String = ""
        Dim xkalimat As String = ""
        For i = 1 To Len(plainteks.Text)
            x = Mid(plainteks.Text, i, i)
            x = Chr(Asc(x) - 3)
            xkalimat = xkalimat + x
        Next
        Chiperteks.Text = xkalimat
    End Sub

    Private Sub Kriptografi_Caesar_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    End Sub
End Class


Form Kriptografi Vernam

Public Class Kriptografi_Vernam_Chiper

    Private Sub Form3_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 plainteks_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles plainteks.TextChanged

    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

    Private Sub kunci_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles kunci.TextChanged

    End Sub
End Class

Form Kriptografi Gronsfeld



Public Class Kriptografi_Gronsfeld

    Private Sub Form4_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        plainteks.Text = ""
        kunci.Text = ""
        chiperteks.Text = ""

    End Sub

    Private Sub plainteks_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles plainteks.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 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)) - 48

            nEnc = ((nKata + nKunci) Mod 26)
            sPlain = sPlain & Chr((nEnc) + 65)
        Next i
        chiperteks.Text = sPlain
    End Sub
End Class


Form Kriptografi Viginere



Public Class Kriptografi_Viginere

    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

    Function Enkripsi(ByVal Teks 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 sPlain As String
        Dim nEnc As Integer
        j = 0
        jum = Len(Teks)
        sPlain = ""
        sKey = Kunci
        sKata = Teks
        For i = 1 To jum
            If j = Len(sKey) Then
                j = 1
            Else
                j = j + 1
            End If
            nKata = Asc(Mid(sKata, i, 1))

            nKunci = Asc(Mid(sKey, j, 1))

            nEnc = ((nKata + nKunci) Mod 256)

            sPlain = sPlain & Chr((nEnc))
        Next i
        Enkripsi = sPlain
    End Function

    Private Sub Kriptografi_Viginere_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    End Sub
End Class

Hasil Printout


- See more at: http://ericksaruksuk.blogspot.com/2014/01/pemograman-kriptografi.html#sthash.pzyNlDFw.dpuf
Listing Program


Form Menu


Public Class Menu

    Private Sub ClloseToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ClloseToolStripMenuItem.Click
        End
    End Sub

    Private Sub KriptografiCaesarToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KriptografiCaesarToolStripMenuItem.Click
        Kriptografi_Caesar.Show()
    End Sub

    Private Sub KriptografiVernamToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KriptografiVernamToolStripMenuItem.Click
        Kriptografi_Vernam_Chiper.Show()
    End Sub

    Private Sub KriptografiGronsfeldToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KriptografiGronsfeldToolStripMenuItem.Click
        Kriptografi_Gronsfeld.Show()
    End Sub

    Private Sub KriptografiViginereToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KriptografiViginereToolStripMenuItem.Click
        Kriptografi_Viginere.Show()
    End Sub
End Class

Form Kriptografi Caesar




Public Class Kriptografi_Caesar

    Private Sub btnenkripsi_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnenkripsi.Click
        Dim x As String = ""
        Dim xkalimat As String = ""
        For i = 1 To Len(plainteks.Text)
            x = Mid(plainteks.Text, i, i)
            x = Chr(Asc(x) + 3)
            xkalimat = xkalimat + x
        Next
        Chiperteks.Text = xkalimat
    End Sub

    Private Sub btndekripsi_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btndekripsi.Click
        Dim x As String = ""
        Dim xkalimat As String = ""
        For i = 1 To Len(plainteks.Text)
            x = Mid(plainteks.Text, i, i)
            x = Chr(Asc(x) - 3)
            xkalimat = xkalimat + x
        Next
        Chiperteks.Text = xkalimat
    End Sub

    Private Sub Kriptografi_Caesar_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    End Sub
End Class


Form Kriptografi Vernam

Public Class Kriptografi_Vernam_Chiper

    Private Sub Form3_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 plainteks_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles plainteks.TextChanged

    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

    Private Sub kunci_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles kunci.TextChanged

    End Sub
End Class

Form Kriptografi Gronsfeld



Public Class Kriptografi_Gronsfeld

    Private Sub Form4_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        plainteks.Text = ""
        kunci.Text = ""
        chiperteks.Text = ""

    End Sub

    Private Sub plainteks_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles plainteks.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 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)) - 48

            nEnc = ((nKata + nKunci) Mod 26)
            sPlain = sPlain & Chr((nEnc) + 65)
        Next i
        chiperteks.Text = sPlain
    End Sub
End Class


Form Kriptografi Viginere



Public Class Kriptografi_Viginere

    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

    Function Enkripsi(ByVal Teks 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 sPlain As String
        Dim nEnc As Integer
        j = 0
        jum = Len(Teks)
        sPlain = ""
        sKey = Kunci
        sKata = Teks
        For i = 1 To jum
            If j = Len(sKey) Then
                j = 1
            Else
                j = j + 1
            End If
            nKata = Asc(Mid(sKata, i, 1))

            nKunci = Asc(Mid(sKey, j, 1))

            nEnc = ((nKata + nKunci) Mod 256)

            sPlain = sPlain & Chr((nEnc))
        Next i
        Enkripsi = sPlain
    End Function

    Private Sub Kriptografi_Viginere_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    End Sub
End Class

Hasil Printout


- See more at: http://ericksaruksuk.blogspot.com/2014/01/pemograman-kriptografi.html#sthash.pzyNlDFw.dpuf
Listing Program


Form Menu


Public Class Menu

    Private Sub ClloseToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ClloseToolStripMenuItem.Click
        End
    End Sub

    Private Sub KriptografiCaesarToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KriptografiCaesarToolStripMenuItem.Click
        Kriptografi_Caesar.Show()
    End Sub

    Private Sub KriptografiVernamToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KriptografiVernamToolStripMenuItem.Click
        Kriptografi_Vernam_Chiper.Show()
    End Sub

    Private Sub KriptografiGronsfeldToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KriptografiGronsfeldToolStripMenuItem.Click
        Kriptografi_Gronsfeld.Show()
    End Sub

    Private Sub KriptografiViginereToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KriptografiViginereToolStripMenuItem.Click
        Kriptografi_Viginere.Show()
    End Sub
End Class

Form Kriptografi Caesar




Public Class Kriptografi_Caesar

    Private Sub btnenkripsi_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnenkripsi.Click
        Dim x As String = ""
        Dim xkalimat As String = ""
        For i = 1 To Len(plainteks.Text)
            x = Mid(plainteks.Text, i, i)
            x = Chr(Asc(x) + 3)
            xkalimat = xkalimat + x
        Next
        Chiperteks.Text = xkalimat
    End Sub

    Private Sub btndekripsi_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btndekripsi.Click
        Dim x As String = ""
        Dim xkalimat As String = ""
        For i = 1 To Len(plainteks.Text)
            x = Mid(plainteks.Text, i, i)
            x = Chr(Asc(x) - 3)
            xkalimat = xkalimat + x
        Next
        Chiperteks.Text = xkalimat
    End Sub

    Private Sub Kriptografi_Caesar_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    End Sub
End Class


Form Kriptografi Vernam

Public Class Kriptografi_Vernam_Chiper

    Private Sub Form3_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 plainteks_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles plainteks.TextChanged

    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

    Private Sub kunci_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles kunci.TextChanged

    End Sub
End Class

Form Kriptografi Gronsfeld



Public Class Kriptografi_Gronsfeld

    Private Sub Form4_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        plainteks.Text = ""
        kunci.Text = ""
        chiperteks.Text = ""

    End Sub

    Private Sub plainteks_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles plainteks.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 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)) - 48

            nEnc = ((nKata + nKunci) Mod 26)
            sPlain = sPlain & Chr((nEnc) + 65)
        Next i
        chiperteks.Text = sPlain
    End Sub
End Class


Form Kriptografi Viginere



Public Class Kriptografi_Viginere

    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

    Function Enkripsi(ByVal Teks 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 sPlain As String
        Dim nEnc As Integer
        j = 0
        jum = Len(Teks)
        sPlain = ""
        sKey = Kunci
        sKata = Teks
        For i = 1 To jum
            If j = Len(sKey) Then
                j = 1
            Else
                j = j + 1
            End If
            nKata = Asc(Mid(sKata, i, 1))

            nKunci = Asc(Mid(sKey, j, 1))

            nEnc = ((nKata + nKunci) Mod 256)

            sPlain = sPlain & Chr((nEnc))
        Next i
        Enkripsi = sPlain
    End Function

    Private Sub Kriptografi_Viginere_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    End Sub
End Class

Hasil Printout


- See more at: http://ericksaruksuk.blogspot.com/2014/01/pemograman-kriptografi.html#sthash.pzyNlDFw.dpuf
Listing Program


Form Menu


Public Class Menu

    Private Sub ClloseToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ClloseToolStripMenuItem.Click
        End
    End Sub

    Private Sub KriptografiCaesarToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KriptografiCaesarToolStripMenuItem.Click
        Kriptografi_Caesar.Show()
    End Sub

    Private Sub KriptografiVernamToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KriptografiVernamToolStripMenuItem.Click
        Kriptografi_Vernam_Chiper.Show()
    End Sub

    Private Sub KriptografiGronsfeldToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KriptografiGronsfeldToolStripMenuItem.Click
        Kriptografi_Gronsfeld.Show()
    End Sub

    Private Sub KriptografiViginereToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KriptografiViginereToolStripMenuItem.Click
        Kriptografi_Viginere.Show()
    End Sub
End Class

Form Kriptografi Caesar




Public Class Kriptografi_Caesar

    Private Sub btnenkripsi_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnenkripsi.Click
        Dim x As String = ""
        Dim xkalimat As String = ""
        For i = 1 To Len(plainteks.Text)
            x = Mid(plainteks.Text, i, i)
            x = Chr(Asc(x) + 3)
            xkalimat = xkalimat + x
        Next
        Chiperteks.Text = xkalimat
    End Sub

    Private Sub btndekripsi_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btndekripsi.Click
        Dim x As String = ""
        Dim xkalimat As String = ""
        For i = 1 To Len(plainteks.Text)
            x = Mid(plainteks.Text, i, i)
            x = Chr(Asc(x) - 3)
            xkalimat = xkalimat + x
        Next
        Chiperteks.Text = xkalimat
    End Sub

    Private Sub Kriptografi_Caesar_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    End Sub
End Class


Form Kriptografi Vernam

Public Class Kriptografi_Vernam_Chiper

    Private Sub Form3_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 plainteks_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles plainteks.TextChanged

    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

    Private Sub kunci_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles kunci.TextChanged

    End Sub
End Class

Form Kriptografi Gronsfeld



Public Class Kriptografi_Gronsfeld

    Private Sub Form4_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        plainteks.Text = ""
        kunci.Text = ""
        chiperteks.Text = ""

    End Sub

    Private Sub plainteks_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles plainteks.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 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)) - 48

            nEnc = ((nKata + nKunci) Mod 26)
            sPlain = sPlain & Chr((nEnc) + 65)
        Next i
        chiperteks.Text = sPlain
    End Sub
End Class


Form Kriptografi Viginere



Public Class Kriptografi_Viginere

    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

    Function Enkripsi(ByVal Teks 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 sPlain As String
        Dim nEnc As Integer
        j = 0
        jum = Len(Teks)
        sPlain = ""
        sKey = Kunci
        sKata = Teks
        For i = 1 To jum
            If j = Len(sKey) Then
                j = 1
            Else
                j = j + 1
            End If
            nKata = Asc(Mid(sKata, i, 1))

            nKunci = Asc(Mid(sKey, j, 1))

            nEnc = ((nKata + nKunci) Mod 256)

            sPlain = sPlain & Chr((nEnc))
        Next i
        Enkripsi = sPlain
    End Function

    Private Sub Kriptografi_Viginere_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    End Sub
End Class

Hasil Printout


- See more at: http://ericksaruksuk.blogspot.com/2014/01/pemograman-kriptografi.html#sthash.pzyNlDFw.dpuf
Listing Program


Form Menu


Public Class Menu

    Private Sub ClloseToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ClloseToolStripMenuItem.Click
        End
    End Sub

    Private Sub KriptografiCaesarToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KriptografiCaesarToolStripMenuItem.Click
        Kriptografi_Caesar.Show()
    End Sub

    Private Sub KriptografiVernamToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KriptografiVernamToolStripMenuItem.Click
        Kriptografi_Vernam_Chiper.Show()
    End Sub

    Private Sub KriptografiGronsfeldToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KriptografiGronsfeldToolStripMenuItem.Click
        Kriptografi_Gronsfeld.Show()
    End Sub

    Private Sub KriptografiViginereToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KriptografiViginereToolStripMenuItem.Click
        Kriptografi_Viginere.Show()
    End Sub
End Class

Form Kriptografi Caesar




Public Class Kriptografi_Caesar

    Private Sub btnenkripsi_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnenkripsi.Click
        Dim x As String = ""
        Dim xkalimat As String = ""
        For i = 1 To Len(plainteks.Text)
            x = Mid(plainteks.Text, i, i)
            x = Chr(Asc(x) + 3)
            xkalimat = xkalimat + x
        Next
        Chiperteks.Text = xkalimat
    End Sub

    Private Sub btndekripsi_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btndekripsi.Click
        Dim x As String = ""
        Dim xkalimat As String = ""
        For i = 1 To Len(plainteks.Text)
            x = Mid(plainteks.Text, i, i)
            x = Chr(Asc(x) - 3)
            xkalimat = xkalimat + x
        Next
        Chiperteks.Text = xkalimat
    End Sub

    Private Sub Kriptografi_Caesar_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    End Sub
End Class


Form Kriptografi Vernam

Public Class Kriptografi_Vernam_Chiper

    Private Sub Form3_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 plainteks_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles plainteks.TextChanged

    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

    Private Sub kunci_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles kunci.TextChanged

    End Sub
End Class

Form Kriptografi Gronsfeld



Public Class Kriptografi_Gronsfeld

    Private Sub Form4_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        plainteks.Text = ""
        kunci.Text = ""
        chiperteks.Text = ""

    End Sub

    Private Sub plainteks_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles plainteks.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 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)) - 48

            nEnc = ((nKata + nKunci) Mod 26)
            sPlain = sPlain & Chr((nEnc) + 65)
        Next i
        chiperteks.Text = sPlain
    End Sub
End Class


Form Kriptografi Viginere



Public Class Kriptografi_Viginere

    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

    Function Enkripsi(ByVal Teks 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 sPlain As String
        Dim nEnc As Integer
        j = 0
        jum = Len(Teks)
        sPlain = ""
        sKey = Kunci
        sKata = Teks
        For i = 1 To jum
            If j = Len(sKey) Then
                j = 1
            Else
                j = j + 1
            End If
            nKata = Asc(Mid(sKata, i, 1))

            nKunci = Asc(Mid(sKey, j, 1))

            nEnc = ((nKata + nKunci) Mod 256)

            sPlain = sPlain & Chr((nEnc))
        Next i
        Enkripsi = sPlain
    End Function

    Private Sub Kriptografi_Viginere_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    End Sub
End Class

Hasil Printout


- See more at: http://ericksaruksuk.blogspot.com/2014/01/pemograman-kriptografi.html#sthash.pzyNlDFw.dpuf
Listing Program


Form Menu


Public Class Menu

    Private Sub ClloseToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ClloseToolStripMenuItem.Click
        End
    End Sub

    Private Sub KriptografiCaesarToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KriptografiCaesarToolStripMenuItem.Click
        Kriptografi_Caesar.Show()
    End Sub

    Private Sub KriptografiVernamToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KriptografiVernamToolStripMenuItem.Click
        Kriptografi_Vernam_Chiper.Show()
    End Sub

    Private Sub KriptografiGronsfeldToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KriptografiGronsfeldToolStripMenuItem.Click
        Kriptografi_Gronsfeld.Show()
    End Sub

    Private Sub KriptografiViginereToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KriptografiViginereToolStripMenuItem.Click
        Kriptografi_Viginere.Show()
    End Sub
End Class

Form Kriptografi Caesar




Public Class Kriptografi_Caesar

    Private Sub btnenkripsi_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnenkripsi.Click
        Dim x As String = ""
        Dim xkalimat As String = ""
        For i = 1 To Len(plainteks.Text)
            x = Mid(plainteks.Text, i, i)
            x = Chr(Asc(x) + 3)
            xkalimat = xkalimat + x
        Next
        Chiperteks.Text = xkalimat
    End Sub

    Private Sub btndekripsi_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btndekripsi.Click
        Dim x As String = ""
        Dim xkalimat As String = ""
        For i = 1 To Len(plainteks.Text)
            x = Mid(plainteks.Text, i, i)
            x = Chr(Asc(x) - 3)
            xkalimat = xkalimat + x
        Next
        Chiperteks.Text = xkalimat
    End Sub

    Private Sub Kriptografi_Caesar_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    End Sub
End Class


Form Kriptografi Vernam

Public Class Kriptografi_Vernam_Chiper

    Private Sub Form3_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 plainteks_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles plainteks.TextChanged

    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

    Private Sub kunci_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles kunci.TextChanged

    End Sub
End Class

Form Kriptografi Gronsfeld



Public Class Kriptografi_Gronsfeld

    Private Sub Form4_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        plainteks.Text = ""
        kunci.Text = ""
        chiperteks.Text = ""

    End Sub

    Private Sub plainteks_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles plainteks.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 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)) - 48

            nEnc = ((nKata + nKunci) Mod 26)
            sPlain = sPlain & Chr((nEnc) + 65)
        Next i
        chiperteks.Text = sPlain
    End Sub
End Class


Form Kriptografi Viginere



Public Class Kriptografi_Viginere

    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

    Function Enkripsi(ByVal Teks 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 sPlain As String
        Dim nEnc As Integer
        j = 0
        jum = Len(Teks)
        sPlain = ""
        sKey = Kunci
        sKata = Teks
        For i = 1 To jum
            If j = Len(sKey) Then
                j = 1
            Else
                j = j + 1
            End If
            nKata = Asc(Mid(sKata, i, 1))

            nKunci = Asc(Mid(sKey, j, 1))

            nEnc = ((nKata + nKunci) Mod 256)

            sPlain = sPlain & Chr((nEnc))
        Next i
        Enkripsi = sPlain
    End Function

    Private Sub Kriptografi_Viginere_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    End Sub
End Class

Hasil Printout


- See more at: http://ericksaruksuk.blogspot.com/2014/01/pemograman-kriptografi.html#sthash.pzyNlDFw.dpuf
Listing Program


Form Menu


Public Class Menu

    Private Sub ClloseToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ClloseToolStripMenuItem.Click
        End
    End Sub

    Private Sub KriptografiCaesarToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KriptografiCaesarToolStripMenuItem.Click
        Kriptografi_Caesar.Show()
    End Sub

    Private Sub KriptografiVernamToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KriptografiVernamToolStripMenuItem.Click
        Kriptografi_Vernam_Chiper.Show()
    End Sub

    Private Sub KriptografiGronsfeldToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KriptografiGronsfeldToolStripMenuItem.Click
        Kriptografi_Gronsfeld.Show()
    End Sub

    Private Sub KriptografiViginereToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KriptografiViginereToolStripMenuItem.Click
        Kriptografi_Viginere.Show()
    End Sub
End Class

Form Kriptografi Caesar




Public Class Kriptografi_Caesar

    Private Sub btnenkripsi_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnenkripsi.Click
        Dim x As String = ""
        Dim xkalimat As String = ""
        For i = 1 To Len(plainteks.Text)
            x = Mid(plainteks.Text, i, i)
            x = Chr(Asc(x) + 3)
            xkalimat = xkalimat + x
        Next
        Chiperteks.Text = xkalimat
    End Sub

    Private Sub btndekripsi_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btndekripsi.Click
        Dim x As String = ""
        Dim xkalimat As String = ""
        For i = 1 To Len(plainteks.Text)
            x = Mid(plainteks.Text, i, i)
            x = Chr(Asc(x) - 3)
            xkalimat = xkalimat + x
        Next
        Chiperteks.Text = xkalimat
    End Sub

    Private Sub Kriptografi_Caesar_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    End Sub
End Class


Form Kriptografi Vernam

Public Class Kriptografi_Vernam_Chiper

    Private Sub Form3_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 plainteks_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles plainteks.TextChanged

    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

    Private Sub kunci_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles kunci.TextChanged

    End Sub
End Class

Form Kriptografi Gronsfeld



Public Class Kriptografi_Gronsfeld

    Private Sub Form4_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        plainteks.Text = ""
        kunci.Text = ""
        chiperteks.Text = ""

    End Sub

    Private Sub plainteks_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles plainteks.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 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)) - 48

            nEnc = ((nKata + nKunci) Mod 26)
            sPlain = sPlain & Chr((nEnc) + 65)
        Next i
        chiperteks.Text = sPlain
    End Sub
End Class


Form Kriptografi Viginere



Public Class Kriptografi_Viginere

    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

    Function Enkripsi(ByVal Teks 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 sPlain As String
        Dim nEnc As Integer
        j = 0
        jum = Len(Teks)
        sPlain = ""
        sKey = Kunci
        sKata = Teks
        For i = 1 To jum
            If j = Len(sKey) Then
                j = 1
            Else
                j = j + 1
            End If
            nKata = Asc(Mid(sKata, i, 1))

            nKunci = Asc(Mid(sKey, j, 1))

            nEnc = ((nKata + nKunci) Mod 256)

            sPlain = sPlain & Chr((nEnc))
        Next i
        Enkripsi = sPlain
    End Function

    Private Sub Kriptografi_Viginere_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    End Sub
End Class

Hasil Printout


- See more at: http://ericksaruksuk.blogspot.com/2014/01/pemograman-kriptografi.html#sthash.pzyNlDFw.dpuf
Listing Program


Form Menu


Public Class Menu

    Private Sub ClloseToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ClloseToolStripMenuItem.Click
        End
    End Sub

    Private Sub KriptografiCaesarToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KriptografiCaesarToolStripMenuItem.Click
        Kriptografi_Caesar.Show()
    End Sub

    Private Sub KriptografiVernamToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KriptografiVernamToolStripMenuItem.Click
        Kriptografi_Vernam_Chiper.Show()
    End Sub

    Private Sub KriptografiGronsfeldToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KriptografiGronsfeldToolStripMenuItem.Click
        Kriptografi_Gronsfeld.Show()
    End Sub

    Private Sub KriptografiViginereToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KriptografiViginereToolStripMenuItem.Click
        Kriptografi_Viginere.Show()
    End Sub
End Class

Form Kriptografi Caesar




Public Class Kriptografi_Caesar

    Private Sub btnenkripsi_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnenkripsi.Click
        Dim x As String = ""
        Dim xkalimat As String = ""
        For i = 1 To Len(plainteks.Text)
            x = Mid(plainteks.Text, i, i)
            x = Chr(Asc(x) + 3)
            xkalimat = xkalimat + x
        Next
        Chiperteks.Text = xkalimat
    End Sub

    Private Sub btndekripsi_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btndekripsi.Click
        Dim x As String = ""
        Dim xkalimat As String = ""
        For i = 1 To Len(plainteks.Text)
            x = Mid(plainteks.Text, i, i)
            x = Chr(Asc(x) - 3)
            xkalimat = xkalimat + x
        Next
        Chiperteks.Text = xkalimat
    End Sub

    Private Sub Kriptografi_Caesar_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    End Sub
End Class


Form Kriptografi Vernam

Public Class Kriptografi_Vernam_Chiper

    Private Sub Form3_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 plainteks_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles plainteks.TextChanged

    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

    Private Sub kunci_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles kunci.TextChanged

    End Sub
End Class

Form Kriptografi Gronsfeld



Public Class Kriptografi_Gronsfeld

    Private Sub Form4_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        plainteks.Text = ""
        kunci.Text = ""
        chiperteks.Text = ""

    End Sub

    Private Sub plainteks_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles plainteks.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 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)) - 48

            nEnc = ((nKata + nKunci) Mod 26)
            sPlain = sPlain & Chr((nEnc) + 65)
        Next i
        chiperteks.Text = sPlain
    End Sub
End Class


Form Kriptografi Viginere



Public Class Kriptografi_Viginere

    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

    Function Enkripsi(ByVal Teks 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 sPlain As String
        Dim nEnc As Integer
        j = 0
        jum = Len(Teks)
        sPlain = ""
        sKey = Kunci
        sKata = Teks
        For i = 1 To jum
            If j = Len(sKey) Then
                j = 1
            Else
                j = j + 1
            End If
            nKata = Asc(Mid(sKata, i, 1))

            nKunci = Asc(Mid(sKey, j, 1))

            nEnc = ((nKata + nKunci) Mod 256)

            sPlain = sPlain & Chr((nEnc))
        Next i
        Enkripsi = sPlain
    End Function

    Private Sub Kriptografi_Viginere_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    End Sub
End Class

Hasil Printout


- See more at: http://ericksaruksuk.blogspot.com/2014/01/pemograman-kriptografi.html#sthash.pzyNlDFw.dpuf
Listing Program


Form Menu


Public Class Menu

    Private Sub ClloseToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ClloseToolStripMenuItem.Click
        End
    End Sub

    Private Sub KriptografiCaesarToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KriptografiCaesarToolStripMenuItem.Click
        Kriptografi_Caesar.Show()
    End Sub

    Private Sub KriptografiVernamToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KriptografiVernamToolStripMenuItem.Click
        Kriptografi_Vernam_Chiper.Show()
    End Sub

    Private Sub KriptografiGronsfeldToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KriptografiGronsfeldToolStripMenuItem.Click
        Kriptografi_Gronsfeld.Show()
    End Sub

    Private Sub KriptografiViginereToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KriptografiViginereToolStripMenuItem.Click
        Kriptografi_Viginere.Show()
    End Sub
End Class

Form Kriptografi Caesar




Public Class Kriptografi_Caesar

    Private Sub btnenkripsi_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnenkripsi.Click
        Dim x As String = ""
        Dim xkalimat As String = ""
        For i = 1 To Len(plainteks.Text)
            x = Mid(plainteks.Text, i, i)
            x = Chr(Asc(x) + 3)
            xkalimat = xkalimat + x
        Next
        Chiperteks.Text = xkalimat
    End Sub

    Private Sub btndekripsi_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btndekripsi.Click
        Dim x As String = ""
        Dim xkalimat As String = ""
        For i = 1 To Len(plainteks.Text)
            x = Mid(plainteks.Text, i, i)
            x = Chr(Asc(x) - 3)
            xkalimat = xkalimat + x
        Next
        Chiperteks.Text = xkalimat
    End Sub

    Private Sub Kriptografi_Caesar_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    End Sub
End Class


Form Kriptografi Vernam

Public Class Kriptografi_Vernam_Chiper

    Private Sub Form3_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 plainteks_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles plainteks.TextChanged

    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

    Private Sub kunci_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles kunci.TextChanged

    End Sub
End Class

Form Kriptografi Gronsfeld



Public Class Kriptografi_Gronsfeld

    Private Sub Form4_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        plainteks.Text = ""
        kunci.Text = ""
        chiperteks.Text = ""

    End Sub

    Private Sub plainteks_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles plainteks.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 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)) - 48

            nEnc = ((nKata + nKunci) Mod 26)
            sPlain = sPlain & Chr((nEnc) + 65)
        Next i
        chiperteks.Text = sPlain
    End Sub
End Class


Form Kriptografi Viginere



Public Class Kriptografi_Viginere

    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

    Function Enkripsi(ByVal Teks 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 sPlain As String
        Dim nEnc As Integer
        j = 0
        jum = Len(Teks)
        sPlain = ""
        sKey = Kunci
        sKata = Teks
        For i = 1 To jum
            If j = Len(sKey) Then
                j = 1
            Else
                j = j + 1
            End If
            nKata = Asc(Mid(sKata, i, 1))

            nKunci = Asc(Mid(sKey, j, 1))

            nEnc = ((nKata + nKunci) Mod 256)

            sPlain = sPlain & Chr((nEnc))
        Next i
        Enkripsi = sPlain
    End Function

    Private Sub Kriptografi_Viginere_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    End Sub
End Class

Hasil Printout


- See more at: http://ericksaruksuk.blogspot.com/2014/01/pemograman-kriptografi.html#sthash.pzyNlDFw.dpuf
Listing Program


Form Menu


Public Class Menu

    Private Sub ClloseToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ClloseToolStripMenuItem.Click
        End
    End Sub

    Private Sub KriptografiCaesarToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KriptografiCaesarToolStripMenuItem.Click
        Kriptografi_Caesar.Show()
    End Sub

    Private Sub KriptografiVernamToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KriptografiVernamToolStripMenuItem.Click
        Kriptografi_Vernam_Chiper.Show()
    End Sub

    Private Sub KriptografiGronsfeldToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KriptografiGronsfeldToolStripMenuItem.Click
        Kriptografi_Gronsfeld.Show()
    End Sub

    Private Sub KriptografiViginereToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KriptografiViginereToolStripMenuItem.Click
        Kriptografi_Viginere.Show()
    End Sub
End Class

Form Kriptografi Caesar




Public Class Kriptografi_Caesar

    Private Sub btnenkripsi_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnenkripsi.Click
        Dim x As String = ""
        Dim xkalimat As String = ""
        For i = 1 To Len(plainteks.Text)
            x = Mid(plainteks.Text, i, i)
            x = Chr(Asc(x) + 3)
            xkalimat = xkalimat + x
        Next
        Chiperteks.Text = xkalimat
    End Sub

    Private Sub btndekripsi_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btndekripsi.Click
        Dim x As String = ""
        Dim xkalimat As String = ""
        For i = 1 To Len(plainteks.Text)
            x = Mid(plainteks.Text, i, i)
            x = Chr(Asc(x) - 3)
            xkalimat = xkalimat + x
        Next
        Chiperteks.Text = xkalimat
    End Sub

    Private Sub Kriptografi_Caesar_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    End Sub
End Class


Form Kriptografi Vernam

Public Class Kriptografi_Vernam_Chiper

    Private Sub Form3_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 plainteks_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles plainteks.TextChanged

    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

    Private Sub kunci_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles kunci.TextChanged

    End Sub
End Class

Form Kriptografi Gronsfeld



Public Class Kriptografi_Gronsfeld

    Private Sub Form4_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        plainteks.Text = ""
        kunci.Text = ""
        chiperteks.Text = ""

    End Sub

    Private Sub plainteks_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles plainteks.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 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)) - 48

            nEnc = ((nKata + nKunci) Mod 26)
            sPlain = sPlain & Chr((nEnc) + 65)
        Next i
        chiperteks.Text = sPlain
    End Sub
End Class


Form Kriptografi Viginere



Public Class Kriptografi_Viginere

    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

    Function Enkripsi(ByVal Teks 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 sPlain As String
        Dim nEnc As Integer
        j = 0
        jum = Len(Teks)
        sPlain = ""
        sKey = Kunci
        sKata = Teks
        For i = 1 To jum
            If j = Len(sKey) Then
                j = 1
            Else
                j = j + 1
            End If
            nKata = Asc(Mid(sKata, i, 1))

            nKunci = Asc(Mid(sKey, j, 1))

            nEnc = ((nKata + nKunci) Mod 256)

            sPlain = sPlain & Chr((nEnc))
        Next i
        Enkripsi = sPlain
    End Function

    Private Sub Kriptografi_Viginere_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    End Sub
End Class

Hasil Printout


- See more at: http://ericksaruksuk.blogspot.com/2014/01/pemograman-kriptografi.html#sthash.pzyNlDFw.dpuf
Listing Program


Form Menu


Public Class Menu

    Private Sub ClloseToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ClloseToolStripMenuItem.Click
        End
    End Sub

    Private Sub KriptografiCaesarToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KriptografiCaesarToolStripMenuItem.Click
        Kriptografi_Caesar.Show()
    End Sub

    Private Sub KriptografiVernamToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KriptografiVernamToolStripMenuItem.Click
        Kriptografi_Vernam_Chiper.Show()
    End Sub

    Private Sub KriptografiGronsfeldToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KriptografiGronsfeldToolStripMenuItem.Click
        Kriptografi_Gronsfeld.Show()
    End Sub

    Private Sub KriptografiViginereToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KriptografiViginereToolStripMenuItem.Click
        Kriptografi_Viginere.Show()
    End Sub
End Class

Form Kriptografi Caesar




Public Class Kriptografi_Caesar

    Private Sub btnenkripsi_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnenkripsi.Click
        Dim x As String = ""
        Dim xkalimat As String = ""
        For i = 1 To Len(plainteks.Text)
            x = Mid(plainteks.Text, i, i)
            x = Chr(Asc(x) + 3)
            xkalimat = xkalimat + x
        Next
        Chiperteks.Text = xkalimat
    End Sub

    Private Sub btndekripsi_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btndekripsi.Click
        Dim x As String = ""
        Dim xkalimat As String = ""
        For i = 1 To Len(plainteks.Text)
            x = Mid(plainteks.Text, i, i)
            x = Chr(Asc(x) - 3)
            xkalimat = xkalimat + x
        Next
        Chiperteks.Text = xkalimat
    End Sub

    Private Sub Kriptografi_Caesar_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    End Sub
End Class


Form Kriptografi Vernam

Public Class Kriptografi_Vernam_Chiper

    Private Sub Form3_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 plainteks_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles plainteks.TextChanged

    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

    Private Sub kunci_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles kunci.TextChanged

    End Sub
End Class

Form Kriptografi Gronsfeld



Public Class Kriptografi_Gronsfeld

    Private Sub Form4_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        plainteks.Text = ""
        kunci.Text = ""
        chiperteks.Text = ""

    End Sub

    Private Sub plainteks_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles plainteks.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 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)) - 48

            nEnc = ((nKata + nKunci) Mod 26)
            sPlain = sPlain & Chr((nEnc) + 65)
        Next i
        chiperteks.Text = sPlain
    End Sub
End Class


Form Kriptografi Viginere



Public Class Kriptografi_Viginere

    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

    Function Enkripsi(ByVal Teks 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 sPlain As String
        Dim nEnc As Integer
        j = 0
        jum = Len(Teks)
        sPlain = ""
        sKey = Kunci
        sKata = Teks
        For i = 1 To jum
            If j = Len(sKey) Then
                j = 1
            Else
                j = j + 1
            End If
            nKata = Asc(Mid(sKata, i, 1))

            nKunci = Asc(Mid(sKey, j, 1))

            nEnc = ((nKata + nKunci) Mod 256)

            sPlain = sPlain & Chr((nEnc))
        Next i
        Enkripsi = sPlain
    End Function

    Private Sub Kriptografi_Viginere_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    End Sub
End Class

Hasil Printout


- See more at: http://ericksaruksuk.blogspot.com/2014/01/pemograman-kriptografi.html#sthash.pzyNlDFw.dpuf
Listing Program


Form Menu


Public Class Menu

    Private Sub ClloseToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ClloseToolStripMenuItem.Click
        End
    End Sub

    Private Sub KriptografiCaesarToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KriptografiCaesarToolStripMenuItem.Click
        Kriptografi_Caesar.Show()
    End Sub

    Private Sub KriptografiVernamToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KriptografiVernamToolStripMenuItem.Click
        Kriptografi_Vernam_Chiper.Show()
    End Sub

    Private Sub KriptografiGronsfeldToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KriptografiGronsfeldToolStripMenuItem.Click
        Kriptografi_Gronsfeld.Show()
    End Sub

    Private Sub KriptografiViginereToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KriptografiViginereToolStripMenuItem.Click
        Kriptografi_Viginere.Show()
    End Sub
End Class

Form Kriptografi Caesar




Public Class Kriptografi_Caesar

    Private Sub btnenkripsi_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnenkripsi.Click
        Dim x As String = ""
        Dim xkalimat As String = ""
        For i = 1 To Len(plainteks.Text)
            x = Mid(plainteks.Text, i, i)
            x = Chr(Asc(x) + 3)
            xkalimat = xkalimat + x
        Next
        Chiperteks.Text = xkalimat
    End Sub

    Private Sub btndekripsi_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btndekripsi.Click
        Dim x As String = ""
        Dim xkalimat As String = ""
        For i = 1 To Len(plainteks.Text)
            x = Mid(plainteks.Text, i, i)
            x = Chr(Asc(x) - 3)
            xkalimat = xkalimat + x
        Next
        Chiperteks.Text = xkalimat
    End Sub

    Private Sub Kriptografi_Caesar_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    End Sub
End Class


Form Kriptografi Vernam

Public Class Kriptografi_Vernam_Chiper

    Private Sub Form3_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 plainteks_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles plainteks.TextChanged

    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

    Private Sub kunci_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles kunci.TextChanged

    End Sub
End Class

Form Kriptografi Gronsfeld



Public Class Kriptografi_Gronsfeld

    Private Sub Form4_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        plainteks.Text = ""
        kunci.Text = ""
        chiperteks.Text = ""

    End Sub

    Private Sub plainteks_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles plainteks.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 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)) - 48

            nEnc = ((nKata + nKunci) Mod 26)
            sPlain = sPlain & Chr((nEnc) + 65)
        Next i
        chiperteks.Text = sPlain
    End Sub
End Class


Form Kriptografi Viginere



Public Class Kriptografi_Viginere

    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

    Function Enkripsi(ByVal Teks 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 sPlain As String
        Dim nEnc As Integer
        j = 0
        jum = Len(Teks)
        sPlain = ""
        sKey = Kunci
        sKata = Teks
        For i = 1 To jum
            If j = Len(sKey) Then
                j = 1
            Else
                j = j + 1
            End If
            nKata = Asc(Mid(sKata, i, 1))

            nKunci = Asc(Mid(sKey, j, 1))

            nEnc = ((nKata + nKunci) Mod 256)

            sPlain = sPlain & Chr((nEnc))
        Next i
        Enkripsi = sPlain
    End Function

    Private Sub Kriptografi_Viginere_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    End Sub
End Class

Hasil Printout


- See more at: http://ericksaruksuk.blogspot.com/2014/01/pemograman-kriptografi.html#sthash.pzyNlDFw.dpuf
Listing Program


Form Menu


Public Class Menu

    Private Sub ClloseToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ClloseToolStripMenuItem.Click
        End
    End Sub

    Private Sub KriptografiCaesarToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KriptografiCaesarToolStripMenuItem.Click
        Kriptografi_Caesar.Show()
    End Sub

    Private Sub KriptografiVernamToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KriptografiVernamToolStripMenuItem.Click
        Kriptografi_Vernam_Chiper.Show()
    End Sub

    Private Sub KriptografiGronsfeldToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KriptografiGronsfeldToolStripMenuItem.Click
        Kriptografi_Gronsfeld.Show()
    End Sub

    Private Sub KriptografiViginereToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KriptografiViginereToolStripMenuItem.Click
        Kriptografi_Viginere.Show()
    End Sub
End Class

Form Kriptografi Caesar




Public Class Kriptografi_Caesar

    Private Sub btnenkripsi_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnenkripsi.Click
        Dim x As String = ""
        Dim xkalimat As String = ""
        For i = 1 To Len(plainteks.Text)
            x = Mid(plainteks.Text, i, i)
            x = Chr(Asc(x) + 3)
            xkalimat = xkalimat + x
        Next
        Chiperteks.Text = xkalimat
    End Sub

    Private Sub btndekripsi_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btndekripsi.Click
        Dim x As String = ""
        Dim xkalimat As String = ""
        For i = 1 To Len(plainteks.Text)
            x = Mid(plainteks.Text, i, i)
            x = Chr(Asc(x) - 3)
            xkalimat = xkalimat + x
        Next
        Chiperteks.Text = xkalimat
    End Sub

    Private Sub Kriptografi_Caesar_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    End Sub
End Class


Form Kriptografi Vernam

Public Class Kriptografi_Vernam_Chiper

    Private Sub Form3_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 plainteks_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles plainteks.TextChanged

    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

    Private Sub kunci_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles kunci.TextChanged

    End Sub
End Class

Form Kriptografi Gronsfeld



Public Class Kriptografi_Gronsfeld

    Private Sub Form4_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        plainteks.Text = ""
        kunci.Text = ""
        chiperteks.Text = ""

    End Sub

    Private Sub plainteks_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles plainteks.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 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)) - 48

            nEnc = ((nKata + nKunci) Mod 26)
            sPlain = sPlain & Chr((nEnc) + 65)
        Next i
        chiperteks.Text = sPlain
    End Sub
End Class


Form Kriptografi Viginere



Public Class Kriptografi_Viginere

    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

    Function Enkripsi(ByVal Teks 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 sPlain As String
        Dim nEnc As Integer
        j = 0
        jum = Len(Teks)
        sPlain = ""
        sKey = Kunci
        sKata = Teks
        For i = 1 To jum
            If j = Len(sKey) Then
                j = 1
            Else
                j = j + 1
            End If
            nKata = Asc(Mid(sKata, i, 1))

            nKunci = Asc(Mid(sKey, j, 1))

            nEnc = ((nKata + nKunci) Mod 256)

            sPlain = sPlain & Chr((nEnc))
        Next i
        Enkripsi = sPlain
    End Function

    Private Sub Kriptografi_Viginere_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    End Sub
End Class

Hasil Printout


- See more at: http://ericksaruksuk.blogspot.com/2014/01/pemograman-kriptografi.html#sthash.pzyNlDFw.dpuf
Listing Program


Form Menu


Public Class Menu

    Private Sub ClloseToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ClloseToolStripMenuItem.Click
        End
    End Sub

    Private Sub KriptografiCaesarToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KriptografiCaesarToolStripMenuItem.Click
        Kriptografi_Caesar.Show()
    End Sub

    Private Sub KriptografiVernamToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KriptografiVernamToolStripMenuItem.Click
        Kriptografi_Vernam_Chiper.Show()
    End Sub

    Private Sub KriptografiGronsfeldToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KriptografiGronsfeldToolStripMenuItem.Click
        Kriptografi_Gronsfeld.Show()
    End Sub

    Private Sub KriptografiViginereToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KriptografiViginereToolStripMenuItem.Click
        Kriptografi_Viginere.Show()
    End Sub
End Class

Form Kriptografi Caesar




Public Class Kriptografi_Caesar

    Private Sub btnenkripsi_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnenkripsi.Click
        Dim x As String = ""
        Dim xkalimat As String = ""
        For i = 1 To Len(plainteks.Text)
            x = Mid(plainteks.Text, i, i)
            x = Chr(Asc(x) + 3)
            xkalimat = xkalimat + x
        Next
        Chiperteks.Text = xkalimat
    End Sub

    Private Sub btndekripsi_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btndekripsi.Click
        Dim x As String = ""
        Dim xkalimat As String = ""
        For i = 1 To Len(plainteks.Text)
            x = Mid(plainteks.Text, i, i)
            x = Chr(Asc(x) - 3)
            xkalimat = xkalimat + x
        Next
        Chiperteks.Text = xkalimat
    End Sub

    Private Sub Kriptografi_Caesar_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    End Sub
End Class


Form Kriptografi Vernam

Public Class Kriptografi_Vernam_Chiper

    Private Sub Form3_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 plainteks_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles plainteks.TextChanged

    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

    Private Sub kunci_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles kunci.TextChanged

    End Sub
End Class

Form Kriptografi Gronsfeld



Public Class Kriptografi_Gronsfeld

    Private Sub Form4_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        plainteks.Text = ""
        kunci.Text = ""
        chiperteks.Text = ""

    End Sub

    Private Sub plainteks_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles plainteks.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 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)) - 48

            nEnc = ((nKata + nKunci) Mod 26)
            sPlain = sPlain & Chr((nEnc) + 65)
        Next i
        chiperteks.Text = sPlain
    End Sub
End Class


Form Kriptografi Viginere



Public Class Kriptografi_Viginere

    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

    Function Enkripsi(ByVal Teks 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 sPlain As String
        Dim nEnc As Integer
        j = 0
        jum = Len(Teks)
        sPlain = ""
        sKey = Kunci
        sKata = Teks
        For i = 1 To jum
            If j = Len(sKey) Then
                j = 1
            Else
                j = j + 1
            End If
            nKata = Asc(Mid(sKata, i, 1))

            nKunci = Asc(Mid(sKey, j, 1))

            nEnc = ((nKata + nKunci) Mod 256)

            sPlain = sPlain & Chr((nEnc))
        Next i
        Enkripsi = sPlain
    End Function

    Private Sub Kriptografi_Viginere_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    End Sub
End Class

Hasil Printout


- See more at: http://ericksaruksuk.blogspot.com/2014/01/pemograman-kriptografi.html#sthash.pzyNlDFw.dpuf
Listing Program


Form Menu


Public Class Menu

    Private Sub ClloseToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ClloseToolStripMenuItem.Click
        End
    End Sub

    Private Sub KriptografiCaesarToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KriptografiCaesarToolStripMenuItem.Click
        Kriptografi_Caesar.Show()
    End Sub

    Private Sub KriptografiVernamToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KriptografiVernamToolStripMenuItem.Click
        Kriptografi_Vernam_Chiper.Show()
    End Sub

    Private Sub KriptografiGronsfeldToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KriptografiGronsfeldToolStripMenuItem.Click
        Kriptografi_Gronsfeld.Show()
    End Sub

    Private Sub KriptografiViginereToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KriptografiViginereToolStripMenuItem.Click
        Kriptografi_Viginere.Show()
    End Sub
End Class

Form Kriptografi Caesar




Public Class Kriptografi_Caesar

    Private Sub btnenkripsi_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnenkripsi.Click
        Dim x As String = ""
        Dim xkalimat As String = ""
        For i = 1 To Len(plainteks.Text)
            x = Mid(plainteks.Text, i, i)
            x = Chr(Asc(x) + 3)
            xkalimat = xkalimat + x
        Next
        Chiperteks.Text = xkalimat
    End Sub

    Private Sub btndekripsi_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btndekripsi.Click
        Dim x As String = ""
        Dim xkalimat As String = ""
        For i = 1 To Len(plainteks.Text)
            x = Mid(plainteks.Text, i, i)
            x = Chr(Asc(x) - 3)
            xkalimat = xkalimat + x
        Next
        Chiperteks.Text = xkalimat
    End Sub

    Private Sub Kriptografi_Caesar_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    End Sub
End Class


Form Kriptografi Vernam

Public Class Kriptografi_Vernam_Chiper

    Private Sub Form3_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 plainteks_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles plainteks.TextChanged

    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

    Private Sub kunci_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles kunci.TextChanged

    End Sub
End Class

Form Kriptografi Gronsfeld



Public Class Kriptografi_Gronsfeld

    Private Sub Form4_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        plainteks.Text = ""
        kunci.Text = ""
        chiperteks.Text = ""

    End Sub

    Private Sub plainteks_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles plainteks.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 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)) - 48

            nEnc = ((nKata + nKunci) Mod 26)
            sPlain = sPlain & Chr((nEnc) + 65)
        Next i
        chiperteks.Text = sPlain
    End Sub
End Class


Form Kriptografi Viginere



Public Class Kriptografi_Viginere

    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

    Function Enkripsi(ByVal Teks 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 sPlain As String
        Dim nEnc As Integer
        j = 0
        jum = Len(Teks)
        sPlain = ""
        sKey = Kunci
        sKata = Teks
        For i = 1 To jum
            If j = Len(sKey) Then
                j = 1
            Else
                j = j + 1
            End If
            nKata = Asc(Mid(sKata, i, 1))

            nKunci = Asc(Mid(sKey, j, 1))

            nEnc = ((nKata + nKunci) Mod 256)

            sPlain = sPlain & Chr((nEnc))
        Next i
        Enkripsi = sPlain
    End Function

    Private Sub Kriptografi_Viginere_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    End Sub
End Class

Hasil Printout


- See more at: http://ericksaruksuk.blogspot.com/2014/01/pemograman-kriptografi.html#sthash.pzyNlDFw.dpuf
Listing Program


Form Menu


Public Class Menu

    Private Sub ClloseToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ClloseToolStripMenuItem.Click
        End
    End Sub

    Private Sub KriptografiCaesarToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KriptografiCaesarToolStripMenuItem.Click
        Kriptografi_Caesar.Show()
    End Sub

    Private Sub KriptografiVernamToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KriptografiVernamToolStripMenuItem.Click
        Kriptografi_Vernam_Chiper.Show()
    End Sub

    Private Sub KriptografiGronsfeldToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KriptografiGronsfeldToolStripMenuItem.Click
        Kriptografi_Gronsfeld.Show()
    End Sub

    Private Sub KriptografiViginereToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KriptografiViginereToolStripMenuItem.Click
        Kriptografi_Viginere.Show()
    End Sub
End Class

Form Kriptografi Caesar




Public Class Kriptografi_Caesar

    Private Sub btnenkripsi_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnenkripsi.Click
        Dim x As String = ""
        Dim xkalimat As String = ""
        For i = 1 To Len(plainteks.Text)
            x = Mid(plainteks.Text, i, i)
            x = Chr(Asc(x) + 3)
            xkalimat = xkalimat + x
        Next
        Chiperteks.Text = xkalimat
    End Sub

    Private Sub btndekripsi_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btndekripsi.Click
        Dim x As String = ""
        Dim xkalimat As String = ""
        For i = 1 To Len(plainteks.Text)
            x = Mid(plainteks.Text, i, i)
            x = Chr(Asc(x) - 3)
            xkalimat = xkalimat + x
        Next
        Chiperteks.Text = xkalimat
    End Sub

    Private Sub Kriptografi_Caesar_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    End Sub
End Class


Form Kriptografi Vernam

Public Class Kriptografi_Vernam_Chiper

    Private Sub Form3_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 plainteks_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles plainteks.TextChanged

    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

    Private Sub kunci_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles kunci.TextChanged

    End Sub
End Class

Form Kriptografi Gronsfeld



Public Class Kriptografi_Gronsfeld

    Private Sub Form4_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        plainteks.Text = ""
        kunci.Text = ""
        chiperteks.Text = ""

    End Sub

    Private Sub plainteks_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles plainteks.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 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)) - 48

            nEnc = ((nKata + nKunci) Mod 26)
            sPlain = sPlain & Chr((nEnc) + 65)
        Next i
        chiperteks.Text = sPlain
    End Sub
End Class


Form Kriptografi Viginere



Public Class Kriptografi_Viginere

    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

    Function Enkripsi(ByVal Teks 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 sPlain As String
        Dim nEnc As Integer
        j = 0
        jum = Len(Teks)
        sPlain = ""
        sKey = Kunci
        sKata = Teks
        For i = 1 To jum
            If j = Len(sKey) Then
                j = 1
            Else
                j = j + 1
            End If
            nKata = Asc(Mid(sKata, i, 1))

            nKunci = Asc(Mid(sKey, j, 1))

            nEnc = ((nKata + nKunci) Mod 256)

            sPlain = sPlain & Chr((nEnc))
        Next i
        Enkripsi = sPlain
    End Function

    Private Sub Kriptografi_Viginere_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    End Sub
End Class

Hasil Printout


- See more at: http://ericksaruksuk.blogspot.com/2014/01/pemograman-kriptografi.html#sthash.pzyNlDFw.dpuf
Listing Program


Form Menu


Public Class Menu

    Private Sub ClloseToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ClloseToolStripMenuItem.Click
        End
    End Sub

    Private Sub KriptografiCaesarToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KriptografiCaesarToolStripMenuItem.Click
        Kriptografi_Caesar.Show()
    End Sub

    Private Sub KriptografiVernamToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KriptografiVernamToolStripMenuItem.Click
        Kriptografi_Vernam_Chiper.Show()
    End Sub

    Private Sub KriptografiGronsfeldToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KriptografiGronsfeldToolStripMenuItem.Click
        Kriptografi_Gronsfeld.Show()
    End Sub

    Private Sub KriptografiViginereToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KriptografiViginereToolStripMenuItem.Click
        Kriptografi_Viginere.Show()
    End Sub
End Class

Form Kriptografi Caesar




Public Class Kriptografi_Caesar

    Private Sub btnenkripsi_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnenkripsi.Click
        Dim x As String = ""
        Dim xkalimat As String = ""
        For i = 1 To Len(plainteks.Text)
            x = Mid(plainteks.Text, i, i)
            x = Chr(Asc(x) + 3)
            xkalimat = xkalimat + x
        Next
        Chiperteks.Text = xkalimat
    End Sub

    Private Sub btndekripsi_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btndekripsi.Click
        Dim x As String = ""
        Dim xkalimat As String = ""
        For i = 1 To Len(plainteks.Text)
            x = Mid(plainteks.Text, i, i)
            x = Chr(Asc(x) - 3)
            xkalimat = xkalimat + x
        Next
        Chiperteks.Text = xkalimat
    End Sub

    Private Sub Kriptografi_Caesar_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    End Sub
End Class


Form Kriptografi Vernam

Public Class Kriptografi_Vernam_Chiper

    Private Sub Form3_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 plainteks_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles plainteks.TextChanged

    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

    Private Sub kunci_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles kunci.TextChanged

    End Sub
End Class

Form Kriptografi Gronsfeld



Public Class Kriptografi_Gronsfeld

    Private Sub Form4_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        plainteks.Text = ""
        kunci.Text = ""
        chiperteks.Text = ""

    End Sub

    Private Sub plainteks_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles plainteks.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 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)) - 48

            nEnc = ((nKata + nKunci) Mod 26)
            sPlain = sPlain & Chr((nEnc) + 65)
        Next i
        chiperteks.Text = sPlain
    End Sub
End Class


Form Kriptografi Viginere



Public Class Kriptografi_Viginere

    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

    Function Enkripsi(ByVal Teks 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 sPlain As String
        Dim nEnc As Integer
        j = 0
        jum = Len(Teks)
        sPlain = ""
        sKey = Kunci
        sKata = Teks
        For i = 1 To jum
            If j = Len(sKey) Then
                j = 1
            Else
                j = j + 1
            End If
            nKata = Asc(Mid(sKata, i, 1))

            nKunci = Asc(Mid(sKey, j, 1))

            nEnc = ((nKata + nKunci) Mod 256)

            sPlain = sPlain & Chr((nEnc))
        Next i
        Enkripsi = sPlain
    End Function

    Private Sub Kriptografi_Viginere_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    End Sub
End Class

Hasil Printout


- See more at: http://ericksaruksuk.blogspot.com/2014/01/pemograman-kriptografi.html#sthash.pzyNlDFw.dpuf
Listing Program


Form Menu


Public Class Menu

    Private Sub ClloseToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ClloseToolStripMenuItem.Click
        End
    End Sub

    Private Sub KriptografiCaesarToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KriptografiCaesarToolStripMenuItem.Click
        Kriptografi_Caesar.Show()
    End Sub

    Private Sub KriptografiVernamToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KriptografiVernamToolStripMenuItem.Click
        Kriptografi_Vernam_Chiper.Show()
    End Sub

    Private Sub KriptografiGronsfeldToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KriptografiGronsfeldToolStripMenuItem.Click
        Kriptografi_Gronsfeld.Show()
    End Sub

    Private Sub KriptografiViginereToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KriptografiViginereToolStripMenuItem.Click
        Kriptografi_Viginere.Show()
    End Sub
End Class

Form Kriptografi Caesar




Public Class Kriptografi_Caesar

    Private Sub btnenkripsi_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnenkripsi.Click
        Dim x As String = ""
        Dim xkalimat As String = ""
        For i = 1 To Len(plainteks.Text)
            x = Mid(plainteks.Text, i, i)
            x = Chr(Asc(x) + 3)
            xkalimat = xkalimat + x
        Next
        Chiperteks.Text = xkalimat
    End Sub

    Private Sub btndekripsi_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btndekripsi.Click
        Dim x As String = ""
        Dim xkalimat As String = ""
        For i = 1 To Len(plainteks.Text)
            x = Mid(plainteks.Text, i, i)
            x = Chr(Asc(x) - 3)
            xkalimat = xkalimat + x
        Next
        Chiperteks.Text = xkalimat
    End Sub

    Private Sub Kriptografi_Caesar_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    End Sub
End Class


Form Kriptografi Vernam

Public Class Kriptografi_Vernam_Chiper

    Private Sub Form3_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 plainteks_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles plainteks.TextChanged

    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

    Private Sub kunci_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles kunci.TextChanged

    End Sub
End Class

Form Kriptografi Gronsfeld



Public Class Kriptografi_Gronsfeld

    Private Sub Form4_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        plainteks.Text = ""
        kunci.Text = ""
        chiperteks.Text = ""

    End Sub

    Private Sub plainteks_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles plainteks.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 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)) - 48

            nEnc = ((nKata + nKunci) Mod 26)
            sPlain = sPlain & Chr((nEnc) + 65)
        Next i
        chiperteks.Text = sPlain
    End Sub
End Class


Form Kriptografi Viginere



Public Class Kriptografi_Viginere

    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

    Function Enkripsi(ByVal Teks 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 sPlain As String
        Dim nEnc As Integer
        j = 0
        jum = Len(Teks)
        sPlain = ""
        sKey = Kunci
        sKata = Teks
        For i = 1 To jum
            If j = Len(sKey) Then
                j = 1
            Else
                j = j + 1
            End If
            nKata = Asc(Mid(sKata, i, 1))

            nKunci = Asc(Mid(sKey, j, 1))

            nEnc = ((nKata + nKunci) Mod 256)

            sPlain = sPlain & Chr((nEnc))
        Next i
        Enkripsi = sPlain
    End Function

    Private Sub Kriptografi_Viginere_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    End Sub
End Class

Hasil Printout


- See more at: http://ericksaruksuk.blogspot.com/2014/01/pemograman-kriptografi.html#sthash.pzyNlDFw.dpuf
Listing Program


Form Menu


Public Class Menu

    Private Sub ClloseToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ClloseToolStripMenuItem.Click
        End
    End Sub

    Private Sub KriptografiCaesarToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KriptografiCaesarToolStripMenuItem.Click
        Kriptografi_Caesar.Show()
    End Sub

    Private Sub KriptografiVernamToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KriptografiVernamToolStripMenuItem.Click
        Kriptografi_Vernam_Chiper.Show()
    End Sub

    Private Sub KriptografiGronsfeldToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KriptografiGronsfeldToolStripMenuItem.Click
        Kriptografi_Gronsfeld.Show()
    End Sub

    Private Sub KriptografiViginereToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KriptografiViginereToolStripMenuItem.Click
        Kriptografi_Viginere.Show()
    End Sub
End Class

Form Kriptografi Caesar




Public Class Kriptografi_Caesar

    Private Sub btnenkripsi_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnenkripsi.Click
        Dim x As String = ""
        Dim xkalimat As String = ""
        For i = 1 To Len(plainteks.Text)
            x = Mid(plainteks.Text, i, i)
            x = Chr(Asc(x) + 3)
            xkalimat = xkalimat + x
        Next
        Chiperteks.Text = xkalimat
    End Sub

    Private Sub btndekripsi_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btndekripsi.Click
        Dim x As String = ""
        Dim xkalimat As String = ""
        For i = 1 To Len(plainteks.Text)
            x = Mid(plainteks.Text, i, i)
            x = Chr(Asc(x) - 3)
            xkalimat = xkalimat + x
        Next
        Chiperteks.Text = xkalimat
    End Sub

    Private Sub Kriptografi_Caesar_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    End Sub
End Class


Form Kriptografi Vernam

Public Class Kriptografi_Vernam_Chiper

    Private Sub Form3_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 plainteks_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles plainteks.TextChanged

    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

    Private Sub kunci_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles kunci.TextChanged

    End Sub
End Class

Form Kriptografi Gronsfeld



Public Class Kriptografi_Gronsfeld

    Private Sub Form4_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        plainteks.Text = ""
        kunci.Text = ""
        chiperteks.Text = ""

    End Sub

    Private Sub plainteks_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles plainteks.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 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)) - 48

            nEnc = ((nKata + nKunci) Mod 26)
            sPlain = sPlain & Chr((nEnc) + 65)
        Next i
        chiperteks.Text = sPlain
    End Sub
End Class


Form Kriptografi Viginere



Public Class Kriptografi_Viginere

    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

    Function Enkripsi(ByVal Teks 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 sPlain As String
        Dim nEnc As Integer
        j = 0
        jum = Len(Teks)
        sPlain = ""
        sKey = Kunci
        sKata = Teks
        For i = 1 To jum
            If j = Len(sKey) Then
                j = 1
            Else
                j = j + 1
            End If
            nKata = Asc(Mid(sKata, i, 1))

            nKunci = Asc(Mid(sKey, j, 1))

            nEnc = ((nKata + nKunci) Mod 256)

            sPlain = sPlain & Chr((nEnc))
        Next i
        Enkripsi = sPlain
    End Function

    Private Sub Kriptografi_Viginere_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    End Sub
End Class

Hasil Printout


- See more at: http://ericksaruksuk.blogspot.com/2014/01/pemograman-kriptografi.html#sthash.pzyNlDFw.dpuf
Listing Program


Form Menu


Public Class Menu

    Private Sub ClloseToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ClloseToolStripMenuItem.Click
        End
    End Sub

    Private Sub KriptografiCaesarToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KriptografiCaesarToolStripMenuItem.Click
        Kriptografi_Caesar.Show()
    End Sub

    Private Sub KriptografiVernamToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KriptografiVernamToolStripMenuItem.Click
        Kriptografi_Vernam_Chiper.Show()
    End Sub

    Private Sub KriptografiGronsfeldToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KriptografiGronsfeldToolStripMenuItem.Click
        Kriptografi_Gronsfeld.Show()
    End Sub

    Private Sub KriptografiViginereToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KriptografiViginereToolStripMenuItem.Click
        Kriptografi_Viginere.Show()
    End Sub
End Class

Form Kriptografi Caesar




Public Class Kriptografi_Caesar

    Private Sub btnenkripsi_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnenkripsi.Click
        Dim x As String = ""
        Dim xkalimat As String = ""
        For i = 1 To Len(plainteks.Text)
            x = Mid(plainteks.Text, i, i)
            x = Chr(Asc(x) + 3)
            xkalimat = xkalimat + x
        Next
        Chiperteks.Text = xkalimat
    End Sub

    Private Sub btndekripsi_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btndekripsi.Click
        Dim x As String = ""
        Dim xkalimat As String = ""
        For i = 1 To Len(plainteks.Text)
            x = Mid(plainteks.Text, i, i)
            x = Chr(Asc(x) - 3)
            xkalimat = xkalimat + x
        Next
        Chiperteks.Text = xkalimat
    End Sub

    Private Sub Kriptografi_Caesar_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    End Sub
End Class


Form Kriptografi Vernam

Public Class Kriptografi_Vernam_Chiper

    Private Sub Form3_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 plainteks_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles plainteks.TextChanged

    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

    Private Sub kunci_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles kunci.TextChanged

    End Sub
End Class

Form Kriptografi Gronsfeld



Public Class Kriptografi_Gronsfeld

    Private Sub Form4_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        plainteks.Text = ""
        kunci.Text = ""
        chiperteks.Text = ""

    End Sub

    Private Sub plainteks_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles plainteks.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 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)) - 48

            nEnc = ((nKata + nKunci) Mod 26)
            sPlain = sPlain & Chr((nEnc) + 65)
        Next i
        chiperteks.Text = sPlain
    End Sub
End Class


Form Kriptografi Viginere



Public Class Kriptografi_Viginere

    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

    Function Enkripsi(ByVal Teks 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 sPlain As String
        Dim nEnc As Integer
        j = 0
        jum = Len(Teks)
        sPlain = ""
        sKey = Kunci
        sKata = Teks
        For i = 1 To jum
            If j = Len(sKey) Then
                j = 1
            Else
                j = j + 1
            End If
            nKata = Asc(Mid(sKata, i, 1))

            nKunci = Asc(Mid(sKey, j, 1))

            nEnc = ((nKata + nKunci) Mod 256)

            sPlain = sPlain & Chr((nEnc))
        Next i
        Enkripsi = sPlain
    End Function

    Private Sub Kriptografi_Viginere_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    End Sub
End Class

Hasil Printout


- See more at: http://ericksaruksuk.blogspot.com/2014/01/pemograman-kriptografi.html#sthash.pzyNlDFw.dpuf

0 komentar:

Posting Komentar