Thursday, September 17, 2015

Gold Bug

Problem

Solve the gold bug story's cipher

Note: This is from Mark Stamp's Information Security: Principles and Practice book, chapter 2. Solution below was submitted as homework for CS265 Cryptography and Information Security class at San Jose State University.

Solution

The cipher is a substitution cipher. Analysis of the frequency counts of letters and words in the English language were used to convert the cipher text to plain text.

The original cipher text is:
53++!305))6*;4826)4+.)4+);806*;48!8`60))85;;]8*;:+*8!83(88)5*!;
46(;88*96*?;8)*+(;485);5*!2:*+(;4956*2(5*-4)8`8*; 4069285);)6
!8)4++;1(+9;48081;8:8+1;48!85;4)485!528806*81(+9;48;(88;4(+?3
 4;48)4+;161;:188;+?;

Since e is the most frequently occurring letter in the English language, and 8 is the most frequently occurring character (34 times) in the above cipher, we make an intelligent guess that ‘e’ is mapped to the letter 8. So we get:
53++!305))6*;4e26)4+.)4+);e06*;4e!e`60))e5;;]e*;:+*e!e3(ee)5*!;
46(;ee*96*?;e)*+(;4e5);5*!2:*+(;4956*2(5*-4)e`e*; 40692e5);)6
!e)4++;1(+9;4e0e1;e:e+1;4e!e5;4)4e5!52ee06*e1(+9;4e;(ee;4(+?3
4;4e)4+;161;:1ee;+?;

‘The’ is the most common 3 word in English with the letter e and correspondingly we find several instances of “;4e” above. So we guess that ; is t, 4 is h. By replacing those we get:
53++!305))6*the26)h+.)h+)te06*the!e`60))e5tt]e*t:+*e!e3(ee)5*!t
h6(tee*96*?te)*+(the5)t5*!2:*+(th956*2(5*-h)e`e*t h0692e5)t)6
!e)h++t1(+9the0e1te:e+1the!e5th)he5!52ee06*e1(+9thet(eeth(+?3
hthe)h+t161t:1eet+?t

We then guess that the below words in the below order:
t(ee – tree
thr+?3h – through
!egree – degree
th6rtee* - thirteen
5nd – and
degree) – degrees
9inutes – minutes
1rom – from
fift: - fifty
0eft – left
de`ils – devils
2y – by
bisho.s – bishops
bran-h - branch
t]enty one – twenty one



5
2
-
!
8
1
3
4
6
0
9
*
+
.
(
)
;
?
`
:
]
a
b
c
d
e
f
g
h
i
l
m
n
o
p
r
s
t
u
v
y
w

Plain text:
a good glass in the bishops hostel in the devils sea twenty one degrees and thirteen minutes north east and by north main branch seventh limb east side shoot from the left eye of the deaths head a beeline from the tree through the shot fifty feet out

This cryptanalytic success leads to a plain text puzzle with no punctuations. As Legrand recognizes the words, he adds spaces. Then he splits the words into groups that make sense, by making use of the fact that people tend overcrowd details together when they try to make a crypt without punctuations, making the 5 groups stand out.

Groups:
A good glass in the bishop's hostel in the devil's --twenty-one degrees and thirteen minutes --northeast and by north --main branch seventh limb east side --shoot from the left eye of the death's-head --a bee-line from the tree through the shot fifty feet out.

As a result of the cryptanalytic success, Ledger figures out the secret location of the pirate’s (Kidd) treasure from the plain text. With the help of a friend and his caretaker, he digs out the treasure from the location.

Reference:

Story - http://poestories.com/read/goldbug

No comments:

Post a Comment