Cryptology - I: Homework 1 - Mono- and Poly-alphabetic Ciphers

Instructors: R.E. Newman-Wolfe and M.S. Schmalz


In this homework, we cover shift, substitution, and Vigenere ciphers. All problems are taken from the textbook (Stinson). Many thanks to Jim Wei and Eric Chung for sharing their solution files with us, which we have modified to form this Web page.

Problem 1.1. Below are given four examples of ciphertext, obtained from Substitution, Vigenere, Affine, and unspecified ciphers. Provide the plaintext and explain how you obtained the solution.

1.1 a) Substitution Cipher. The technique here is to compute the sorted histogram of both ciphertext and a similar plaintext corpus. You have the advantage in the latter case of Table 1.1 on page 26 of Stinson. By matching the first two quintiles of characters (to preserve a high signal-to-noise ratio), you can obtain some guesses about letters. Here is the ciphertext and plaintext juxtaposed, followed by the method Jim used to solve the problem:

Ptxt: imaynotbeabletogrowflowersbutmygardenproduces
Ctxt: EMGLOSUDCGDNCUSWYSFHNSFCYKDPUMLWGYICOXYSIPJCK
 
      justasmanydeadleavesoldovershoespiecesofropea
      QPKUGKMGOLICGINCGACKSNISACYKZSCKXECJCKSHYSXCG

      ndbushelsofdeadgrassasanybodysandtodayibought
      OIDPKZCNKSHICGIWYGKKGKGOLDSILKGOIUSIGLEDSPWZU

      awheelbarrowtohelpinclearingitupihavealwayslo
      GFZCCNDGYYSFUSZCNXEOJNCGYEOWEUPXEZGACGNFGLKNS

      vedandrespectedthewheelbarrowitistheonewheele
      ACIGOIYCKXCJUCIUZCFZCCNDGYYSFEUEKUZCSOCFZCCNC

      dvehicleofwhichiamperfectmaster
      IACZEJNCSHFZEJZEGMXCYHCJUMGKUCY

Deciphered Plaintext:

Ctxt: 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
Freq: 5     37 8  12 9  24 5  15 7  18 7  5  13 10 6  1     20    14    5  7  15 13
Rank: 21    1  13 10 12  2 19  6 14 4  15 20 9  11 17 22    3     7     18 16 5  8
Ptxt: v     e  b  i  w  a  f  d  c  s  y  m  l  n  u  j     o     y     g  p  r  h

Analysis:
C -> e - because C is most frequent  
Q -> j - because both only occur once
Z -> h - There are 7 ZC's, but only 1 CZ, and HE is 2nd most
	   frequent digram.
       - Also there are 4 ZCN's, and HER is 4-th most popular trigram.
N -> l - A guess that worked
U -> t - There are 2 UZC's, and THE is the most frequent trigram
       - Also 1 CU and 2 UC's (with TE and ET corresponding) are on the 
	   digram list, but their frequencies are low.
S -> o - As in l-ved, o and i both fit, o was tried first and it worked.
O -> n - GO occured 5 times, and is a frequent English digram.
K -> s - K is 4th most popular letter and cannot be a vowel, otherwise we
           would frequently have three consecutive vowels (e.g., CKS).
I -> d - ICGI, which decrypts to -ea- becomes "dead"
           Similarly,lea-e- is probably leaves.
A -> v - From the I->d substitution, NCG-C is lea-e => leave
W -> g - WYGKK => -rass, which is "grass".
L -> y - An easy guess: alwa-s => always.
X -> p - Since res-e-ted should be "respected"
J -> c - As in the preceding substitution, respe-ted should be "respected"
E -> i - An easy guess: veh-cle is "vehicle".
P -> u - Another easy one: prod-ces is "produces".
D -> b - "-ought" => "bought" and "wheel-arrow" => "wheelbarrow".
M -> m - "I-aynot" => "I may not"
The remainder of the substitutions were guesses worked out as before.

1.1b) Vigenere Cipher

Ciphertext:

        KCCPKBGUFDPHQTYAVINRRTMVGRKDNBVFDETDGILTXRGUD
        DKOTFMBPVGEGLTGCKQRACQCWDNAWCRXIZAKFTLEWRPTYC
        QKYVXCHKFTPONCQQRHJVAJUWETMCMSPKQDYHJVDAHCTRL
        SVSKCGCZQQDZXGSFRLSWCWSJTBHAFSIASPRJAHKJRJUMV
        GKMITZHFPDISPZLVLGWTFPLKKEBDPGCEBSHCTJRWXBAFS
        PEZQNRWXCVYCGAONWDDKACKAWBBIKFTIOVKCGGHJVLNHI
        FFSQESVYCLACNVRWBBIREPBBVFEXOSCDYGZWPFDTKFQIY
        CWHJVLNHIQIBTKHJVNPIST
