• djogzs
    Welcome

KRIPTOGRAFI ENKRIPSI

Sabtu, 29 Juni 2013 0 komentar
A. Program Caesar_Chiper

 1.click Menu file pilih Caesar Chiper




 
 2. Maka akan tampil Program Caesar Chiper



LISTING PROGRAM CAESAR_CHIPER

Public Class Caesar_chiper

    Private Sub Caesar_chiper_Load(ByValsender As System.Object, ByVal e AsSystem.EventArgs) Handles MyBase.Load
        Plainteks.Text = ""
        Chiperteks.Text = ""

    End Sub

    Private Sub btnenkripsi_Click(ByValsender As System.Object, ByVal e AsSystem.EventArgs) Handles btnenkripsi.Click
        Dimjumlah As Double= Len(Plainteks.Text)
        Dim x As String
        Dimxkalimat As String= ""
        Dim bil As Integer
        For i = 1 To jumlah
            x = Mid(Plainteks.Text, i, 1)
            bil = Asc(x) + 3
            x = Chr(bil)
            xkalimat = xkalimat + x
        Next i
        Chiperteks.Text = xkalimat
    End Sub

    Private Sub btnkeluar_Click(ByValsender As System.Object, ByVal e AsSystem.EventArgs) Handles btnkeluar.Click
        End

    End Sub

    Private Sub Btnhapus_Click(ByValsender As System.Object, ByVal e AsSystem.EventArgs) Handles Btnhapus.Click
        Chiperteks.Text = ""
        Plainteks.Text = ""

    End Sub

    Private Sub Btnkembali_Click(ByValsender As System.Object, ByVal e AsSystem.EventArgs) Handles Btnkembali.Click
        Me.Hide()
        Formkriptografi.Show()

    End Sub
End Class

B. Program Gronsfeld Chiper
1. Click Menu File dan Pilih Gronsfeld Chiper


2. Maka akan tampil Program Gronsfeld Chiper




LISTING PROGRAM GRONSFELD_CHIPER

Public Class Gronsfeld

    Private Sub btnkembali_Click(ByValsender As System.Object, ByVal e AsSystem.EventArgs) Handles btnkembali.Click
        Me.Hide()
        Formkriptografi.Show()

    End Sub

    Private Sub Btnkeluar_Click(ByValsender As System.Object, ByVal e AsSystem.EventArgs) Handles Btnkeluar.Click
        End

    End Sub

    Private Sub Gronsfeld_Load(ByValsender As System.Object, ByVal e AsSystem.EventArgs) Handles MyBase.Load
        Plainteks.Text = ""
        Chiperteks.Text = ""

    End Sub

    Private Sub Btnenkripsi_Click(ByValsender As System.Object, ByVal e AsSystem.EventArgs) Handles Btnenkripsi.Click
        Dim J As Integer
        Dim Jum As Integer
        DimsKey As String
        DimnKata As Integer
        DimnKunci As String
        DimsKata As String
        DimsPlain As String= ""
        DimnEnc As Integer
        J = 0
        sKata = Plainteks.Text
        Jum = Len(sKata)
        sKey = Kunci.Text
        For i = 1 To Jum
            IfJ = Len(sKey) Then
                J = 1
            Else
                J = J + 1
            EndIf
            nKata = Asc(Mid(sKata, i, 1)) - 65
            nKunci = Asc(Mid(sKey, J, 1)) - 65
            nEnc = ((nKata + nKunci) Mod 26)
            sPlain = sPlain & Chr((nEnc))
        Next i
        Chiperteks.Text = sPlain
    End Sub

    Private Sub Btnhapus_Click(ByValsender As System.Object, ByVal e AsSystem.EventArgs) Handles Btnhapus.Click
        Plainteks.Text = ""
        Chiperteks.Text = ""
        Kunci.Text = ""
    End Sub

    Private Sub Plainteks_KeyPress(ByValsender As Object, ByVal e AsSystem.Windows.Forms.KeyPressEventArgs) HandlesPlainteks.KeyPress
        e.KeyChar = UCase(e.KeyChar)
        Dimtombol 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(ByValsender As System.Object, ByVal e AsSystem.EventArgs) Handles Plainteks.TextChanged

    End Sub

    Private Sub Kunci_KeyPress(ByValsender As Object, ByVal e AsSystem.Windows.Forms.KeyPressEventArgs) HandlesKunci.KeyPress
        e.KeyChar = UCase(e.KeyChar)
        Dimtombol 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(ByValsender As System.Object, ByVal e AsSystem.EventArgs) Handles Kunci.TextChanged

    End Sub
