#1 - Pegasus @ UCF

advertisement

Cryptography Club Practice Cipher Solutions

#1

September 24, 2003

ArmbrusterJJ

It is known how the shift cipher works: From a given plaintext, each character is shifted up the alphabet by a certain number of characters. To decipher this text, it is necessary to determine the exact amount of shift. This can be done in a brute force method as follows; Write out each letter following the letters in the cipher text in the alphabet. When you hit A, cycle around to Z until you hit the original character in the given cipher text. This process is illustrated below:

TXP FQ X OXQ F PXT

UYQ GR Y PYR G QYU :: 1

VZR HS Z QZS H RZV :: 2

WAS IT A RAT I SAW :: 3 >> Logical text found..

XBT JU B SBU J TBX :: 4

YCU KV C TCV K UCY :: 5

ZDV LW D UDW L VDZ :: 6

AEW MX E VEX M WEA :: 7

BFX NY F WFY N XFB :: 8

CGY OZ G XGZ O YGC :: 9

DHZ PA H YHA P ZHD :: 10

EIA QB I ZIB Q AIE :: 11

FJB RC J AJC R BJF :: 12

GKC SD K BKD S CKG :: 13

HLD TE L CLE T DLH :: 14

IME UF M DMF U EMI :: 15

JNF VG N ENG V FNJ :: 16

KOG WH O FOH W GOK :: 17

LPH XI P GPI X HPL :: 18

MQI YJ Q HQJ Y IQM :: 19

NRJ ZK R IRK Z JRN :: 20

OSK AL S JSL A KSO :: 21

PTL BM T KTM B LTP :: 22

QUM CN U LUN C MUQ :: 23

RVN DO V MVO D NVR :: 24

SWO EP W NWP E OWS :: 25

We have found a legitimate English phrase. We achieved this be shifting three letters up the alphabet. Since we obtain our cipher text by shifting the plaintext characters up the alphabet a certain number of characters, the true key of the cipher is: 23

Key:

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

X Y Z A B C D E F G H I J K L M N O P Q R S T U V W

#2 It is known that the affine cipher transformation is given by:

E(x) = ( Ax + B) mod N with gcd( A,N ) = 1

:: N is assumed to be 26 for the English alphabet

MOV NKKDAV RDEOVI ONX MOIVV OBAGIVG

NAG MFVWQV HVJX LPG MFVAMJ XDU

Upon analyzing the cipher text, a few observations can be made. Since it is assumed that word spacings have in fact been given, there are five three letter words. Note: Frequency analysis can be used to attack this cipher as well as all the following substitution types. Instead, let us perform a probable-word attack and see if we can determine the key this way. Using the word frequency table on page 226 of Cryptanalysis by Helen Fouche Gaines, we see that THE is the most frequent three letter English word.

Assume: THE = MOV :: or in other words. Assume that using our encryption function, the plaintext THE was mapped to ciphertext MOV.

T H E represented by natural numbers starting at zero is::19 07 04

In addition, M O V :: 12 14 21

Since, T H E = M O V and we are given our encryption function, using our knowledge of how T and E are transformed, we know that:

E(19) = 12

E(07) = 14

However, E(X) = ( Ax+B ) mod N. So, it is observed that:

12 = ( A(19) + B ) mod 26 (1)

14 = ( A(07) + B ) mod 26 (2)

We have a system of two equations and two unknowns, therefore we may solve for both A and B. Subtracting equation 1 from equation 2, we arrive at:

12 - 14 = ( A(19) + B – A(07) – B ) mod 26

[ combine like terms and simplify ]

-2 = ( A(12) ) mod 26

[ reduced mod 26 ]

24 = ( A(12) ) mod 26

This equation has two solutions modulo 26, namely, A = 2 and A = 15.

However, it is a necessity for gcd(A,26) = 1. So which A satisfies?? gcd( 2, 26 ) = 2 So A = 2 is not a possibility

However, gcd(15,26) = 1 Making A = 15 a possibility.

Under the assumption that A=15, we now consider finding B and then continuing to decipher the remaining cipher text under this assumption.

As stated earlier: T H E = 19 07 04

MOV = 12 14 21

Assumption:

So we have:

And

A = 15

E( 19 ) = ( 19(15) + B ) mod 26

E( 07 ) = ( 07(15) + B ) mod 26

E( 04 ) = ( 04(15) + B ) mod 26

Solving for all three independently yields:

