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
Key: DREAM WITHIN A DREAM. J is written as I; a doubled letter or a lone last letter takes a null X.
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.
| Line | English · source | Playfair · 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.
| D | R | E | A | M |
| W | I | T | H | N |
| B | C | F | G | K |
| L | O | P | Q | S |
| U | V | X | Y | Z |
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.
How to practise
- Find both letters of a pair in the square.
- Same row: step left. Same column: step up. Otherwise: swap the rectangle corners.
- Drop any null X, then reveal.
- Encipher a word for a friend and give them the key.
See the full word list (85 words)
| take | HE FM | line 1 · 1× |
| this | HN NO | line 1 · 1× |
| kiss | CN PZ PZ | line 1 · 1× |
| upon | XL SI | line 1 · 1× |
| the | HN TE | line 1 · 6× |
| brow | CD LI | line 1 · 1× |
| and | MH EU | line 2 · 2× |
| in | TW | line 2 · 5× |
| parting | QE EI TW FY | line 2 · 1× |
| from | CE SR | line 2 · 2× |
| you | VQ VY | line 2 · 2× |
| now | IS TU | line 2 · 1× |
| thus | HN ZL | line 3 · 1× |
| much | DZ GI | line 3 · 1× |
| let | PD FE | line 3 · 1× |
| me | DA | line 3 · 1× |
| avow | RY LI | line 3 · 1× |
| are | ME TE | line 4 · 1× |
| not | IS FE | line 4 · 3× |
| wrong | ID SI FY | line 4 · 1× |
| who | IN PV | line 4 · 1× |
| deem | RA AD | line 4 · 1× |
| that | HN EH | line 5 · 3× |
| my | AZ | line 5 · 3× |
| days | RM ZQ | line 5 · 1× |
| have | GH XR | line 5 · 1× |
| been | FD MT | line 5 · 1× |
| a | EY | line 5 · 10× |
| dream | RE AM EZ | line 5 · 5× |
| yet | XA FE | line 6 · 2× |
| if | TC | line 6 · 1× |
| hope | IQ XT | line 6 · 1× |
| has | GH PZ | line 6 · 1× |
| flown | BP LI TZ | line 6 · 1× |
| away | DH HA | line 6 · 1× |
| night | WT QG FE | line 7 · 1× |
| or | VI | line 7 · 4× |
| day | RM ZY | line 7 · 1× |
| vision | RC ON SI | line 8 · 1× |
| none | IS TM | line 8 · 1× |
| is | NO | line 9 · 3× |
| it | TH | line 9 · 1× |
| therefore | HN AE TP VI TE | line 9 · 1× |
| less | PD PZ PZ | line 9 · 1× |
| gone | CQ TM | line 9 · 1× |
| all | DQ PU | line 10 · 2× |
| we | TD | line 10 · 2× |
| see | PM TE | line 10 · 2× |
| seem | PM AD | line 10 · 2× |
| but | LD FE | line 11 · 2× |
| within | IT HN TW | line 11 · 3× |
| I | TV | line 12 · 6× |
| stand | PN MH EU | line 12 · 1× |
| amid | MD WR | line 12 · 1× |
| roar | IV ME | line 12 · 1× |
| of | PC | line 13 · 2× |
| surf-tormented | LZ EC IP ED MT FT EU | line 13 · 1× |
| shore | QN VI TE | line 13 · 1× |
| hold | IQ UW | line 14 · 1× |
| hand | GH WM | line 14 · 1× |
| grains | CA RH KZ | line 15 · 1× |
| golden | CQ UW MT | line 15 · 1× |
| sand | QM WM | line 15 · 1× |
| how | IQ TU | line 16 · 2× |
| few | PT TU | line 16 · 1× |
| they | HN AX | line 16 · 1× |
| creep | OI TE TX | line 16 · 1× |
| through | HN IV YB TY | line 17 · 1× |
| fingers | CT HK AE PZ | line 17 · 1× |
| to | IP | line 17 · 1× |
| deep | RA TX | line 17 · 1× |
| while | IN WO TE | line 18 · 2× |
| weep | TD TX | line 18 · 2× |
| O | PV | line 19 · 2× |
| God | CQ EU | line 19 · 2× |
| can | GR TZ | line 19 · 2× |
| grasp | CA MQ XE | line 19 · 1× |
| them | HN AD | line 20 · 1× |
| with | IT HN | line 20 · 1× |
| tighter | HT QG FT EV | line 20 · 1× |
| clasp | BO MQ XE | line 20 · 1× |
| save | QM XR | line 21 · 1× |
| one | SI TE | line 22 · 1× |
| pitiless | OT HT PD PZ PZ | line 22 · 1× |
| wave | HD XR | line 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
- Gold-Bug cipher Poe's own key
- Navajo code Code talkers
- Tap code Knocks through a wall
Ciphers and secret writing
- Back slang Victorian cant
- Bacon's cipher Biliteral
- Dead letter drop Spy tradecraft
- Pigpen cipher Masonic cipher
More signals and codes
- Baudot code ITA2
- Flag semaphore Hand flags
- Hieroglyphs Egyptian signs
- Lantern signals Light
