INDEPENDENT RESEARCH ARCHIVEPreserve the source. Keep the context.
A Dream Within a Dream · Poe in translation
← Signals & codes

A cipher study edition

English ↔ Playfair

A Dream Within a Dream · enciphered in pairs, keyed on its own title

Edition: complete · every line in the Playfair cipher, key DREAM WITHIN A DREAM · unreviewed project draft

The Playfair cipher swaps letters two at a time using a five-by-five square built from a key phrase. Charles Wheatstone invented it in 1854; his friend Lyon Playfair promoted it, and the name stuck. British forces used it in the field from the Boer War to the Second World War. Here each line of the poem is enciphered on a square keyed with the poem’s own title.

Encipher it

RE AM EZ

Key: DREAM WITHIN A DREAM. J is written as I; a doubled letter or a lone last letter takes a null X.

254letter pairs to encipher
139pairs swapped across a rectangle
115pairs sharing a row or column
1854Wheatstone describes the cipher

Part one / The poem

The poem, line by line

Every line of Poe's poem enciphered separately in Playfair, shown in pairs. Spaces and punctuation are dropped before enciphering, as the cipher requires. Select a line number for its study note.

LineEnglish · sourcePlayfair · key DREAM WITHIN A DREAM
Take this kiss upon the brow! HE FM HN NO CN PZ LZ QP WH TA CD LI
And, in parting from you now, MH RW TS ME HT HK CE SR VQ ZW LI
Thus much let me avow — HN ZL DZ GI PD NE AM RV TU
You are not wrong, who deem VQ YD EA IS HI IV HK IN LR TE AD
That my days have been a dream; HN EH AZ RM ZQ GH XR FD MT MR EA MD
Yet if hope has flown away XA HT GT PQ AT MQ BP LI HM HD ZY
In a night, or in a day, TW MH HC NH VI TW MR HA
In a vision, or in none, TW RY NO CV IS IC TZ IS TM
Is it therefore the less gone? NO TH HN AE TP VI TF TA PD PZ QK SI TE
All that we see or seem DQ PW GH HI MP TE RP MO TE AD
Is but a dream within a dream. NO LD HE RE AM DN TH NT HM RE AM EZ
I stand amid the roar NO HE WM MD WR HN AE QR EV
Of a surf-tormented shore, PC MQ VD PF VI DA WH AR QN VI TE
And I hold within my hand MH RW IQ UW IT HN TW AZ GH WM
Grains of the golden sand — CA RH KZ PC HN AF PO RA KZ MH EU
How few! yet how they creep IQ TB DT XA HN LI HN AX OI TE TX
Through my fingers to the deep, HN IV YB NA XG TW FA MO IP HN AR TE TX
While I weep — while I weep! IN WO RT TD TX IN WO RT TD TX
O God! Can I not grasp QC LR GR WT IS HF EM LQ
Them with a tighter clasp? HN AD IT HN EH HC NH AE BO MQ XE
O God! can I not save QC LR GR WT IS NP RY TE
One from the pitiless wave? SI TP IV EN TA OT HT PD PZ LN RY TE
Is all that we see or seem NO DQ PW GH HI MP TE RP MO TE AD
But a dream within a dream? LD HE RE AM DN TH NT HM RE AM EZ

Part two / How it works

One square, four rules

The key square for this edition. The key phrase DREAM WITHIN A DREAM fills the top rows with its letters, each used once (in bold); the rest of the alphabet follows in order, with I and J sharing a cell.

DREAM
WITHN
BCFGK
LOPQS
UVXYZ

1 · Pairs

Write the message without spaces and cut it into pairs. If a pair would be two of the same letter, put an X between them; if a letter is left over at the end, add an X.

DR EA MX

2 · Same row

If both letters are in one row, take the letter to the right of each, wrapping round from the end of the row to the start.

DR → RE (row)

3 · Same column

If both are in one column, take the letter below each, wrapping from the bottom to the top.

DW → WB (col)

4 · Rectangle

Otherwise the two letters are corners of a rectangle. Take the other two corners, each on the same row as the letter it replaces.

OK → SC (rect)

To decipher, reverse the row and column rules (left and up instead of right and down); the rectangle rule is its own reverse. Then drop the nulls. The method follows the worked example in the Wikipedia article, which this page’s code reproduces exactly: “hide the gold in the tree stump” with the key PLAYFAIR EXAMPLE gives BM OD ZB XD NA BE KU DM UI XM MO UV IF.

Practice

Break the pairs

A word from the poem is shown enciphered on its own. Pick the English word.

0 of 0 correct

Practice with every word

Every word of the poem

All 85 different words of the poem, in the order they first appear. Decipher each pair with the square, then reveal the English.

Playfair → English

