Dennis Shasha/Codes, Puzzles, and Conspiracy/1/Coded Letter

== Code ==
:My dear Evangeline and Scarlet,
::Fazr wxxkiqxn xa qocu zq if xrwoh mwek dkkb johotkbx,
:xmaztm wccarjobt xa if cwqxar, hwztmwdhf obcaiqkxkbx. Qhkwnk
:jab'x xwuk appkbnk, par mk on wb obxahkrwdhk nbad.
::Dkcwznk mk on znobt ik xa nahek iwbf koppoczhk qzyyhkn w
:jwf, mk toekn ik qroewcf wbj xoik xa xmobu. Xmk rknxhx on
:xmwx O cwb lroxk xa faz wx if hkonzrk. O mwek if jazdxn xmwx
:xmon hkxxkr lokh rkwcm faz, dzx O mwek w qhwb xa hkwek ox
:ob w trackr'n nxacu raai.
::Am, fkn, if cwqxar on Dkbgwiob Dwnukrmazbj, xmk iwxm
:qrajotf lma dkcwik w qmohanaqmf qrapknnar wx Qrobckxab, bal
:xzrbkj uojbwqqkr. Mk iwf kbxkr axmkr cwrkkrn ekrf naab. Loxm
:zmk habt-lobjkj obxrajzcxoab azx ap xmk lwf, faz lohh pobj ox kwnf
:xa jkcajk xmk rknx ob nqoxk ap xmk pwcx xmwx smk cajk on
:raxwxobt df abk hkxxkr rotmx bal.
::Exovlsnback xck npo oyxqq xsl dbcypcaxiig bc ynl jbfl. Nl
:dbcysbio npo xqqxpso eg dliiaixs ylilrnbcl, aopcu rspfxyl oxyliipyl
:dnxcclio. Nl qpcko slxkg mlidbjlo pc ixcko mnbol rlbril xkjpsl slelio.
:Ml xsl cbm pc Asauaxg, x ixck qpiilk mpyn lwpilk Exotalo mnb nxk
:qbauny xuxpcoy Qsxcdb pc Orxpc. Elqbsl ynpo, ml mlsl pc Nbrp
:dbacysg mnlsl ynl ysxkpypbcxi oaorpdpbc ybmxsko bayopklso mxo
:kporliilk mnlc Exovlsnback (xck P) nlirlk yb ibdxyl x upcxy xtapqls.
:Ynl dbkd po sbyxypcu xuxpc. Nm pzyh qd y sjyem rcty lyh, y
:nmmw, y kcdzo. Zomd nm ytm crr, bpbyjjh qd Fypwmtocbdl'p
:JmytImzp.
::Fypwmtocbdl qp pc ecdrqlmdz cr oqp yfqjqzh zc mgylm
:lmzmezqcd zoyz om yjjcnp km zc sjyh zom zcbtqpz -- yeecksydqml fh
:kh "fclhvbytlp," cr ecbtpm. Zom eclm qp tczyzqdv.
::Kddx sdu ln re Cucwczi. R orkk aui ad srwcun dca dcu enya
:mnqarezarde zem orkk knzhn odum orap z fpnnusck zem caanuki
:ezrhn pduqn-gunnmnu de z mrua udzm enzu z hrkkzwn fzkknm
:Tceaz Gzkknez. Zqx sdu apn truzan'q pdcqn zem idc ode'a gn szu
:zozi. Opne idc srem apn pduqn-gunnmnu, zqx prl opnapnu pn rq
:uzfrew zei kzln pduqnq aprq inzu. Fdmn fpzewnq zwzre. S psll feb
:ho ahlo be dro bqsr geno axasf.
::Bqo ofgensfx et bqo morraxo S loaio fozb bsmo psll vebabo
:efgo oagq bsmo bqo morraxo gefbasfr bqo lobbov ... poll, jed psll
:tsxdvo sb edb. Bqo bsmo atbov bqab, bqo geno psll ho bqo ramo
:efo bqab bqsr lobbov hoxaf psbq, ozgoub bqab bqo morraxo psll ho
:rulsb sfbe xvedur et osxqb gqavagborr. Bqoro xvedur psll ho
:pvsbbof sf vafnem evnov, hdb remo et bqom eiovlau.
::Haryovqedfn psll ho wdsgylj apavo et afj makev uelsgo
:euovabsef, re uloaro ho rdhblo. Lob remoefo yfep pqovo jed avo
:xesfx sf garo jed nsrauuoav.
:::::Jedvr,
:::::Kageh
== Solution ==
;Initial Observations
The message is apparently written in a substitution cipher such that the punctuation and word structure are unchanged.
It can be seen that there are several occurrences of a single-letter word consisting of one capital letter.
There is only one such in the English language, that is: I.
But it is not as straightforward as that.
This single-letter word appears as O, P, R and S, as we progress through the message.
That means the substitution cipher is not constant throughout the entire message, but changes a number of times.
By the pattern of the supposed translation of I, the change may be assumed (unless we find a contraindication) that the change consists of moving the ciphertext one letter further on in the alphabet.
The omission of Q suggests that two of these changes happened without I appearing in the meantime.
;Preliminary Signposts
The message is clearly a letter.
From background knowledge (that is, from reading the introduction to the puzzle) it is believed that it came from Jacob Ecco, who is believed to have been kidnapped by Benjamin Baskerhound.
The signoff fits the pattern: Yours, Jacob even to the repeated o.
Hence we can infer those letters in the final cipher, and, assuming $5$ ciphers in total, work back to the first.
Note that we still need to identify the points at which the cipher changes, which at this point is not obvious.
It can be noted that the word patterns are the same from the final S until the end of the letter, for example:
:S psll at the end of the $6$th paragraph
:jed psll in the $7$th paragraph
:jed appearing twice in the $8$th paragraph.
which leads to the conclusion that the same cipher is used from at least the end of paragraph $6$ to the end of the letter.
Clearly jed is code for you.
However, let us see what we have so far.
Fazr wxxkiqxn xa qocu zq if xrwoh mwek dkkb johotkbx,
xmaztm wccarjobt xa if cwqxar, hwztmwdhf obcaiqkxkbx. Qhkwnk
jab'x xwuk appkbnk, par mk on wb obxahkrwdhk nbad.
Dkcwznk mk on znobt ik xa nahek iwbf koppoczhk qzyyhkn w
jwf, mk toekn ik qroewcf wbj xoik xa xmobu. Xmk rknxhx on
xmwx O cwb lroxk xa faz wx if hkonzrk. O mwek if jazdxn xmwx
 I I