12 = ( 285 + B ) mod 26 => -273 = ( B ) mod 26 => 13 = ( B ) mod 26

14 = ( 105 + B ) mod 26 => -91 = ( B ) mod 26 => 13 = ( B ) mod 26

21 = ( 60 + B ) mod 26 => -39 = ( B ) mod 26 => 13 = ( B ) mod 26

Our assumptions up to now have yielded:

THE => MOV A = 15 B = 13

Using this assumption, we can form the decryption function D(y) as follows:

D(y) = ( A -1 (y-B) ) mod 26

Note:

To obtain the inverse of A, it is necessary to use Euclid’s algorithm or simply brute force. Notice that, 1 = (15)(7) mod 26. So 7 is the inverse of

15 modulo 26.

Our decryption function can be written precisely as follows:

D(y) = ( 7(y-13) ) mod 26

Applying D(y) to every element of the plain text, yields

D(12) = ( 7(12-13) ) mod 26 = ( -7 ) mod 26 = 19 :: T

D(14) = ( 7(14-13) ) mod 26 = ( 7 ) mod 26 = 7 :: H

And so forth…

The resulting ciphertext is:

THE AFFINE CIPHER HAS THREE HUNDRED

AND TWELVE KEYS MOD TWENTY SIX

#3

TFB CNKKNWGMD EGPFBR GS J DNNA BXJLPKB NC FNW WNRA

PJEGMDS LJY JSSGST YNU GM SNKVGMD J EGPFBR

This permutation cipher has word spacings. This allows the reader to guess not only at specific letters in the cipher but also full words. The first observation is that J is the only letter which is seen independently. This leads us to believe that either an A or I may be the true character. Using the frequency table on p 218 of

Cryptanalysis – Helen Fouche Gaines, it is observed that in general, A occurs more frequently than I. Given this, we shall assume the following:

A = J

TFB CNKKNWGMD EGPFBR GS J DNNA BXJLPKB NC FNW WNRA

A A

PJEGMDS LJY JSSGST YNU GM SNKVGMD J EGPFBR

A A A A

If this assumption leads us to poor conclusions about the rest of the words in the cipher, we shall return and assume I = J. Upon observing the cipher, several other observations can be made. It appears that there may be a flaw in the protocol used to devise the key to this cipher. This can be observed in the characters YNU. One of the most frequent 3 character English words is YOU. It is possible that the individual who devised the key of this cipher, made a mistake and sent these letters, which occur frequently in this common word, to themselves! Let us assume that these characters are in fact YOU and see if this leads us to absurd results, or good results.

TFB CNKKNWGMD EGPFBR GS J DNNA BXJLPKB NC FNW WNRA

O O A OO A O O O

PJEGMDS LJY JSSGST YNU GM SNKVGMD J EGPFBR

A AY A YOU O A

Since we have assumed one mistake has been made, perhaps there is also another! Let’s assume also that JSSGST = ASSIST:

TFB CNKKNWGMD EGPFBR GS J DNNA BXJLPKB NC FNW WNRA

T O O I IS A OO A O O O

PJEGMDS LJY JSSGST YNU GM SNKVGMD J EGPFBR

A I S AY ASSIST YOU I SO I A I

The next observation, concerns the two letter word NC, which we have assumed begins with an O. Referring to our frequent word list, OF is one of the most frequently occurring two letter English words. We shall next make this assumption: NC = OF

TFB CNKKNWGMD EGPFBR GS J DNNA BXJLPKB NC FNW WNRA

T FO O I IS A OO A OF O O

PJEGMDS LJY JSSGST YNU GM SNKVGMD J EGPFBR

A I S AY ASSIST YOU I SO I A I

With a computer handy, the solution to CNKKNWGMD can be found quickly by analyzing an English word list. If you do not have a computer handy, pull out the closest dictionary and begin searching down FO, it will not be long till you pass fodder and follicle and choose following!

TFB CNKKNWGMD EGPFBR GS J DNNA BXJLPKB NC FNW WNRA

T FOLLOWING I IS A GOO A L OF OW WO

PJEGMDS LJY JSSGST YNU GM SNKVGMD J EGPFBR

A INGS AY ASSIST YOU IN SOL ING A I

By this time, several things should appear likely, namely:

SNKVGMD = SOLVING

DNNA = GOOD

WNRA = WORD

TFB = THE

LJL = MAY

TFB CNKKNWGMD EGPFBR GS J DNNA BXJLPKB NC FNW WNRA