End Class
 

C. Program Vernam Chiper
1. Click Menu File dan Pilih Vernam Chiper


2. Maka akan Muncul Program Vernam Chiper

 
LISTING PROGRAM VERNAM­_CHIPER

Public Class Vernam_chiper

    Private Sub btnkembali_Click(ByValsender As System.Object, ByVal e AsSystem.EventArgs) Handles btnkembali.Click
        Me.Hide()
        Formkriptografi.Show()

    End Sub

    Private Sub btnkeluar_Click(ByValsender As System.Object, ByVal e AsSystem.EventArgs) Handles btnkeluar.Click
        End

    End Sub

    Private Sub btnhapus_Click(ByValsender As System.Object, ByVal e AsSystem.EventArgs) Handles btnhapus.Click
        Plainteks.Text = ""
        kunci.Text = ""
        Chiperteks.Text = ""


    End Sub

    Private Sub Vernam_chiper_Load(ByValsender As System.Object, ByVal e AsSystem.EventArgs) Handles MyBase.Load
        Plainteks.Text = ""
        Chiperteks.Text = ""
        kunci.Text = ""



    End Sub
    Private Sub btnenkripsi_Click(ByValsender As System.Object, ByVal e AsSystem.EventArgs) Handles btnenkripsi.Click
        Dim J As Integer
        Dim Jum As Integer
        DimsKey As String
        DimnKata As Integer
        DimnKunci As Integer
        DimsKata As String
        DimsPlain As String= ""
        DimnEnc As Integer
        J = 0
        sKata = Plainteks.Text
        Jum = Len(sKata)
        sKey = kunci.Text
        For i = 1 To Jum
            IfJ = Len(sKey) Then
                J = 1
            Else
                J = J + 1
            EndIf
            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(ByValsender As Object, ByVal e AsSystem.Windows.Forms.KeyPressEventArgs) HandlesPlainteks.KeyPress
        e.KeyChar = UCase(e.KeyChar)
        Dimtombol 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(ByValsender As System.Object, ByVal e AsSystem.EventArgs) Handles Plainteks.TextChanged

    End Sub

    Private Sub kunci_KeyPress(ByValsender As Object, ByVal e AsSystem.Windows.Forms.KeyPressEventArgs) Handleskunci.KeyPress
        e.KeyChar = UCase(e.KeyChar)
        Dimtombol 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(ByValsender As System.Object, ByVal e AsSystem.EventArgs) Handles kunci.TextChanged

    End Sub
End Class

D. Program Vigenere Chiper
 1. Click Menu File Pada Vigenere Chiper




2. Maka akan Muncul Program Vigenere Chiper

 



LISTING PROGRAM VIGENERE_CHIPER

