5
Sheet 1 Question 1 Given that the Caesars cipher is used, find the plaintext from the ciphertextVSRQJHEREVTXDUHSDQWU 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 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 q Ans. Shift backward by three positions From cipher to plain text SPONGEBOBSQUAREPANTR Question 2 Find the plaintext and the key from the ciphertextCSYEVIXIVQMREXIH Given that the cipher is a simple substitution of the shift-by-n variety. q Ans. Shift backward by one to four positions From cipher to plain text n = 1 BRXDUHWHUPLQDWHG n = 2 AQWCTGVGTOKPCUGF n = 3 ZPVBSFUFSNJOBUFE n = 4 YOUARETERMINATED Question 3 If we have a computer that can test 2 40 keys each second, and if the key space is of size 2 128 , find: q Ans. The average time taken to find the correct key Ans. (2^128 / 2^40) / 31,557,600 = 4,903,494,084,172,197,326.87 years Remark There are 31,557,600 seconds a year (365.25 days per year) Question 5 The weak ciphers used during the election of 1876 employed a fixed permutation of the words for a given length sentence. To see that this is weak, find the permutation of (1, 2, 3, . . . , 10) that was used to produce the scrambled sentences below, where San Franciscois treated as a single word. Note that the same permutation was used for all three sentences. first try try if you and dont again at succeed only you you you as believe old are are as winter was in the I summer ever San Francisco coldest spent

Networks Sheet 2 Sol

Embed Size (px)

Citation preview

Page 1: Networks Sheet 2 Sol

Sheet 1 Question 1 Given that the Caesar’s cipher is used, find the plaintext from the ciphertextVSRQJHEREVTXDUHSDQWU

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

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

q Ans. Shift backward by three positions From cipher to plain text

SPONGEBOBSQUAREPANTR

Question 2 Find the plaintext and the key from the ciphertextCSYEVIXIVQMREXIH Given that the cipher is a simple substitution of the shift-by-n variety. q Ans. Shift backward by one to four positions From cipher to plain text

n = 1 BRXDUHWHUPLQDWHG n = 2 AQWCTGVGTOKPCUGF n = 3 ZPVBSFUFSNJOBUFE n = 4 YOUARETERMINATED Question 3 If we have a computer that can test 240 keys each second, and if the key space is of size 2128, find: q Ans.

The average time taken to find the correct key Ans. (2^128 / 2^40) / 31,557,600 = 4,903,494,084,172,197,326.87 years Remark – There are 31,557,600 seconds a year (365.25 days per year) Question 5 The weak ciphers used during the election of 1876 employed a fixed permutation of the words for a given length sentence. To see that this is weak, find the permutation of (1, 2, 3, . . . , 10) that was used to produce the scrambled sentences below, where “San Francisco” is treated as a single word. Note that the same permutation was used for all three sentences. first try try if you and don’t again at succeed only you you you as believe old are are as winter was in the I summer ever San Francisco coldest spent

Page 2: Networks Sheet 2 Sol

q Ans.

4 9 1 5 7 10 2 6 3 8 If at first you don’t succeed try and try again You are only as old as you believe you are The coldest winter I ever spent was summer in San Francisco Question 7 Define the terms confusion and diffusion in the context of cryptology. Discuss a classic cipher that employs only confusion and also discuss a classic cipher that employs only diffusion. Which cipher discussed in this chapter employs both confusion and diffusion? q Ans.

Confusion is designed to obscure the relationship between the plaintext and ciphertext, while diffusion is supposed to spread the plaintext statistics through the ciphertext. A simple substitution cipher and a one-time pad employ only confusion, whereas a double transposition is a diffusion-only cipher. Since the one-time pad is provably secure, evidently confusion alone is “enough,” while, apparently, diffusion alone is not. DES (Data Encryption Standard) offers both confusion and diffusion Question 8 Decrypt a simple substitution cipher—though a shift by n PBFPVYFBQXZTYFPBFEQJHDXXQVAPTPQJKTOYQWIPBVWLXTOXBTFXQWAXBVCXQWAXFQJVWLEQNTOZQGGQLFXQWAKVWLXQWAEBIPBFXFQVXGTVJVWLBTPQWAEBFPBFHCVLXBQUFEVWLXGDPEQVPQGVPPBFTIXPFHXZHVFAGFOTHFEFBQUFTDHZBQPOTHXTYFTODXQHFTDPTOGHFQPBQWAQJJTODXQHFOQPWTBDHHIXQVAPBFZQHCFWPFHPBFIPBQWKFABVYYDZBOTHPBQPQJTQOTOGHFQAPBFEQJHDXXQVAVXEBQPEFZBVFOJIWFFACFCCFHQWAUVWFLQHGFXVAFXQHFUFHILTTAVWAFFAWTEVOITDHFHFQAITIXPFHXAFQHEFZQWGFLVWPTOFFA Assignment Question 9 Decrypt the simple substitution MXDXBVTZWVMXNSPBQXLIMSCCSGXSCJXBOVQXCJZMOJZCVCTVWJCZAAXZBCSSCJXBQCJZCOJZCNSPOXBXSBTVWJCJZDXGXXMOZQMSCSCJXBOVQXCJZMOJZCNSPJZHGXXMOSPLHJZDXZAAXZBXHCSCJXTCSGXSCJXBOVQX —plaintext from Lewis Carroll, Alice in Wonderland Assignment

