+ All Categories
Home > Documents > Chapter-2

Chapter-2

Date post: 17-Nov-2015
Category:
Upload: pja752
View: 223 times
Download: 3 times
Share this document with a friend
Description:
cryptography
Popular Tags:
44
Chapter Two: Classic Cryptography
Transcript

EEC 682/782

Chapter Two: Classic Cryptography

Index2IntroductionA.1 Cryptosystems A.2 TerminologyB. Classic Cipher (Substitution Cipher) B.1 Caesar CipherB 2 Tap CodeB.3 Pigpen CipherB 4 Vigenere CipherB 5 Book Cipher C. Cryptanalysis of Substitution CipherC.1 Brute force cryptanalysisC.2 Frequency Distribution Analysis D. Calculation of Modulo operation E. One-Time PadF. Classic Cipher( Transposition Cipher) F.1 Route CipherF.2 Rail Fence CipherF.3 Column Cipher

Cryptosystems

3

A. TerminologyCryptology is the art and science of making and breaking secret codes.Cryptography is the making of secret codes.Cryptanalysis is the breaking of secret codes.Crypto is a synonym for any or all of the above (and more).Cipher () is an algorithm for performing encryption and decryption a series of well-defined steps that can be followed as a procedure.4

TerminologyEncryption is the process of encoding a message so that its meaning is not obviousEquivalent terms: encode, encipherDecryption is the reverse process, transforming an encrypted message back into its normal, original form Equivalent terms: decode, decipher5PlaintextCiphertextEncryptDecrypt

TerminologyEncryption/decryptions algorithms often use a device called a key, so that the resulting ciphertext depends on the original plaintext message, the algorithm, and the key value An encryption scheme that does not require the use of a key is called a keyless cipher 6

PlaintextCiphertextEncryptDecrypt

6The cryptosystem involves a set of rules for how to encrypt the plaintext and how to decrypt the ciphertext

TerminologyPlaintext: message to be encryptedCiphertext: encrypted messageDK(EK(P)) = P7

7

Symmetric uses same key for encryption and decryption process.To encrypt: C = E(K, P) To decrypt: P = D (K, E(K,P))

Asymmetric uses different key for encryption and decryption process.To encrypt: C = E (KE,P)To decrypt: P = D (KD, E (KE,P))8Terminology

B. Classic CipherSubstitution Ciphers:exchange one letter (or more) with another letter/number/symbol/sound/artA mono-alphabetic cipher uses fixed substitution over the entire message, A poly-alphabetic cipher uses a number of substitutions at different times in the messageTransposition Ciphers: re-arrange the order of the letters9

B.1. Substitution Ciphers1. Caesar Cipher Idea: each letter or group of letters is replaced by another letter or group of lettersCaesar cipher circularly shift by 3 lettersa -> D, b -> E, z -> CMore generally, shift by k letters, k is the key

10

10

B.1. Substitution Ciphers1. Caesar Cipher It is monoalphabetic cipher uses addition modulo 26The message must be a sequence of letters, each letter is identified with a number:

The key k is a number in the range 1 25.Advantages and Disadvantages:The Caesar cipher is quite simple The ability of predict the entire algorithm using small piece of ciphertext

11

B.1. Substitution Ciphers1. Caesar Cipher (Algorithms)Encryption/decryption involve k to each letter (mod 26). So the general Caesar algorithm is Ci= Ek(Mi) = E(Mi, k) = (Mi+k) mod 26Mi= Dk(Ci) = D(Ci, k) = (Ci-k) mod 26For example,Plaintext : treaty impossibleKey : 3Ciphertext: wuhdwb lpsrvvleoh That is, Ci=E[Mi , 3] = Mi+3 mod 26

12

B.1. Substitution Ciphers1. Caesar Cipher

It is the simplest monoalphabetic cipher. Caesar cipher using the shift parameter as the key:

Example: Caeser Cipher (Encryption)14

Example: Caesar Cipher (Decryption)15

