Networking Has Become a Very Important Aspect of Every One's Life If We Consider the Rate of Internet Usage, We Usually Send
Total Page:16
File Type:pdf, Size:1020Kb
View metadata, citation and similar papers at core.ac.uk brought to you by CORE provided by UTHM Institutional Repository i ROBUST CAESAR CIPHER AGAINST FREQUENCY CRYPTANALYSIS USING BI-DIRECTIONAL SHIFTING. ABDULKADIR HASSAN DISINA A thesis submitted in partial fulfillment of the requirement for the award of the Degree of Master of Computer Science Faculty of Computer Science and Information Technology Universiti Tun Hussein Onn Malaysia March 2014 vi CONTENTS TITLE i DECLARATION ii DEDICATION iii ABSTRACT iv ABSTRAK v CONTENTS vi LIST OF TABLE x LIST OF FIGURES xi LIST OF LIST OF ABBREVIATION xii LIST OF APPENDICES xiii CHAPTER 1 INTRODUCTION 1.1 Overview 1 1.2 Problem Statement 3 1.3 Motivation 4 1.4 Objectives 5 1.5 Scope 5 1.6 Contribution 6 1.7 summary 7 CHAPTER 2 LITERATURE REVIEW 2.1 Introduction 8 2.2 Overview of the cipher 8 2.3 Types of Cryptographic Algorithm 10 vii 2.3.1 Symmetric Key Cryptography 10 2.3.2 Asymmetric Key Cryptography 10 2.3.3 Chosen key Type 11 2.4 Types of Cipher 11 2.4.1 Stream Cipher 12 2.4.1.1 Mono or Homo Alphabetic 12 2.4.1.2 Poly Alphabetic 13 2.4.2 Block Cipher 13 2.4.3 Chosen Cipher Type 13 2.5 Permutation 14 2.6 Related Work 14 2.7 Components of Stream Cipher 16 2.7.1 Plaintext (Message) 17 2.7.2 Encryption 17 2.7.3 Key 17 2.7.4 Decryption 18 2.8 Types of Operation for Stream Cipher 18 2.8.1 Substitution 19 2.8.2 Transposition 19 2.8.3 Mixed Cipher 19 2.9 ASCII Character 20 2.10 Attacks on Symmetric Cipher 21 2.10.1 Known-plaintext Attack 21 2.10.2 Chosen Plaintext Attack 21 2.10.3 Differential Cryptanalysis 22 2.10.4 Frequency Analysis 22 2.10.5 Cryptanalysis 23 2.11 Stages of Cryptanalysis 24 2.11.1 Identification 24 2.11.2 Breaking 25 2.11.3 Settings 25 viii 2.12 Kerchhoffs’s Principles 25 2.13 Shannon’s Principles 26 2.13.1 Confusion 26 2.13.2 Diffusion 26 2.14 Summary 27 CHAPTER 3 METHODOLOGY 3.1 Introduction 28 3.2 Proposed Frame work 28 3.2.1 Logical Frame Work 29 3.2.2 Encryption 32 3.2.3 Decryption 33 3.3 Flow Chart 34 3.4 Interface Design 35 3.5 Frequency Analysis 36 3.6 Comparison with Other Techniques 36 3.7 Method of Validation 37 3.8 Summary 37 CHAPTER 4 IMPLEMENTATION 4.1 Introduction 38 4.2 Implementation of Robust Caesar Cipher 39 4.2.1 Variables and Arrays 39 4.2.2 Encryption 40 4.2.2.1 Even Position Shift 40 4.2.2.2 Odd Position Shift 42 4.2.2.1 Swap Function (Switch Position) 43 4.2.3 Decryption 44 4.2.3.1 Even Position Shift 44 4.2.3.2 Odd Position Shift 45 4.2.4 Interface Design 45 4.3 Summary 47 ix CHAPTER 5 SECURITY ANALYSIS 5.1 Introduction 48 5.2 Analysis of the Algorithm 48 5.2.1 Key Scheduling Algorithm 49 5.2.2 Confusion 49 5.2.3 Diffusion 50 5.2.4 Frequency Analysis 50 5.2.4.1 Test 1 51 5.2.4.2 Test 2 52 5.2.4.3 Test 3 53 5.2.4.4 Test 4 54 5.2.4.5 Test 5 54 5.2.5 Comparison with Previous Work 56 5.2.6 Attack Scenario 57 5.2.6.1 Ciphertext Only Attack 57 5.2.6.2 Chosen Plaintext Attack 57 5.2.6.3 Known Ciphertext Attack 58 5.3 Comparison of Result with SD-aree 58 5.4 Summary 59 CHAPTER 6 CONCLUSION AND FUTURE WORK 6.1 Conclusion 60 5.2 Future Work 61 REFERENCES 62 APPENDICES 64 x LIST OF TABLES 3.1 Printable ASCII characters 29 3.2 Printable ASCII standard table 30 3.3 Shift forward table 31 3.4 Shift backward table 31 3.5 Comparison with previous techniques 36 5.1 Comparison of results with previous algorithm 56 xi LIST OF FIGURES 2.1 Modified Caesar cipher 15 2.2 Components of Caesar chipper 16 2.3 Printable ASCII characters 20 2.4 Frequency Analysis table 23 3.1 Proposed new Algorithm 29 3.2 Encryption Algorithm 32 3.3 Decryption Algorithm 33 3.4 Flow chart 34 3.5 Interface Design 35 4.1 Variable Declaration 39 4.2 Encryption Algorithm 41 4.3 Odd Position Shift 42 4.4 Swap Function (Switch) 43 4.5 Decryption Even Position 44 4.6 Decryption Odd Position 44 4.7 Interface of Robust Caesar Cipher Algorithm 45 5.1 Test 1 51 5.2 Test 2 52 5.3 Test 3 53 5.4 Test 4 54 5.5 Result of Comparisons 58 xii LIST OF SYMBOLS AND ABBREVIATIONS C - Ciphertext M - Message OSB - Odd Position Shift Backward ESF - Even Position Shift Forward ESW - Encryption Switch xiii LIST OF APPENDICES APPENDIX TITLE PAGE A Programming Code 64 iv ABSTRACT Cryptography is the art of encoding a message such that only the sender and the intended recipient can decode. But with advent of Internet, information confidentiality faces more treats, which lead to the development of cryptographic algorithms. This thesis presented a cryptographic algorithm titled Robust Caesar cipher against frequency analysis using bidirectional shift. It encrypts message bit by bit (stream cipher) and uses one key ideology (symmetric key cipher). The sender encrypts the message before transmitting and the receiver decrypts upon receiving using the same key as used in the encryption process. It works by shifting the plaintext characters to different direction which eliminates repetition of characters in the ciphertext. Nevertheless, previous versions of Caesar cipher are prone to frequency analysis attack. In this research, Caesar cipher is enhanced to 95 characters in a tabular arrangement as digital messages are not only 26 characters. Based on this method, the sender will transpose the bits in the message according to their sequence arrangement (odd and even position) by shifting the characters in the odd position to the left and characters in the even position to the right side. The cryptographic key given by the sender will determine the shifting position of all the characters. Shifting the plaintext to different directions mitigates the problem of repetition. The experiment shows that the proposed method has an efficiency of 99.9% resistance than the earlier version of the Caesar cipher. However, the proposed method can save as an option to be integrated with other algorithms to strengthen the security. v ABSTRAK Kriptografi adalah seni pengkodan mesej yang hanya membolehkan penghantar dan penerima membaca mesej tersebut. Tetapi dengan kemudahan Internet, kerahsiaan maklumat menghadapi pelbagai serangan dan hal ini membawakan kepada pembangunan algoritma kriptografi. Tesis ini dikemukakan berkaitan algoritma kriptografi yang bertajuk Robust Caesar cipher against frequency analysis using bidirectional shift. Ia menyulitkan mesej sikit demi sedikit (aliran cipher) dengan menggunakan satu ideologi utama (simetri cipher utama). Penghantar menyulitkan mesej sebelum menghantar kepada penerima dan penerima membaca mesej tersebut dengan menggunakan kekunci yang sama semasa proses penyulitan. Caesar cipher ini berfungsi dengan mengalihkan huruf plaintext ke arah yang berbeza untuk menghapuskan pengulangan huruf dalam mesej. Walau bagaimanapun, versi awal Caesar cipher telah terdedah kepada serangan frekuensi analisis. Dalam kajian ini, Caesar cipher mempertingkatkan huruf dalam susunan jadual mesej digital dari 26 ke 95 huruf. Berdasarkan kaedah ini, penghantar akan mengubah nada bit dalam bentuk mesej mengikut susunan urutan yang ditentukan (kedudukan ganjil dan genap) dengan mengalihkan huruf-huruf ganjil ke kiri dan huruf-huruf genap ke sebelah kanan. Kekunci kriptografi yang diberikan oleh penghantar akan menentukan kedudukan semua huruf. Peralihan plaintext ke arah yang berbeza menyelesaikan masalah pengulangan huruf. Eksperimen menunjukkan bahawa kaedah yang dicadangkan mempunyai kecekapan rintangan 99.9 % daripada versi awal cipher Caesar. Walau bagaimanapun, kaedah yang dicadangkan adalah bagi membolehkan dan disimpan sebagai pilihan untuk disepadukan dengan algoritma lain supaya dapat mengukuhkan lagi keselamatan mesej yang dihantar secara sulit. 1 CHAPTER 1 INTRODUCTION 1.1 Overview Networking has become a very important aspect of every one’s life if the rate of Internet usage is considered. Information is usually being sent and sometimes shares data. Some of those classified information contains account numbers, meeting venue, addresses, and other crucial information that need confidentiality. Likewise the information may contain some banks and academic related documents that require some privacy. In most cases, senders of those messages are not really concern about the security of the communication channel. Malicious individuals could tap into the unsecured channel of the communication illegitimately, to make illegal use of the resources (compromises confidentiality) or to temper (compromises availability and integrity) with the data. To secure the reliability of the communication channel, restriction methods can be applied on the channels so that only the original sender and intended receiver can unlock and decode the message. However, user might like to make sure that the message at the destination is the same as the original from the source, which means to ensure the integrity of the message. In this case, some sort of pad lock has to be applied to lock the data. This could not only be done on a physical surface, can also be applied on logical or digital data as well, but only with the help of some mathematical algorithms called 2 cryptography. Cryptography is the art and science of using mathematics and logics to prepare a coded or protected communication that can only be understood by the sender and intended recipient.