THE FOLLOWING I HER IS A GOOD E AM LE OF HOW WORD

PJEGMDS LJY JSSGST YNU GM SNKVGMD J EGPFBR

A INGS MAY ASSIST YOU IN SOLVING A I HER

Since we are solving a cipher, lets assume EGPFBR = CIPHER

TFB CNKKNWGMD EGPFBR GS J DNNA BXJLPKB NC FNW WNRA

THE FOLLOWING CIPHER IS A GOOD E AMPLE OF HOW WORD

PJEGMDS LJY JSSGST YNU GM SNKVGMD J EGPFBR

ACINGS MAY ASSIST YOU IN SOLVING A CIPHER

It appears that our author made several mistakes in protocol and grammar!

TFB CNKKNWGMD EGPFBR GS J DNNA BXJLPKB NC FNW WNRA

THE FOLLOWING CIPHER IS A GOOD EXAMPLE OF HOW WORD

PJEGMDS LJY JSSGST YNU GM SNKVGMD J EGPFBR

?

ACINGS MAY ASSIST YOU IN SOLVING A CIPHER

Using our knowledge of the English language and the statements intended meaning, we conclude the intended message:

TFB CNKKNWGMD EGPFBR GS J DNNA BXJLPKB NC FNW WNRA

THE FOLLOWING CIPHER IS A GOOD EXAMPLE OF HOW WORD

PJEGMDS LJY JSSGST YNU GM SNKVGMD J EGPFBR

SPACINGS MAY ASSIST YOU IN SOLVING A CIPHER

Key:

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

J O E A B C D F G H I K L M N P Q R S T U V W X Y Z

#4 This permutation cipher does not have word spacings, so it is necessary to use frequency analysis and a possible word attack.

It is observed that UMA is a rather frequently occurring tri-graph. If you were to assume that UMA=>THE, it would be difficult to arrive at a logical result.

Resulting to the frequent word listing, the next proper three letter assumption would be an AND. Therefore, we should properly assume UMA => AND.

HJBBORHXGNMBRSRBQVHMELBMSGBYSUTEGSLBUKKHJMBWSGB

N N N A A N

HQMULBRUQBWGUSUMAWGYUMAWGBQBUMAGNWUMAWGBMUMAWGN

NA A A AND AND AND AND NAND

For our second guess, we see several AND’s with spaces between them. One specific instance of interest is WGBM => _ _ _ N according to our current assumption. We now begin our search for a four letter word which has no A,N,or

D’s and ends in N. WHEN is an excellent candidate and is rather frequent according to our word list.

HJBBORHXGNMBRSRBQVHMELBMSGBYSUTEGSLBUKKHJMBWSGB

EE H NE E N EN HE A H EA NEW HE

HQMULBRUQBWGUSUMAWGYUMAWGBQBUMAGNWUMAWGBMUMAWGN

NA E A EWHA ANDWH ANDWHE EANDH WANDWHENANDWH

If our assumptions up to now are correct, the following substitutions should also be true, in this order:

WGN = WHO

WGBQB = WHERE

WGY = WHY

WGUS = WHAT

MULBR = NAMES

R = S

HJBBORHXGNMBRSRBQVHMELBMSGBYSUTEGSLBUKKHJMBWSGB

I EE SI HONESTSER IN MENTHEYTA HTMEA I NEWTHE

HQMULBRUQBWGUSUMAWGYUMAWGBQBUMAGNWUMAWGBMUMAWGN

IRNAMESAREWHATANDWHYANDWHEREANDHOWANDWHENANDWHO

After filling in the rest of the blanks or browsing through some literature. The solution soon reveals itself:

HJBBORHXGNMBRSRBQVHMELBMSGBYSUTEGSLBUKKHJMBWSGB

IKEEPSIXHONESTSERVINGMENTHEYTAUGHTMEALLIKNEWTHE

HQMULBRUQBWGUSUMAWGYUMAWGBQBUMAGNWUMAWGBMUMAWGN

IRNAMESAREWHATANDWHYANDWHEREANDHOWANDWHENANDWHO

Typically, permutation ciphers of this nature are attacked by using frequency properties of common English di-graphs and tri-graphs. This cipher is no

different. It was the correct assumption of the tri-graph‘AND’ that led to the ciphers solution.

For corrections, email: ArmbrusterJJ :: crypto@pegasus.cc.ucf.edu

Download