Sunteți pe pagina 1din 31

Classical Cryptography

20 Solved Problems Of Classical Cryptography Techniques And Analysis

BY KADHUM A.KADHUM

1-Monoalphabetic Cipher
1-1The Shift Cipher Problem 1:The following shows a plaintext and its corresponding ciphertext. Is the cipher monoalphabetic?

Plaintext: HELLO Ciphertext: KHOOR

Solution The cipher is probably monoalphabetic because both occurrences of L s are encrypted as O s. Problem 2:The following shows a plaintext and its corresponding ciphertext. Is the cipher monoalphabetic? Plaintext: HELLO Ciphertext: ABNZF Solution The cipher is not monoalphabetic because each occurrence of L is encrypted by a different character. The first L is encrypted as N; the second as Z.

Problem 3:Use the shift cipher with key = 15 to encrypt the message HELLO.

Solution We encrypt one character at a time. Each character is shifted 15 characters down. Letter H is encrypted to W. Letter E is encrypted to T. The first L is encrypted to A. The second L is also encrypted to A. And O is encrypted to D. The cipher text is WTAAD.

Problem 4:Use the shift cipher with key = 15 to decrypt the message WTAAD. Solution:We decrypt one character at a time. Each character is shifted 15 characters up. Letter W is decrypted to H. Letter T is decrypted to E. The first A is decrypted to L. The second A is decrypted to L. And, finally, D is decrypted to O. The plaintext is HELLO.

Affine Ciphers An encipherment scheme (or algorithm) of the form E(x) = (ax + b)MOD26 is called an affine cipher. Here x is the numerical equivalent of the given plaintext letter, and a and b are (appropriately chosen) integers. Recall that the numerical equivalents of the letters are as follows: ABCDEFGHIJ K LMN O P Q R S T U V WX Y Z 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 Also note that if a = 1, then E(x) = (x + b)MOD26 is simply a Caesar (+b) shift cipher.

Problem 5:Encipher ITS COOL with E(x) = (5x + 8)MOD26 Solution:Filling in the following table gives plain I T S C O O L x 8 19 18 2 14 14 11 5x + 8 48 103 98 18 78 78 63 (5x + 8)MOD26 22 25 20 18 0 0 11 cipher W Z U S A A L

If y = E(x) = (ax+b)MOD26, then we can solve for x in terms of y and so determine E 1(y). That is, if y (ax + b) (mod 26), then y b ax (mod 26), or equivalently ax (y b) (mod 26). Using our earlier results, we see that if we multiply both sides by a 1 (mod 26), then x= a 1(y b) (mod 26) and so our decipherment function is E 1(y) = a 1(y b)MOD26.

Problem 6:Decipher HPCCXAQ if the encipherment function is E(x) = (5x + 8)MOD26. Solution:We begin by finding the decipherment function. Since 5x=1 (mod 26) is solved with x = 21 (mod 26) we see 5 1 (mod 26) = 21. Therefore, E 1(y) = 21(y 8)MOD26

and so filling in our table gives

cipher y y 8 21(y 8) 21(y 8)MOD26 Plain

H P C C X A Q 7 15 2 2 23 0 16 -1 7 -6 -6 15 -8 8 -21 147 -126 -126 315 -168 168 5 17 4 4 3 14 12 F R E E D O M

Problem 7:Suppose that an affine cipher E(x) = (ax + b)MOD26 enciphers H as X and Q as Y. Find the cipher (that is, determine a and b). Solution:We see that H X means E(7) = 23 and Q Y means E(16) = 24. That is, a 7 + b=23 (mod 26) and a 16 + b=24 (mod 26). Subtracting gives 16a 7a =1 (mod 26) so that 9a=1 (mod 26). Therefore, a = 9 1 (mod 26) = 3. Finally, we substitute a = 3 into either of the earlier equations and solve for b, i.e., 3 7 + b=23 (mod 26) implies b = 2. In summary, E(x) = (3x + 2)MOD26.