Public Class Vigenere_chiper

    Private Sub Btnhapus_Click(ByValsender As System.Object, ByVal e AsSystem.EventArgs) Handles Btnhapus.Click
        Plainteks.Text = ""
        Chiperteks.Text = ""
        kunci.Text = ""


    End Sub

    Private Sub Btnkeluar_Click(ByValsender As System.Object, ByVal e AsSystem.EventArgs) Handles Btnkeluar.Click
        End

    End Sub

    Private Sub Btnkembali_Click(ByValsender As System.Object, ByVal e AsSystem.EventArgs) Handles Btnkembali.Click
        Me.Hide()
        Formkriptografi.Show()

    End Sub

    Private Sub Vigenere_chiper_Load(ByValsender As System.Object, ByVal e AsSystem.EventArgs) Handles MyBase.Load
        Plainteks.Text = ""
        Chiperteks.Text = ""

    End Sub

    Private Sub Btnenkripsi_Click(ByValsender As System.Object, ByVal e AsSystem.EventArgs) Handles Btnenkripsi.Click
        Dim J As Integer
        Dim Jum As Integer
        DimsKey As String
        DimnKata As Integer
        DimnKunci As Integer
        DimsKata As String
        DimsPlain As String= ""
        DimnEnc As Integer
        J = 0
        sKata = Plainteks.Text
        Jum = Len(sKata)
        sKey = kunci.Text
        For i = 1 To Jum
            IfJ = Len(sKey) Then
                J = 1
            Else
                J = J + 1
            EndIf
            nKata = Asc(Mid(sKata, i, 1)) + 0
            nKunci = Asc(Mid(sKey, J, 1)) + 0
            nEnc = ((nKata + nKunci) Mod 256)
            sPlain = sPlain & Chr((nEnc))
        Next i
        Chiperteks.Text = sPlain


    End Sub

    Private Sub Plainteks_KeyPress(ByValsender As Object, ByVal e AsSystem.Windows.Forms.KeyPressEventArgs) HandlesPlainteks.KeyPress
        e.KeyChar = UCase(e.KeyChar)
        Dimtombol 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(ByValsender As System.Object, ByVal e AsSystem.EventArgs) Handles Plainteks.TextChanged

    End Sub

    Private Sub kunci_KeyPress(ByValsender As Object, ByVal e AsSystem.Windows.Forms.KeyPressEventArgs) Handleskunci.KeyPress
        e.KeyChar = UCase(e.KeyChar)
        Dimtombol 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(ByValsender As System.Object, ByVal e AsSystem.EventArgs) Handles kunci.TextChanged

    End Sub
End Class


E. Program Des Chiper
1. Click Menu File dan Pilih Des Chiper 





2. Maka Akan Muncul Program Des Chiper


LISTING PROGRAM DES_CHIPER

Public Class DES_chiper

    Private Sub Btnhapus_Click(ByValsender As System.Object, ByVal e AsSystem.EventArgs) Handles Btnhapus.Click
        plainteks.Text = ""
        chiperteks.Text = ""

    End Sub

    Private Sub Btnkeluar_Click(ByValsender As System.Object, ByVal e AsSystem.EventArgs) Handles Btnkeluar.Click
        End

    End Sub

    Private Sub Btnkembali_Click(ByValsender As System.Object, ByVal e AsSystem.EventArgs) Handles Btnkembali.Click
        Me.Hide()
        Formkriptografi.Show()

    End Sub

    Private Sub btnenkripsi_Click(ByValsender As System.Object, ByVal e AsSystem.EventArgs) Handles btnenkripsi.Click
        Dimkunci As String, kunciChar As String, katabaru As String
        Dim Pos As Integer
        Dim i As Integer, Side1 As String, Side2 As String
        DimnEnc As Integer
        Pos = 1
        For i = 1 To Len(plainteks.Text)
            plainteks.Text = Mid(plainteks.Text, i, 1)
            Kunci.Text = Mid(Kunci.Text, Pos, 1)
            chiperteks.Text = chiperteks.Text & Chr(Asc(Of Char)() Xor Asc(Kunci.Text))
            IfPos = Len(Kunci) Then Pos = 0
            Pos = Pos + 1
        Next i
        IfLen(chiperteks.Text) Mod 2 = 0 Then
            Side1 = StrReverse(Left(chiperteks.Text, (Len(chiperteks.Text) / 2)))
            Side2 = StrReverse(Right(chiperteks.Text, (Len(chiperteks.Text) / 2)))
            chiperteks.Text = Side1 & Side2
        End If
        nEnc = chiperteks.Text


    End Sub
End Class

F. Program RC4
1.Click Menu File Pilih RC 4

 

 
Baca selengkapnya »