How to practise

  1. Find both letters of a pair in the square.
  2. Same row: step left. Same column: step up. Otherwise: swap the rectangle corners.
  3. Drop any null X, then reveal.
  4. Encipher a word for a friend and give them the key.
See the full word list (85 words)
takeHE FMline 1 · 1×
thisHN NOline 1 · 1×
kissCN PZ PZline 1 · 1×
uponXL SIline 1 · 1×
theHN TEline 1 · 6×
browCD LIline 1 · 1×
andMH EUline 2 · 2×
inTWline 2 · 5×
partingQE EI TW FYline 2 · 1×
fromCE SRline 2 · 2×
youVQ VYline 2 · 2×
nowIS TUline 2 · 1×
thusHN ZLline 3 · 1×
muchDZ GIline 3 · 1×
letPD FEline 3 · 1×
meDAline 3 · 1×
avowRY LIline 3 · 1×
areME TEline 4 · 1×
notIS FEline 4 · 3×
wrongID SI FYline 4 · 1×
whoIN PVline 4 · 1×
deemRA ADline 4 · 1×
thatHN EHline 5 · 3×
myAZline 5 · 3×
daysRM ZQline 5 · 1×
haveGH XRline 5 · 1×
beenFD MTline 5 · 1×
aEYline 5 · 10×
dreamRE AM EZline 5 · 5×
yetXA FEline 6 · 2×
ifTCline 6 · 1×
hopeIQ XTline 6 · 1×
hasGH PZline 6 · 1×
flownBP LI TZline 6 · 1×
awayDH HAline 6 · 1×
nightWT QG FEline 7 · 1×
orVIline 7 · 4×
dayRM ZYline 7 · 1×
visionRC ON SIline 8 · 1×
noneIS TMline 8 · 1×
isNOline 9 · 3×
itTHline 9 · 1×
thereforeHN AE TP VI TEline 9 · 1×
lessPD PZ PZline 9 · 1×
goneCQ TMline 9 · 1×
allDQ PUline 10 · 2×
weTDline 10 · 2×
seePM TEline 10 · 2×
seemPM ADline 10 · 2×
butLD FEline 11 · 2×
withinIT HN TWline 11 · 3×
ITVline 12 · 6×
standPN MH EUline 12 · 1×
amidMD WRline 12 · 1×
roarIV MEline 12 · 1×
ofPCline 13 · 2×
surf-tormentedLZ EC IP ED MT FT EUline 13 · 1×
shoreQN VI TEline 13 · 1×
holdIQ UWline 14 · 1×
handGH WMline 14 · 1×
grainsCA RH KZline 15 · 1×
goldenCQ UW MTline 15 · 1×
sandQM WMline 15 · 1×
howIQ TUline 16 · 2×
fewPT TUline 16 · 1×
theyHN AXline 16 · 1×
creepOI TE TXline 16 · 1×
throughHN IV YB TYline 17 · 1×
fingersCT HK AE PZline 17 · 1×
toIPline 17 · 1×
deepRA TXline 17 · 1×
whileIN WO TEline 18 · 2×
weepTD TXline 18 · 2×
OPVline 19 · 2×
GodCQ EUline 19 · 2×
canGR TZline 19 · 2×
graspCA MQ XEline 19 · 1×
themHN ADline 20 · 1×
withIT HNline 20 · 1×
tighterHT QG FT EVline 20 · 1×
claspBO MQ XEline 20 · 1×
saveQM XRline 21 · 1×
oneSI TEline 22 · 1×
pitilessOT HT PD PZ PZline 22 · 1×
waveHD XRline 22 · 1×

Background

Wheatstone’s cipher, Playfair’s name

Too hard for attachés

Wheatstone built the cipher for secret telegraphy. The Foreign Office turned it down as too complicated. Wheatstone offered to show that three boys in four at a nearby school could learn it in fifteen minutes; the Under Secretary replied that he could never teach it to attachés.

In the field

British forces used Playfair for tactical messages in the Second Boer War and the First World War, and British and Australian forces in the Second. New Zealand used it to talk to the Chatham Islands and the coastwatchers in the Pacific.

Broken in print

It never pairs a letter with itself, and a pair and its reverse, AB and BA, come from mirrored plain pairs, which gives it away. Joseph Mauborgne published a solution in 1914. Dorothy L. Sayers has her detective crack one step by step in the 1932 novel Have His Carcase.

Sources

Pages consulted

  • David Kahn, The Codebreakers, Scribner, 1996
  • Thomas Wemyss Reid, Memoirs and Correspondence of Lyon Playfair, Harper & Brothers, 1899
  • Helen Fouché Gaines, Cryptanalysis, Dover, 1956
  • Playfair cipher, Wikipedia (method and worked example)

Keep exploring

Related editions

Other editions of “A Dream Within a Dream” close to Playfair cipher, chosen from the project’s 158 editions.

Closely linked editions

Ciphers and secret writing

More signals and codes