enciphering method

8
TUGAS 1 KEAMANAN DAN INFORMASI JARINGAN Kelas F Dosen Baskoro Adi Pratomo, S.Kom., M.Kom Asisten Djuned Fernando Djusdek Kelompok 5113100052 Gideon A.T Siburian 5113100106 John Stephanus Peter 5113100148 Julio Anthony Leonard 5113100171 Nugroho Wicaksono JURUSAN TEKNIK INFORMATIKA FAKULTAS TEKNOLOGI DAN INFORMASI INSTITUT TEKNOLOGI SEPULUH NOPEMBER

Upload: julio-anthony-leonard

Post on 13-Apr-2016

4 views

Category:

Documents


0 download

DESCRIPTION

Caesar Cipher,Monoalphabetic Cipher,Polyalphabetic Cipher,OneTime Pad Cipher

TRANSCRIPT

Page 1: Enciphering Method

TUGAS 1 KEAMANAN DAN INFORMASI JARINGAN

Kelas F

Dosen Baskoro Adi Pratomo, S.Kom., M.Kom

Asisten Djuned Fernando Djusdek

Kelompok

5113100052 Gideon A.T Siburian

5113100106 John Stephanus Peter

5113100148 Julio Anthony Leonard

5113100171 Nugroho Wicaksono

JURUSAN TEKNIK INFORMATIKAFAKULTAS TEKNOLOGI DAN INFORMASI

INSTITUT TEKNOLOGI SEPULUH NOPEMBER

SURABAYA 2016

Page 2: Enciphering Method

1. Caesar Cipher

1.1 Cipher Text

R V A H R H T H S

17 21 0 7 17 7 19 7 18

1.2 Decrypttion ProcessLangkah – langkah mendekripsikan cipher text yang di enkripsi menggunakan metode Caesar cipher

1. Menambahkan setiap ASCII dari ( 1 – 25 ) dari ciphertext dengan karakter dan memunculkan hasilnya

2. Dalam hal ini kita menggunakan kode untuk mempermudah melihat hasil the ciphered text:

------------------------------------------CODE AREA ----------------------------------------------------

#include <cmath>

#include <cstdio>

#include <vector>

#include <iostream>

#include <algorithm>

using namespace std;

int main(){

string s;

int n,i,j,stat;

cin >> s;

stat=s.size();

for(i=0;i< 26;i++)

{

for(j=0;j<stat;j++)

{

Page 3: Enciphering Method

n=(int) s[j];

if ((n >= 65) and ( n <= 90))

{

n=(int)s[j] + i;

if(n>90)

{

n-=26;

}

cout << (char) n;

}

if ((n >= 97) and ( n <= 122))

{

n=(int)s[j] + i;

if(n>90)

{

n-=25;

}

cout << (char) n;

}

}

cout << " Key = "<< i << endl;

cout << endl;

}

}

------------------------------------------CODE AREA ----------------------------------------------------

And the result is:

RVAHRHTHS Key = 0

SWBISIUIT Key = 1

Page 4: Enciphering Method

TXCJTJVJU Key = 2

UYDKUKWKV Key = 3

VZELVLXLW Key = 4

WAFMWMYMX Key = 5

XBGNXNZNY Key = 6

YCHOYOAOZ Key = 7

ZDIPZPBPA Key = 8

AEJQAQCQB Key = 9

BFKRBRDRC Key = 10

CGLSCSESD Key = 11

DHMTDTFTE Key = 12

EINUEUGUF Key = 13

FJOVFVHVG Key = 14

GKPWGWIWH Key = 15

HLQXHXJXI Key = 16

IMRYIYKYJ Key = 17

JNSZJZLZK Key = 18

KOTAKAMAL Key = 19

LPUBLBNBM Key = 20

MQVCMCOCN Key = 21

NRWDNDPDO Key = 22

OSXEOEQEP Key = 23

PTYFPFRFQ Key = 24

Page 5: Enciphering Method

QUZGQGSGR Key = 25

Seperti yang kita lihat, yang berwarna kuning adalah satu-satunya yang kalimat yang terlihat sebuah kalimat normal. Maka bisa dipastikan key-nya adalah 19.

2. Monoalphabetic Cipher

2.1 Cipher Text

P L G Z P Z N Z O

2.2 Key

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 ZZ A D C E B I F K H P O N L M I Q S R G U T W Y V X

2.3 Decryption Process

Cocokkan Key dengan Cipher text, maka hasilnya adalah

P L G Z P Z N Z O

K O T A K A M A L

3. Polyalphabetic Cipher

3.1 Cipher Text

C S K I L U E E C

3.2 Key

S E R I B U

Page 6: Enciphering Method

3.3 Decryption Process

Pertama gunakan Vigenère table sebagai acuan untuk decrypt:

Perhatikan tabel! Huruf enkripsi didapatkan dari kolom dan baris antara message dan key. Sehingga, untuk melakukan dekripsi, carilah pada kolom mana huruf enkripsi pada baris key. Sebagai contoh, huruf pertama key adalah ‘S’ dan enkripsi ‘C’. Sehingga, hasil dekripsinya adalah ‘K’ karena huruf ‘C’ pada baris ‘S’ terletak pada kolom ‘K’.

Lakukan proses dekripsi untuk masing-masing huruf. Pada polyalphabetic chiper, key akan diputar berulang-ulang sampai seluruh message terenkripsi/dekripsi.

Sehingga, hasil dekripsinya adalah:

Encrypt: C S K I L U E E C

Key: S E R I B U S E R

Decrypy: K O T A K A M A L

4. One-time Pad

4.1 Cipher Text

Page 7: Enciphering Method

C S K I L U D P S

4.2 Key

Char to ASCII

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 Z0 1 2 3 4 5 6 7 8 9 1

011

12

13

14

15

16

17

18

19

20

21

22

23

24

25

Key

S E R I B U R P H

4.3 Decryption Process

1. Ubah message ke dalam bentuk ASCII.

Encrypt : C S K I L U D P S

2 18 10 8 11 20 3 15 18

2. Ubah key ke dalam bentuk ASCII.

Key : S E R I B U R P H

18 4 17 8 1 20 17 15 7

3. Kurangkan ASCII message dengan ASCII key, jika hasilnya kurang dari nol maka ditambahkan dengan 26

Hasil - : -16 14 -7 0 10 0 -14 0 11

10 14 19 0 10 0 12 0 11

4. Ubah hasil pengurangan ke bentuk Huruf

Decrypt: K O T A K A M A L