Patterson's Cipher for Jefferson
Patterson told Jefferson it would be "absolutely impossible … ever to desypher" without the key, and put a specimen in the letter to prove it. No record shows anyone reading that specimen for 206 years.
Why This Matters
In December 1801, Robert Patterson — a respected American mathematician and vice provost of the University of Pennsylvania — sent President Thomas Jefferson a cipher he believed could never be broken. Jefferson, a sophisticated cryptographer in his own right (designer of the wheel cipher in Hall VII), was so impressed that he forwarded the system to Robert Livingston, the US minister to France, with an endorsement calling it "the most perfect cipher he had ever seen."
Patterson closed the letter with a specimen in his own cipher, and a boast: "It will be absolutely impossible, even for one perfectly acquainted with the general system, ever to desypher the writing of another without his key." He put the number of possible keys at more than "ninety millions of millions".
There is no evidence Jefferson ever read it. Smithline, who solved it, puts it carefully: Jefferson "probably never cracked the enciphered portion of the letter", and no record indicates that anyone else had either. In June 2007 Lawren Smithline, a mathematician at the Center for Communications Research in Princeton, heard about the cipher letters from his neighbour Amy Speckart, who was working at The Papers of Thomas Jefferson; she pointed him at the Library of Congress scan. He solved it with dynamic programming over digraph frequencies. The message opens "In Congress July Fourth" and continues into the preamble to the Declaration of Independence — the document Jefferson himself had drafted.
Robert Patterson was professor of mathematics at the University of Pennsylvania. He and Jefferson corresponded often, and on a range of subjects including cryptography: at the time Jefferson was president of the American Philosophical Society and Patterson its vice president. Patterson's letter of 19 December 1801 is preserved in the Library of Congress's Jefferson Papers.
Jefferson received the proposal at exactly the right moment to be receptive: he was newly inaugurated, building out the State Department's diplomatic correspondence apparatus, and acutely aware of the European cabinets noirs (see Cabinet Noir) reading every American dispatch they could intercept. A genuinely unbreakable cipher would have been a strategic asset.
Jefferson was taken enough with the method to pass it on: he forwarded it to Robert Livingston, the American minister to France. Livingston went on using a nomenclator anyway. The system did not displace existing practice, and the specimen stayed unread. Beyond that the record is thin, and this page stops where the record does: there is no evidence that Jefferson worked the specimen and failed, and none that anyone else at his side attempted it.
Patterson set out four requirements for a "perfect cypher": it should suit any language, be easy to memorise, be simple to perform, and be "absolutely inscrutable to all unacquainted with the particular key". His construction has three steps, and only three.
Step 1 — Write the message down the lines
In Patterson's words, "the first letter of the message is placed at the beginning of the first line, the second letter at the beginning of the second line, and so on, writing column after column, from left to right, till the whole is written." The text runs downward through the lines, column by column — Smithline likens the layout to writing in columns.
Step 2 — Cut into sections of at most nine lines
"This writing is then to be distributed into sections of not more than nine lines in each section, and these are to be numbered 1. 2. 3 &c." Nine is Patterson's own ceiling, and it is the single most important number on this page — a section is small, not large.
Step 3 — Transcribe the lines in a secret order, each behind arbitrary letters
Each section is written out "taking the lines of each section in any order at pleasure, inserting at the beginning of each line respectively any number of arbitrary or insignificant letters, not exceeding nine; & also filling up the vacant spaces at the end of the lines with like letters."
The same shuffle and the same counts are reused in every section — that repetition is what eventually gives the cipher away.
The key, again in Patterson's words, "will consist in knowing — the number of lines in each section, the order in which these are transcribed, and the number of insignificant letters at the beginning of each line." Written down it is a column of two-digit numbers: the first digit of each pair names a line, the sequence of those first digits gives the shuffle, and the second digit says how many arbitrary letters that line carries.
Patterson reckoned the number of available keys at more than "ninety millions of millions" — about 9 × 1013. That is a real number, and for 1801 an intimidating one, but it is not the astronomical figure a large grid would give you: the nine-line ceiling is what keeps it that size.
13, 34, 57, 65, 22, 78, 49.Smithline's attack does not guess whole keys, and it is not a hill climb. It scores how plausibly two deciphered lines sit next to each other, and builds the key up one line at a time.
The scoring is on digraphs — adjacent letter pairs. Reading down a column of the reconstructed grid produces pairs of letters; some pairs are common in English, some are unlikely, some cannot occur. Smithline calibrated on a corpus close to the target: the letter frequencies of Jefferson's own State of the Union addresses. Each candidate alignment scores:
| Digraph class | Example | Score |
|---|---|---|
| Favourable | common English pairs | +1 |
| Unfavourable | od, et — rarer than chance | −1 |
| Nonexistent | wd, vz — absent from the corpus | −5 |
Because the number of arbitrary letters differs from line to line, lines do not start flush; letters that overhang with no partner score 0. Smithline guessed the section size and a starting pair of rows — anchoring on a q in cipher row 22, which in English is followed by u — and let dynamic programming compute the best number of extra letters for each candidate.
Adding one row at a time, the key emerged: 13, 34, 57, 65, 22, 78, 49 — seven lines to a section. Smithline notes the kinship with biological sequence alignment: lining up cipher rows is the same shape of problem as the Smith–Waterman algorithm of 1981. Transcription errors in Patterson's handwriting did not stop it; the method found the right key anyway, and the mistakes could be corrected once the text could be read.
| Patterson lesson | Modern echo |
|---|---|
| Cipher strength is relative to attacker capability | Quantum cryptography deprecation: today's "strong" ciphers may fall to algorithms that don't yet exist |
| Asymmetric effort: encrypt in hours, decrypt in centuries | The standard threat model — attacker may have far more compute than designer expected |
| "Perfect cipher" claims age badly | Why every modern algorithm is published for adversarial review, not declared perfect |
| A good scoring function over local structure beats searching whole keys | Same technique: hill-climbing in modern cryptanalysis; broke Double Transposition in 2013, the M-209 in the 2010s, the Mary Stuart letters in 2022 |
| The patriotic-plaintext signal helped Smithline confirm the break | Modern: known-plaintext attacks; chosen-plaintext attacks; the cryptanalyst always wants any anchor in the plaintext space |
| Designer | Robert Patterson (1743–1824) |
| Year | December 1801 |
| Recipient | Thomas Jefferson |
| Steps | Write down the lines → sections of ≤9 → shuffle lines, prefix ≤9 arbitrary letters (3) |
| Section size | Not more than nine lines (Patterson's own limit) |
| Keyspace | Patterson's estimate: "ninety millions of millions" (~9×10¹³) |
| Years unread | 206 (1801 → 2007) |
| Solver | Lawren Smithline, Center for Communications Research, Princeton |
| Method | Digraph scoring (+1 / −1 / −5) + dynamic programming |
| Recovered key | 13, 34, 57, 65, 22, 78, 49 |
| Plaintext | "In Congress July Fourth" + preamble to the Declaration |
| Solution paper | American Scientist 97(2), 2009, 142–149 |
- Smithline, Lawren M. A Cipher to Thomas Jefferson. American Scientist 97(2), 2009, 142–149. ↗
- Thomas Jefferson to Robert Patterson, 22 March 1802 — Founders Online. ↗
- Thomas Jefferson, 12 April 1802, Patterson's Cipher — Library of Congress. ↗
- Tomokiyo, Satoshi. Patterson's Cipher for Jefferson — Challenge Solved After 200 Years. Cryptiana. ↗
- Library of Congress — Thomas Jefferson Papers (Patterson correspondence). ↗
- Wikipedia — Robert Patterson (educator). ↗
Every quotation of Patterson on this page is taken from his letter as reproduced in Smithline (2009); the Jefferson quotation is from Founders Online. Claims that previously appeared here and are not in these sources — that Jefferson attempted the specimen and failed, that Madison tried it, and a pair of quoted letters to that effect — have been removed as unsourced.