Page 3: Networks Sheet 2 Sol

Question 10 Decrypt the following message that was encrypted using a simple substitution cipher: GBSXUCGSZQGKGSQPKQKGLSKASPCGBGBKGUKGCEUKUZKGGBSQEICACGKGCEUERWKLKUPKQQGCIICUAEUVSHQKGCEUPCGBCGQOEVSHUNSUGKUZCGQSNLSHEHIEEDCUOGEPKHZGBSNKCUGSUKUASERLSKASCUGBSLKACRCACUZSSZEUSBEXHKRGSHWKLKUSQSKCHQTXKZHEUQBKZAENNSUASZFENFCUOCUEKBXGBSWKLKUSQSKNFKQQKZEHGEGBSXUCGSZQGKGSQKUZBCQAEIISKOXSZSICVSHSZGEGBSQSAHSGKHMERQGKGSKREHNKIHSLIMGEKHSASUGKNSHCAKUNSQQKOSPBCISGBCQHSLIMQGKGSZGBKGCGQSSNSZXQSISQQGEAEUGCUXSGBSSJCQGCUOZCLIENKGCAUSOEGCKGCEUQCGAEUGKCUSZUEGBHSKGEHBCUGERPKHEHKHNSZKGGKAD Assignment Question 11 Write a program to help an analyst decrypt a simple substitution cipher.Your program should take the ciphertext as input, compute letter frequency counts, and display these for the analyst. The program should then allow the analyst to guess the key and display the results of “decryption” with the putative key. Assignment Question 12 Extend the program developed in Problem 11 so that it initially tries to decrypt the message. Here is one sensible way to proceed. Use the computed letter frequencies and the known frequencies of English for an initial guess at the key. Then from the resulting putative decryption, count the number of dictionary words that appear and use this as a “score.” Next, for each letter in the key, try swapping it with a letter that is adjacent (with respect to frequency counts) and recompute the score. If the score improves, update the key; if not, don’t update the key. Iterate this process until the score does not improve for an entire pass through the alphabet. At this point you will pass your putative decryption to the analyst. In order to aid the analyst in the manual phase, your program should maintain all of the functionality of the program for Problem 11. Assignment Question 13 Encrypt the message we are all together using a double transposition cipher with 4 rows and 4 columns, using the row permutation Using the row permutation (1, 2, 3, 4) → (2, 4, 1, 3) And the column permutation (1, 2, 3, 4) → (3, 1, 2, 4).

Page 4: Networks Sheet 2 Sol

q Ans.

W E A R E A L L T O G E T H E R For row first and then column permutation W E A R 1 E A L L 2 T O G E 3 T H E R 4 E A L L 2 T H E R 4 W E A R 1 T O G E 3 Cipher text should be EALLTHERWEARTOGE 3 1 2 4 L E A L E T H R A W E R G T O E Cipher text should be LEALETHRAWERGTOE Question 14 Decrypt the ciphertext IAUTMOCSMNIMREBOTNELSTRHEREOAEVMWIHTSEEATMAEOHWHSYCEELTTEOHMUOUFEHTRFT This message was encrypted with a double transposition using a matrix of 7 rows and 10 columns. Hint: The first word is “there.” q Ans.

I A U T M O C S M N I M R E B O T N E L S T R H E R E O A E V M W I H T S E E A T M A E O H W H S Y C E E L T T E O H M U O U F E H T R F T

Page 5: Networks Sheet 2 Sol

First we will try to sort the columns in order to make rows more readable: 2 4 7 6 5 9 3 10 1 8 A T C O M M U N I S M E T O B E R L I N T H E R E A R E S O M I S T H E W A V E M E W H O S A Y T H E L E T T H E M C O O F T H E F U T U R Then we will try to sort the rows in order to complete the sentence: T H E R E A R E S O M E W H O S A Y T H A T C O M M U N I S M I S T H E W A V E O F T H E F U T U R E L E T T H E M C O M E T O B E R L I N Plain text: There are some who say that communism is the wave of the future, let them come to Berlin

Best Wishes Aya Sedky