Example: Caesar cipher (Encryption)Use the Caesar cipher with key=15 to encrypt the message hello

Ciphertext: WTAAD

Example: Caesar Cipher (Decryption)Use the Caesar cipher with key=15 to decrypt the message WTAAD

Ciphertext: hello

Questions ReviewQ1. Use the Caesar cipher to find the plaintext and the key from the ciphertext:Ciphertext : ugehmlwj kwumjalq

Q2. Use the Caesar cipher with key=3 to encrypt the next message:Plaintext: the quick brown fox jumps over the lazy dog

B.1. Substitution Ciphers2. Tap CodeEach letter is replaced by a number of beeps19

20Substitution CipherPigpen CipherEach letter is replaced by an art

B.1. Substitution Ciphers3. Vigenre CipherPolyalphabetic ciphers flatten the frequency distribution of the plaintext considerably.Vigenre Cipher is an example of polyalphabetic ciphers - use different monoalphabetic substitutions as one proceeds through the plaintext message.For example:Plaintext (M)meet me at tenKey (K)badb ad ba dbaCiphertext(C)nehu mh bt wfn where C = M+K mod 26

21

B.1. Substitution Ciphers3. Vigenre CipherVigenre Tableau

22

B.1. Substitution 3.Vigenere algorithm23

This is a Polyalphabetic Cipher that uses Caesar Cipher with more than one key.

B.1. Substitution 3.Vigenere algorithm

