Anda di halaman 1dari 3

KRIPTOGRAFI MENGGUNAKAN ALGORITMA CEASER CIPHER Yaitu metode enkripsi dengan menggeser posisi plaintext 3 (tiga) atau beberapa

karakter ke kanan. pi : A B C D E F G H I J K L M N O P Q R S T U V W X Y Z ci : D E F G H I J K L M N O P Q R S T U V W X Y Z A B C Contoh: Plainteks: AKU MAHASISWA TEKNIK INFORMATIKA Cipherteks: DNX#PDKDVLVZD#WHNQLN#LQIRUPDWLND Contoh dalam program menggunakan Visual Studio 2005 1. Buat sebuah class yang akan digunakan untuk mengubah plaintext menjadi ciphertext dan juga sebaliknya. Kode programnya sebagai berikut:
Friend Class CaeserCipher Private _shiftCount As Integer Public Property ShiftCount() As Integer Get Return _shiftCount End Get Set(ByVal value As Integer) _shiftCount = value End Set End Property Public Sub New() Me.New(3) End Sub Public Sub New(ByVal shiftCount As Integer) Me.ShiftCount = shiftCount End Sub Public Function Encipher(ByVal plainText As String) As String Dim cipherText As String = String.Empty Dim cipherInChars(plainText.Length) As Char For i As Integer = 0 To plainText.Length - 1 cipherInChars(i) = Convert.ToChar((Convert.ToInt32(Convert.ToChar(plainText(i))) + Me.ShiftCount)) Next cipherText = New String(cipherInChars) Return cipherText End Function Public Function Decipher(ByVal cipherText As String) As String Dim plainText As String = String.Empty Dim cipherInChars(cipherText.Length) As Char For i As Integer = 0 To cipherText.Length - 1 cipherInChars(i) = Convert.ToChar((Convert.ToInt32(Convert.ToChar(cipherText(i))) Me.ShiftCount)) Next plainText = New String(cipherInChars) Return plainText End Function End Class

2. Buat sebuah form dengan 4 buah textbox yaitu PlainText, CipherText.Text, Dec_CipherText dan Dec_PlainText Kode programnya sebagai berikut:
Public Class Form1 Private _cipherEngine As New CaeserCipher Private Sub PlainText_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PlainText.TextChanged CipherText.Text = _cipherEngine.Encipher(PlainText.Text) End Sub Private Sub Dec_CipherText_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Dec_CipherText.TextChanged Dec_PlainText.Text = _cipherEngine.Decipher(Dec_CipherText.Text) End Sub End Class

3. Tampilan program seperti ini

KRIPTOGRAFI MENGGUNAKAN ALGORITMA CEASER CIPHER DAN IMPLEMENTASINYA PADA VISUAL STUDIO 2005

Dibuat Untuk Memenuhi Tugas Mata Kuliah Sistem Informasi Enterprise

Oleh :

Ahmad Hadi Makin Agus Andri Putra Deky Chandra

: : :

207 700 318 207 700 316 207 700 353

IF A / VIII JURUSAN TEKNIK INFORMATIKA FASKULTAS SAIN DAN TEKNOLOGI UNIVERSITAS ISLAM NEGERI SUNAN GUNUNG DJATI BANDUNG 2011

Anda mungkin juga menyukai