xmon hkxxkr lokh rkwcm faz, dzx O mwek w qhwb xa hkwek ox
 I
ob w trackr'n nxacu raai.
Am, fkn, if cwqxar on Dkbgwiob Dwnukrmazbj, xmk iwxm
qrajotf lma dkcwik w qmohanaqmf qrapknnar wx Qrobckxab, bal
xzrbkj uojbwqqkr. Mk iwf kbxkr axmkr cwrkkrn ekrf naab. Loxm
zmk habt-lobjkj obxrajzcxoab azx ap xmk lwf, faz lohh pobj ox kwnf
xa jkcajk xmk rknx ob nqoxk ap xmk pwcx xmwx smk cajk on
raxwxobt df abk hkxxkr rotmx bal.
Exovlsnback xck npo oyxqq xsl dbcypcaxiig bc ynl jbfl. Nl
dbcysbio npo xqqxpso eg dliiaixs ylilrnbcl, aopcu rspfxyl oxyliipyl
dnxcclio. Nl qpcko slxkg mlidbjlo pc ixcko mnbol rlbril xkjpsl slelio.
Ml xsl cbm pc Asauaxg, x ixck qpiilk mpyn lwpilk Exotalo mnb nxk
qbauny xuxpcoy Qsxcdb pc Orxpc. Elqbsl ynpo, ml mlsl pc Nbrp
dbacysg mnlsl ynl ysxkpypbcxi oaorpdpbc ybmxsko bayopklso mxo
kporliilk mnlc Exovlsnback (xck P) nlirlk yb ibdxyl x upcxy xtapqls.
 ( I)