1-2 The Simple Substitution Cipher Problem 8:Using this system, the keyword "zebras" gives us the following alphabets: Plaintext alphabet: ABCDEFGHIJKLMNOPQRSTUVWXYZ A message of flee at once. we are discovered! Solution:Ciphertext alphabet: ZEBRASCDFGHIJKLMNOPQTUVWXY enciphers to SIAA ZQ LKBA. VA ZOA RFPBLUAOAR!

1-3 Playfair Cipher Problem 9:Using "playfair example" as the key To Encrypting the message "Hide the gold in the tree stump": Solution:- the table becomes: P I B J T L R C K U A E D N V Y X G O W F M H S Z

Plain Text: HI DE TH EG OL DI NT HE TR EX ES TU MP

The pair HI forms a rectangle, replace it with BM The pair DE is in a column, replace it with ND The pair TH forms a rectangle, replace it with ZB The pair EG forms a rectangle, replace it with XD The pair OL forms a rectangle, replace it with KY The pair DI forms a rectangle, replace it with BE The pair NT forms a rectangle, replace it with JV The pair HE forms a rectangle, replace it with DM The pair TR forms a rectangle, replace it with UI The pair EX (X inserted to split EE) is in a row, replace it with XM The pair ES forms a rectangle, replace it with MN The pair TU is in a row, replace it with UV The pair MP forms a rectangle, replace it with IF Cipher text: BM ND ZB XD KY BE JV DM UI XM MN UV IF

2-Polyalphabetic Cipher
2-1 Vigenere Cipher Problem 10:Encipher the following message using the Vigenere cipher and the keyword "IHS
there is a secret passage behind the picture frame

Solution:Plaintext: THE REI SAS ECR ETP ASS AGE BEH IND THE PIC TUR EFR AME Key word: IHS IHS IHS IHS IHS IHS IHS IHS IHS IHS IHS IHS IHS IHS Ciphertext: BOWZLAAHKMJJMAHIZKINWJLZQUVBOWXPUBBJMMJITW

Problem 11:Decrypt the ciphertext


UWTULFPTZKFHBZMZIM

given that it has been encrypted with the Vigenere cipher using the keyword `maths'. Solution:Ciphertext y keyword dK(y) Plaintext U 12 8 i W 0 22 w T 19 0 a U 7 n L 18 t F 5 12 19 t P 0 15 p T 19 0 a Z 7 s K F H B 5 7 1 Z 25 7 s M 12 18 u Z 25 12 n I M 20 22 19 20 11 13 19 15 19 25 10 8 12 0 19 8 19 i t

18 12 0 19 s t h i

18 18 19 7 8

18 20 13

Plaintext: I want to pass this unit.

2-2 Hill Cipher


abcdefghi j k l mn o p q r s t u v w x y z . ? _ 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28

Numerical representation of 29-letter alphabet

Fourth, the numbers 25 23 21 23 14 1 17 4 14 19 11 12 from the strung-out columns just obtained represent the letters: zxvxobreotlm 2-3 Permutation Cipher Problem 13:encrypt the plaintext `This is not secure Using Permutation Cipher and M=5 Solution:1 2 3 4 5 Plaintext t h i s i s no t s e c u r e 3 1 4 5 2 Ciphertext H I T I S NS SOT C E EUR

Problem 14:You have found an old cryptotext and you know that the plaintext is related to cryptography. You suppose Vigenere cryptosystem was used so you looked for repeated strings in the cryptotext. You found that the string TICRMQUIRTJR occurs twice in the cryptotext. The first occurrence begins at position 10 and the second one at position 241. You guess this cryptotext sequence is the encryption of the plaintext word CRYPTOGRAPHY. If you are right, what would be the key? Solution:- First, we need to guess the length of the keyword. We can see that the distance between this two occurrences is 241 10 = 231. To guess the length of the keyword, we need to find the factors of 231 and we can see that 231 = 11 21 = 11 7 3. Second, we get the letters of the keyword using the Vigenere encrypting table. And we get results that are shown in the table: Position in the cryptotext 10 11 12 13 14 15 16 17 18 19 20 21 Cryptotext TICRMQUIRTJR Message CRYPTOGRAPHY Keyword RRECTCORRECT Now, we can see, that the length of the keyword is not 3 because there are more then three letters in the keyword. The length of the keyword is not 11 either because the 10th and 21st position of the keyword are different. Hence the length of the code word must be 7 and we can see that the 10th and 17th position are equal and so on. Now we must find the beginning of the repeated keyword. Because its length is seven, it starts at 1st, 8th, 15th, 22nd . . . position of the cryptotext and here we get the keyword Correct .