Method:

1.1c) Affine Cipher The given ciphertext and plaintext are:
Ctxt: KQEREJEBCPPCJCRKIEACUZBKRVPKRBCIBQCARBJCVFCUP
Ptxt: ocanadaterredenosaieuxtonfrontestceintdefleur

      KRIOFKPACUZQEPBKRXPEIIEABDKPBCPFCDCCAFIEABDKP
      onsglorieuxcartonbrassaitporterlepeeilsaitpor

      BCPFEQPKAZBKRHAIBKAPCCIBURCCDKDCCJCIDFUIXPAFF
      terlacroixtonhistoireestuneepopeedesplusbrill

      ERBICZDFKABICBBENEFCUPJCVKABPCYDCCDPKBCOCPERK
      antsexploitsettavaleurdefoitrempeeprotegerano

      IVKSCPICBRKIJPKABI
      sfoyersetnosdroits
This is the Canadian national anthem in French, as might be sung from time to time in Quebec.

Total number of characters: 198
Ordr: 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
Ctxt: 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
Freq: 13 21 32 9  13 10    1  16 6  20       1  2  20 4  12 1     6  4     2  1  4
Rank: 6  2  1  10 7  9        5  11 3              4     8        12
Ptxt: i  t  e  p  a  l  w  h  s  d  o  z  k  v  g  r  c  n  y  j  u  f  q  b  m  x

1.1d) Unspecified Cipher

Ciphertext:

        BNVSNSIHQCEELSSKKYERIFJKXUMBGYKAMQLJTYAVFBKVT
        DVBPVVRJYYLAOKYMPQSCGDLFSRLLPROYGESEBUUALRWXM
        MASAZLGLEDFJBZAVVPXWICGJXASCBYEHOSNMULKCEAHTQ
        OKMFLEBKFXLRRFDTZXCIWBJSICBGAWDVYDHAVFJXZIBKC
        GJIWEAHTTOEWTUHKRQVVRGZBXYIREMMASCSPBNLHJMBLR
        FFJELHWEYLWISTFVVYFJCMHYUYRUFSFMGESIGRLWALSWM
        NUHSIMYYITCCQPZSICEHBCCMZFEGVJYOCDEMMPGHVAAUM
        ELCMOEHVLTIPSUYILVGFLMVWDVYDBTHFRAYISYSGKVSUU
        HYHGGCKTMBLRX
Method:

Problem 1.2

Problem 1.4. Suppose we are told that the plaintext

		   conversation
		   
yields the ciphertext
		   HIARRTNUYTUS 
		   
where the Hill Cipher is used but the keysize m is not specified. Determine the encryption matrix.

Problem 1.7. We describe a special case of a Permutation Cipher. Let m and n be positive integers. Write out the plaintext, by rows, in mxn rectangles. Then form the ciphertext by taking the columns of these rectangles. For example, if m = 4 and n = 3, then we would encrypt the plaintext "cryptography" by forming the following rectangle:
                c r y p
                t o g r
                a p h y
   
The ciphertext would be CTAROPYGHPRY.

a) Describe how Bob would decrypt a ciphertext, given values for m and n.

b) Decrypt the following ciphertext, which was obtained using the preceding method of encryption:

       Ctxt: MYAMRARUYIQTENCTORAHROYWDSOYEOUARRGDERNOGW
    

Problem 1.11. We describe a stream cipher that is a modification of the Vigenere cipher...Each time we use the keyword we replace each letter by its successor modulo 26. For example, we use SUMMER to encrypt the first six letters, then TVNNFS to encrypt the second six letters, and so forth. Describe how you can use the concept of index of coincidence to first determine the length of the keyword, then actually find the keyword. Test your method by cryptanalyzing the following ciphertext:

        IYMYSILONRFNCQXQJEDSHBUIBCJUZBOLFQYSCHATPEQGQ
        JEJNGNXZWHHGWFSUKULJQACZKKJOAAHGKEMTAFGMKVRDO
        PXNEHEKZNKFSKIFRQVHHOVXINPHMRTJPYWQGJWPUUVKFP
        OAWPMRKKQZWLQDYAZDRMLPBJKJOBWIWPSEPVVQMBCRYVC
        RUZAAOUMBCHDAGDIEMSZFZHALIGKEMJJFPCIWKRMLMPIN
        AYOFIREAOLDTHITDVRMSE


This concludes the solution for Homework #1, Fall 1996. If you have a solution that you'd like us to review (and possibly post on this Web page), please feel free to submit an ASCII or HTML file via E-mail to Dr. Schmalz.