Ynl dbkd po sbyxypcu xuxpc. Nm pzyh qd y sjyem rcty lyh, y
nmmw, y kcdzo. Zomd nm ytm crr, bpbyjjh qd Fypwmtocbdl'p
JmytImzp.
Fypwmtocbdl qp pc ecdrqlmdz cr oqp yfqjqzh zc mgylm
lmzmezqcd zoyz om yjjcnp km zc sjyh zom zcbtqpz -- yeecksydqml fh
kh "fclhvbytlp," cr ecbtpm. Zom eclm qp tczyzqdv.
Kddx sdu ln re Cucwczi. R orkk aui ad srwcun dca dcu enya
 I
mnqarezarde zem orkk knzhn odum orap z fpnnusck zem caanuki
ezrhn pduqn-gunnmnu de z mrua udzm enzu z hrkkzwn fzkknm
Tceaz Gzkknez. Zqx sdu apn truzan'q pdcqn zem idc ode'a gn szu
zozi. Opne idc srem apn pduqn-gunnmnu, zqx prl opnapnu pn rq
uzfrew zei kzln pduqnq aprq inzu. Fdmn fpzewnq zwzre. S psll feb
 I i o
ho ahlo be dro bqsr geno axasf.
b ab o us is co a ai
Bqo ofgensfx et bqo morraxo S loaio fozb bsmo psll vebabo
 co i o ssa I a i i ro a
efgo oagq bsmo bqo morraxo gefbasfr bqo lobbov ... poll, jed psll
o c ac i ssa co ai s r you i
tsxdvo sb edb. Bqo bsmo atbov bqab, bqo geno psll ho bqo ramo
 i ur i ou . i a r a co i b sa 
efo bqab bqsr lobbov hoxaf psbq, ozgoub bqab bqo morraxo psll ho
o a is r b a i c a ssa i b
rulsb sfbe xvedur et osxqb gqavagbovr. Bqoro xvedur psll ho
s i i o rou s o i c arac rs. s rou s i b
pvsbbof sf vafnem evnov, hdb remo et bqom eiovlau.
 ri i ra o or r bu so o o r a
Haryovqedfn psll ho wdsgylj apavo et afj makev uelsgo
Bas r ou i b uic y a ar o a y ajor o ic
euovabsef, re uloaro ho rdhblo. Lob remoefo yfep pqovo jed avo
o ra io so as b sub . so o o r you ar 
xesfx sf garo jed nsrauuoav.
 oi i cas you isa ar
 Jedvr,
 Yours,
 Kageh
 Jacob
It is now just about possible to restore the plaintext of the last few paragraphs directly by inspection.
We note that Haryovqedfn is most probably Baskerhound (see above), and replace its letters with their plaintext whenever they appear from S psll onwards:
S psll feb
I i no
ho ahlo be dro bqsr geno axasf.
be ab e o use his code a ain.
Bqo ofgensfx et bqo morraxo S loaio fozb bsmo psll vebabo
 he encodin o he essa e I ea e ne i e i ro a e
efgo oagq bsmo bqo morraxo gefbasfr bqo lobbov ... poll, jed psll
once each i e he essa e con ains he e er e , you i 
tsxdvo sb edb. Bqo bsmo atbov bqab, bqo geno psll ho bqo ramo
 i ure i ou . he i e a er ha he code i be he sa e
efo bqab bqsr lobbov hoxaf psbq, ozgoub bqab bqo morraxo psll ho
one ha his e er be an i h e ce ha he essa e i be
rulsb sfbe xvedur et osxqb gqavagbovr. Bqoro xvedur psll ho
s i in o rou s o ei h charac ers. hese rou s i be
pvsbbof sf vafnem evnov, hdb remo et bqom eiovlau.
 ri en in rando order bu so e o he o er a
Haryovqedfn psll ho wdsgylj apavo et afj makev uelsgo
Baskerhound i be uick y a are o any ajor o ice
euovabsef, re uloaro ho rdhblo. Lob remoefo yfep pqovo jed avo
o era ion so ease be sub e. e so eone kno here you are
xesfx sf garo jed nsrauuoav.
 oin in case you disa ear