Problem 15:What is the most Classified Branches Of Cryptanalysis Solution:Depending on what a cryptanalyst has to work with, attacks can be classified into 1-Ciphertext only attack 2-Known plaintext attack 3-Chosen plaintext attack 4-Chosen ciphertext attack

Problem 16:Define The Following 1Ciphertext only attack 2Known plaintext attack 3Chosen plaintext attack 4Chosen ciphertext attack Solution:1-Ciphertext only attack Collect cipher texts of several messages encrypted using the same encryption algorithm and try to recover plaintexts or encrypting key(s).

2-Known plaintext attack Able to collect ciphertext of several messages and corresponding plaintext, and try to resolve the encrypting key(s). 3-Chosen plaintext attack Able to collect ciphertext of several messages and associated plaintext, and also able to choose the plaintext that gets encrypted. Try to deduce the encrypting key(s). 4-Chosen ciphertext attack Able to choose different ciphertext to be decrypted and has access to the decrypted plaintext. Try to deduce the key

Problem 17:How does a known plaintext attack work against Vigen`ere? Solution:If the plaintext is X1X2 . . . , the ciphertext is Y1Y2 . . . , then the key is k1k2 . . . with ki = yi xi (mod 26). This key is a periodic sequence, just repeating the keyword, so the keyword can be read off immediately. (Of course, the length of the texts should be at least a couple of times larger than the keyword length to recognize the period without doubt.)

Problem 18:Summarize in two or three sentences how a ciphertext only attack works against Vigen`ere? Solution:First displace the ciphertext by 1, 2, etc. letters, find which gives the largest number of coinciding letters, and that should be the keyword length. (Note for maximalists: This is unsafe for displacements 1 and 2, because of the correlations between nearby letters in the plaintext. However, if is the real length, then i will give many coincidences for each i = 1, 2, . . . . Therefore, many coincidences for displacement 2, say, but few for 4, will mean that the length is probably not 2.) Once you have the keyword length , do frequency analysis on the ciphertext letters yj , y +j, y2 +j , . . . to find the shift there, for each j = 1, 2, . . . , . Combine these shifts to get the keyword.

Problem 19:The plaintext fool is encrypted with a 22 Hill cipher, resulting in the ciphertext WISE. What is the encryption matrix?

Problem 20:In the Vigen`ere cryptosystem, if Alice first encrypts a plaintext with the keyword ALICE, then encrypts the resulting ciphertext with the keyword BOB, is that safer than encrypting only with ALICE? Solution:Since the Least Common Multiple of 3 and 5 is 15, the combination is again just Vigen`ere, now with a length 15 keyword:

Plaintext x1 1st keyword A=0 2nd keyword B=1 ciphertext x1 + 1

x2 x3 x4 x5 x6 x7 . . . x15 x16 x17 . . . L=11 I C E A L... E A L... O=14 B B O B B . . . B B O . . . x2 + 25 . . . x16 + 1 x17 + 25 . . .

If we have a long ciphertext, this doesn t really increase security, since one can break the ciphertext with the usual methods against Vigen`ere. For short ciphertexts, though, it is a bit safer, since we need to do frequency analysis on every 15th letter, instead of every 5th letter, hence we have less data for each analysis, which makes the results less certain.

Problem 21:What is a public key cryptosystem? Solution:The encryption key is public (known to everyone), only the decryption key is kept private. It is computationally infeasible to find the decryption key from the known encryption key. With the public key, anyone can send an encrypted message to Bob. Problem 22:What is a substitution cipher? Solution:The key is a bijection from the alphabet to itself: each letter is substituted by another letter (same plaintext letter always becomes the same ciphertext letter).

BLAH
BLAH
BLAH BLAH

BL
BLAH

BLAH

S-ar putea să vă placă și