- We can notice from the above example that four keys are used for encryption and decryption.- Keys range from 1 to 25.- Four keys are used in the above example (5,9,18 and 24)- Encryption is done by using first key ( i.e. 5) to encrypt first letter A, Secondletter B is encrypted using key =9 and C is encrypted using key 18 and a letter D is encrypted using key= 24.- When we used all keys the process is repeated and a second round is made. Sowhen we reach letter E, we encrypt it again using key = 5 and letter F isencrypted using key=9 and etc- To decrypt the cipher, we should know what the letters that each key encryptsis. This is can be done by using array of letter indexes (i.e. Key = 5 encryptsletter in indexes 0, 4,8,12 .- The Excel sheet will spread to the students and they should try it by adjustingsome parameters keys.

Question Review

Q1:Use the Vigenere cipher with key=lemon to encrypt the message attackatdawn

B.1. Substitution Ciphers4. Book CipherAny book can provide a keyThe key is formed from the letter of the textSteps:select a passage (Key)the page cannot be foundmatch the plaintext with selected text.Plaintext MACHINES CANNOT THINKencode plaintext using Vigenere table

26

B.1. Substitution CiphersCryptanalysisBrute force cryptanalysis: would have to try 26! permutations of a particular ciphertext message.

27

Students can guess the key by using brute force technique. - For example in the above program, the key was set to 3.

27

Brute force cryptanalysis (cont)Try key = 0, the decrypted cipher will be:

Try key = 1, the decrypted cipher will be:

Try key = 2, the decrypted cipher will be:

Try key = 3, the decrypted cipher will be:

Matched!!

So key =3

B.1. Substitution CiphersCryptanalysis (cont)2. Frequency Distribution Analysis: In practice, it is not difficult to determine the key using frequencies of letters, pairs of letter etc., or by guessing a probable word or phraseMost frequently occurredLetters: e, t, o, a, n, Digrams: th, in, er, re, an, Trigrams: the, ing, and, ion, entWords: the, of, and, to, a, in, that,

B.1. Substitution Ciphers 7. One-Time Pads

30

B.1. Substitution Ciphers 7. One-Time Pads (using Bits)One-time pad: construct an unbreakable cipherChoose a random bit string as the keyConvert the plaintext into a bit stringCompute the XOR of these two strings, bit by bitThe resulting ciphertext cannot be broken, because in a sufficiently large sample of ciphertext, each letter will occur equally often, as will every diagram, every trigram, and so on=> There is simply no information in the message because all possible plaintexts of the given length are equally likelyThe Vernam Cipher is a type of one-time pad devised by Gilbert Vernam for AT&T

31

Calculation of MOD operationCalculate the following mod:E.g., (5) mod 21 =5 (30) mod 21 = (9) mod 21 =9

Modula always return non-negative number:Calculate the following modE.g., (-57) mod 21 = (-36) mod 21 = (-15) mod 21 = (6) mod 21 =6

Calculation Negative MOD

B.1. Substitution Ciphers 7. One-Time Pads (using ASCII Code)PlaintextVERNAMCIPHERNumeric Equivalent214171301228157417+ Random Number7648168244358116054788= Sum9752339544156019751251105= mod 2619071718158192312251Ciphertexttahrspitxmzb

34CiphertexttahrspitxmzbNumeric Equivalent19071718158192312251- One-time pad7648168244358116054788= Difference-57-48-9-65-2612-508-377-22-87= mod 26214171301228157417PlaintextVERNAMCIPHER

To decrypt: (Ci Ki) mod 26Note on rules of mod on negative number: The mod function is defined as the amount by which a number exceeds the largest integer multiple of the divisor that is not greater than that number (http://mathforum.org/library/drmath/view/52343.html)Modula op always return non-negative numberE.g., (19-76) mod 26 = (-57) mod 26 = (-78+21) mod 26 = 21

34

B.1. Substitution Ciphers 7. One-Time PadsObservations:The repeated letter comes from different plaintext lettersDuplicate ciphertext letters are generally unrelated when this encryption algorithm is used => there is no information in the message to be exploitedDisadvantagesThe key cannot be memorized, both sender and receiver must carry a written copy with themTotal amount of data can be transmitted is limited by the amount of key availableAabsolute synchronisation is between sender and receiver, otherwise, it fails completely to protect message integrity)35

B.2. Transposition CiphersTransposition cipher reorders (rearrange) symbols but does not disguise them. It is also called permutationWith transposition, the cryptography aims for diffusionWidely spreading the information from the message or the key across the ciphertextTranspositions try to break established patterns36

B.2. Transposition Ciphers1. Route Cipher37

B.2. Transposition Ciphers2. Rail Fence Cipher38

B.2. Transposition Ciphers3. Columnar TranspositionPlaintext written in rowsNumber of columns = key lengthKey is used to number the columnsCiphertext reads out by columns, starting with column whose key letter is lowest

39

B.2. Transposition Ciphers3. Columnar TranspositionFor example:Plaintext (M): WE ARE DISCOVERED FLEE AT ONCEKey (K): 6 3 2 4 1 5

Ciphertext(C): EVLNE ACDTK ESEAQ ROFOJ DEECU WIREE40

40

Example:Columnar cipher

Ciphertext(C): EVLNX ACDTX ESEAX ROFOX DEECX WIREEKey: 632415

Plaintext (M): WE ARE DISCOVERED FLEE AT ONCE

Question reviewQ1. Encrypt the following plaintext using Columnar transposition:We are going to university every dayUse your Last name as keywordQ2.use the rail fence Cipher (3 rails) to encode the following plaintext Plaintext: We are going to university every day

Question reviewQ3. They are 4! = 24 possible combinations for the substations. Here some sample:

Q4 . By using brute force we must try all 24 choices until we break the cipher.

Encryption & DecryptionPlaintext & CiphertextAlgorithm & CipherCryptologyCryptography & CryptanalysisKeySubstitution & TranspositionMonoalphabetic Ciphers & Polyalphabetic Ciphers

Terms and Concepts44

Encrypt

Encrypt key

k

Plaintext message

At 2 o'clock ..

HYPERLINK mailto:&*k+u7@~ &*k+u7@~1

transmitted over an insecure channel.

Plaintext message

Decrypt key

k

Decrypt

Encryption to provide confidentiality

ABCDEFGHIJKLMNOPQRSTUVWXYZ

012345678910111213141516171819202122232425


Recommended