This part of the message falls into place, and we can establish that the keys for the cipher are:
Initial ciphertext:
:$\begin {array} {c|c} \text {Plaintext} & \texttt A & \texttt B & \texttt C & \texttt D & \texttt E & \texttt F & \texttt G & \texttt H & \texttt I & \texttt J & \texttt K & \texttt L & \texttt M & \texttt N & \texttt O & \texttt P & \texttt Q & \texttt R & \texttt S & \texttt T & \texttt U & \texttt V & \texttt W & \texttt X & \texttt Y & \texttt Z \\ \hline \text {Ciphertext} & \texttt W & \texttt D & \texttt C & \texttt J & \texttt K & \texttt P & \texttt T & \texttt M & \texttt O & \texttt G & \texttt U & \texttt H & \texttt I & \texttt B & \texttt A & \texttt Q & \texttt S & \texttt R & \texttt N & \texttt X & \texttt Z & \texttt E & \texttt L & \texttt V & \texttt F & \texttt Y \end {array}$
First change:
:$\begin {array} {c|c} \text {Plaintext} & \texttt A & \texttt B & \texttt C & \texttt D & \texttt E & \texttt F & \texttt G & \texttt H & \texttt I & \texttt J & \texttt K & \texttt L & \texttt M & \texttt N & \texttt O & \texttt P & \texttt Q & \texttt R & \texttt S & \texttt T & \texttt U & \texttt V & \texttt W & \texttt X & \texttt Y & \texttt Z \\ \hline \text {Ciphertext} & \texttt X & \texttt E & \texttt D & \texttt K & \texttt L & \texttt Q & \texttt U & \texttt N & \texttt P & \texttt H & \texttt V & \texttt I & \texttt J & \texttt C & \texttt B & \texttt R & \texttt T & \texttt S & \texttt O & \texttt Y & \texttt A & \texttt F & \texttt M & \texttt W & \texttt G & \texttt Z \end {array}$
Second change:
:$\begin {array} {c|c} \text {Plaintext} & \texttt A & \texttt B & \texttt C & \texttt D & \texttt E & \texttt F & \texttt G & \texttt H & \texttt I & \texttt J & \texttt K & \texttt L & \texttt M & \texttt N & \texttt O & \texttt P & \texttt Q & \texttt R & \texttt S & \texttt T & \texttt U & \texttt V & \texttt W & \texttt X & \texttt Y & \texttt Z \\ \hline \text {Ciphertext} & \texttt Y & \texttt F & \texttt E & \texttt L & \texttt M & \texttt R & \texttt V & \texttt O & \texttt Q & \texttt I & \texttt W & \texttt J & \texttt K & \texttt D & \texttt C & \texttt S & \texttt U & \texttt T & \texttt P & \texttt Z & \texttt B & \texttt G & \texttt N & \texttt X & \texttt H & \texttt A \end {array}$
Third change:
:$\begin {array} {c|c} \text {Plaintext} & \texttt A & \texttt B & \texttt C & \texttt D & \texttt E & \texttt F & \texttt G & \texttt H & \texttt I & \texttt J & \texttt K & \texttt L & \texttt M & \texttt N & \texttt O & \texttt P & \texttt Q & \texttt R & \texttt S & \texttt T & \texttt U & \texttt V & \texttt W & \texttt X & \texttt Y & \texttt Z \\ \hline \text {Ciphertext} & \texttt Z & \texttt G & \texttt F & \texttt M & \texttt N & \texttt S & \texttt W & \texttt P & \texttt R & \texttt J & \texttt X & \texttt K & \texttt L & \texttt E & \texttt D & \texttt T & \texttt V & \texttt U & \texttt Q & \texttt A & \texttt C & \texttt H & \texttt O & \texttt Y & \texttt I & \texttt B \end {array}$
Fourth change:
:$\begin {array} {c|c} \text {Plaintext} & \texttt A & \texttt B & \texttt C & \texttt D & \texttt E & \texttt F & \texttt G & \texttt H & \texttt I & \texttt J & \texttt K & \texttt L & \texttt M & \texttt N & \texttt O & \texttt P & \texttt Q & \texttt R & \texttt S & \texttt T & \texttt U & \texttt V & \texttt W & \texttt X & \texttt Y & \texttt Z \\ \hline \text {Ciphertext} & \texttt A & \texttt H & \texttt G & \texttt N & \texttt O & \texttt T & \texttt X & \texttt Q & \texttt S & \texttt K & \texttt Y & \texttt L & \texttt M & \texttt F & \texttt E & \texttt U & \texttt W & \texttt V & \texttt R & \texttt B & \texttt D & \texttt I & \texttt P & \texttt Z & \texttt J & \texttt C \end {array}$
Hence for the fourth change, we have:
S psll feb
I will not
ho ahlo be dro bqsr geno axasf.
be able to use this code again.
Bqo ofgensfx et bqo morraxo S loaio fozb bsmo psll vebabo
The encoding of the message I leave next time will rotate
efgo oagq bsmo bqo morraxo gefbasfr bqo lobbov ... poll, jed psll
once each time the message contains the letter ... well, you will
tsxdvo sb edb. Bqo bsmo atbov bqab, bqo geno psll ho bqo ramo
figure it out. The time after that, the code will be the same
efo bqab bqsr lobbov hoxaf psbq, ozgoub bqab bqo morraxo psll ho
one that this letter began with, except that the message will be
rulsb sfbe xvedur et osxqb gqavagbovr. Bqoro xvedur psll ho
split into groups of eight characters. These groups will be
pvsbbof sf vafnem evnov, hdb remo et bqom eiovlau.
written in random order, but some of them overlap.
Haryovqedfn psll ho wdsgylj apavo et afj makev uelsgo
Baskerhound will be quickly aware of any major police
euovabsef, re uloaro ho rdhblo. Lob remoefo yfep pqovo jed avo
operation, so please be subtle. Let someone know where you are
xesfx sf garo jed nsrauuoav.
going in case you disappear.
It remains to establish where the cipher breaks are.
Just before the S psll of paragraph $6$, we have zwzre, which is the same as axasf but one letter displaced.
Hence zwzre is code for again, and we see that the $4$th cipher encoding ends here.
This takes us back at least to R orkk which is I will.
But all this is moot: all we need to do is apply the $5$ keys to the original text, starting with the first, and see what happens.
Fazr wxxkiqxn xa qocu zq if xrwoh mwek dkkb johotkbx,
Your attempts to pick up my trail have been diligent,
xmaztm wccarjobt xa if cwqxar, hwztmwdhf obcaiqkxkbx. Qhkwnk
though according to my captor, laughably incompetent. Please
jab'x xwuk appkbnk, par mk on wb obxahkrwdhk nbad.
don't take offense, for he is an intolerable snob.
Dkcwznk mk on znobt ik xa nahek iwbf joppoczhx qzyyhkn w
Because he is using me to solve many difficult puzzles a
jwf, mk toekn ik qroewcf wbj xoik xa xmobu. Xmk rknzhx on
day, he gives me privacy and time to think. The result is
xmwx O cwb lroxk xa faz wx if hkonzrk. O mwek if jazdxn xmwx
that I can write to you at my leisure. I have my doubts that
xmon hkxxkr lohh rkwcm faz, dzx O mwek w qhwb xa hkwek ox
this letter will reach you, but I have a plan to leave it
ob w trackr'n nxacu raai.
in a grocer's stock room.
Am, fkn, if cwqxar on Dkbgwiob Dwnukrmazbj, xmk iwxm
Oh, yes, my captor is Benjamin Baskerhound, the math
qrajotf lma dkcwik w qmohanaqmf qrapknnar wx Qrobckxab, bal
prodigy who became a philosophy professor at Princeton, now
xzrbkj uojbwqqkr. Mk iwf kbxkr axmkr cwrkkrn ekrf naab. Loxm
turned kidnapper. He may enter other careers very soon. With
xmk habt-lobjkj obxrajzcxoab azx ap xmk lwf, faz lohh pobj ox kwnf
the long-winded introduction out of the way, you will find it easy
xa jkcajk xmk rknx ob nqoxk ap xmk pwcx xmwx xmk cajk on
to decode the rest in spite of the fact that the code is
raxwxobt df abk hkxxkr rotmx bal.
rotating by one letter right now.
(After first shift)
Exovlsnback xck npo oyxqq xsl dbcypcaxiig bc ynl jbfl. Nl
Baskerhound and his staff are continually on the move. He
dbcysbio npo xqqxpso eg dliiaixs ylilrnbcl, aopcu rspfxyl oxyliipyl
controls his affairs by cellular telephone, using private satellite
dnxcclio. Nl qpcko slxkg mlidbjlo pc ixcko mnbol rlbril xkjpsl slelio.
channels. He finds ready welcomes in lands whose people admire rebels.
Ml xsl cbm pc Asauaxg, x ixck qpiilk mpyn lwpilk Exotalo mnb nxk
We are now in Uruguay, a land filled with exiled Basques who had
qbauny xuxpcoy Qsxcdb pc Orxpc. Elqbsl ynpo, ml mlsl pc Nbrp
fought against Franco in Spain. Before this, we were in Hopi
dbacysg mnlsl ynl ysxkpypbcxi oaorpdpbc ybmxsko bayopklso mxo
country where the traditional suspicion towards outsiders was
kporliilk mnlc Exovlsnback (xck P) nlirlk yb ibdxyl x upxcy xtapqls.
dispelled when Baskerhound (and I) helped to locate a giant aquifer.
Ynl dbkl po sbyxypcu xuxpc.
The code is rotating again.
(After second shift)
Nm pzyh qd y sjyem rct y lyh, y
We stay in a place for a day, a
nmmw, y kcdzo. Zomd nm ytm crr, bpbyjjh qd Fypwmtocbdl'p
week, a month. Then we are off, usually in Baskerhound's
JmytImzp.
LearJets.
Fypwmtocbdl qp pc ecdrqlmdz cr oqp yfqjqzh zc mgylm
Baskerhound is so confident of his ability to evade
lmzmezqcd zoyz om yjjcnp km zc sjyh zom zcbtqpz -- yeecksydqml fh
detection that he allows me to play the tourist -- accompanied by
kh "fclhvbytlp," cr ecbtpm. Zom eclm qp tczyzqdv.
my "bodyguards," of course. The code is rotating.
(After third shift)
Kddx sdu ln re Cucwczi. R orkk aui ad srwcun dca dcu enya
Look for me in Uruguay. I will try to figure out our next
mnqarezarde zem orkk knzhn odum orap z fpnnusck zem caanuki
destination and will leave word with a cheerful and utterly
ezrhn pduqn-gunnmnu de z mrua udzm enzu z hrkkzwn fzkknm
naive horse-breeder on a dirt road near a village called
Tceaz Gzkknez. Zqx sdu apn truzan'q pdcqn zem idc ode'a gn szu
Punta Ballena. Ask for the pirate's house and you won't be far
zozi. Opne idc srem apn pduqn-gunnmnu, zqx prl opnapnu pn rq
away. When you find the horse-breeder, ask him whether he is
uzfrew zei kzln pduqnq aprq inzu. Fdmn fpzewnq zwzre.
racing any lame horses this year. Code changes again.
(After fourth shift)
S psll feb
I will not
ho ahlo be dro bqsr geno axasf.
be able to use this code again.
Bqo ofgensfx et bqo morraxo S loaio fozb bsmo psll vebabo
The encoding of the message I leave next time will rotate
efgo oagq bsmo bqo morraxo gefbasfr bqo lobbov ... poll, jed psll
once each time the message contains the letter ... well, you will
tsxdvo sb edb. Bqo bsmo atbov bqab, bqo geno psll ho bqo ramo
figure it out. The time after that, the code will be the same
efo bqab bqsr lobbov hoxaf psbq, ozgoub bqab bqo morraxo psll ho
one that this letter began with, except that the message will be
rulsb sfbe xvedur et osxqb gqavagbovr. Bqoro xvedur psll ho
split into groups of eight characters. These groups will be
pvsbbof sf vafnem evnov, hdb remo et bqom eiovlau.
written in random order, but some of them overlap.
Haryovqedfn psll ho wdsgylj apavo et afj makev uelsgo
Baskerhound will be quickly aware of any major police
euovabsef, re uloaro ho rdhblo. Lob remoefo yfep pqovo jed avo
operation, so please be subtle. Let someone know where you are
xesfx sf garo jed nsrauuoav.
going in case you disappear.
 Jedvr,
 Yours,
 Kageh
 Jacob
== Sources ==
* : The Coded Letter: $1$. The Letter
Category:Cryptography