491. 868. 934. 1154. 691. 111. 926. 1411. 471. 1340. 1495
der ni er res or t he will make an alliance
1651 = the · 133 = of · 244 = to · 940 = England · 1661 = Prince

Madrid → Washington · numerical word-and-syllable code (Pinckney’s “Cypher of the Legation”) · 10 August 1807 · key from external plaintext

George W. Erving to James Madison, Madrid, 10 August 1807

James Madison
toJames Madison

A coded private letter on Godoy, Hanover and Portugal: its code groups were matched against the decoded text in Founders Online, which rebuilt the legation code, and 98% of the groups now give sense.

Daniel Bourdeau · posted

Method: key recovered based on plaintext from external sources · Extent: complete

Contributed by Feyseel Nur (solution) · Also credited · Contemporary key or decipherment (verification) · Founders Online (The Papers of James Madison) (key or decipherment used)

At a glanceKey from external plaintext · 1,125 of 1,145 code groups give sense

The letter
George W. Erving, American chargé d’affaires at Madrid, to Secretary of State James Madison, 10 August 1807, with a postscript of the 11th: private letter No. 24, the duplicate, headed “In Mr Pinkneys Cypher, the Cypher of ye Legation”.
Where
National Archives, RG 59, Diplomatic Despatches, Spain, vol. 10, on microfilm M31 reel 12, frames 0362–0367 (catalog NAID 188605361). Founders Online prints the letter decoded, without the code groups (early access 99-01-02-1993). Not in the catalogue and not on DECODE.
The cipher
The legation code Charles Pinckney used at Madrid: numbers up to about 1,700 for words, syllables and letters, partly in alphabetical runs, written between dots inside the clear text. A caret over a group makes it plural.
How it was deciphered
The 1,145 groups were transcribed from the film and lined up with the Founders text, which gave 414 rows of the code. Of the 47 groups it shares with Jacob Wagner’s 1803 decode of Pinckney’s own despatch, 45 agree and two stay undecided.
What it says
Godoy paid for the Hanover bargain out of his own funds, sees Hanover handed to Westphalia, “believes that he has been deceived and is furious”, and plans, “as a dernier resort”, an alliance with England.
Still open
Eight groups that occur only once (633; 632, 455, 1482; 767, 679, 378; one lost in the binding) and 916 in the postscript. Counting conservatively, with hidden digits and emendations also set aside, 94.25% of the groups stand.
Credit
Feyseel Nur, with Claude Opus 5.5 subagents (transcription, key rebuild, decode); key check against Wagner’s 1803 decode; adversarial review by OpenAI Codex. Contributed in PR #21.

01 The letter and its two texts

Erving was the American chargé d’affaires at Madrid, and the code he used was the legation’s, from the time of Charles Pinckney, minister there before him. His private letters to Madison were numbered; No. 21 of 24 March 1807, “in the Cypher of the Legation”, is printed from Madison’s own decode and is written up with the 1812 Adams despatch on the legation-codes page. No. 24, of 10 August 1807, opens on the news that the peace (of Tilsit) was signed and asks what it will change between France and Spain. Much of its first six pages is in code.

The head of a handwritten letter: To James Madison, In Mr Pinkneys Cypher the Cypher of ye Legation, No 24, Duplicate, Madrid Augt 10th 1807, and the first lines with dotted code numbers
Frame 0362, the first page of the duplicate: “In Mr Pinkneys Cypher, the Cypher of ye Legation”, “No 24”, “Duplicate”. The first code groups follow “The alterations which this Event may produce”: 69. 1651. 32. 424^. 500. 1290. 1343. 1210, IN THE RELAT-IONS BETWEEN FRANCE AND SPAIN. A line further on, the film has “you probably will not annex”. Image: National Archives and Records Administration, RG 59, Despatches from US Ministers to Spain, vol. 10, microfilm M31 reel 12, frame 0362 (right page), via catalog.archives.gov NAID 188605361.

Two texts of it are at hand:

The two agree in the slip “my unofficial letter of March 4th” (the image has “March 4”; the letter meant is that of 24 March), and differ in small ways: Founders heads the letter “In the ⟨Cypher⟩ of the Legation” and prints “you will not probably annex” where the film has “you probably will not annex”. Several Founders brackets fall where the film loses digits in the binding (⟨ ⟩ has been informed, deceive him ⟨ ⟩, ⟨Prince⟩, ⟨a⟩gents). Whether the editors decoded this duplicate or took their text from another copy is not settled here; nothing below depends on it.

02 Pinckney’s code

The code is a single list of numbered words, syllables and letters. Groups are written with dots between them inside the clear sentences, and a word may take several groups: 724. 549. 934 is Ha-nov-er, 1552. 66 establish-ing, 1684. 110. 1432. 368. 624 Ca-ta-lo-ni-a. The commonest are 1651 the, 133 of, 244 to, 1484 is, 1343 and and 926 he. A small triangle or caret over a group marks a plural: 424^ ions, 1593^ tions, 580^ ports.

Parts of the list run in alphabetical order, which helps place a group seen once:

GroupsValues
742–745at, ate, ated, ation
870–880their, them, then, … there, therefore, these, they, thin, thing
884, 887this, tho’
1340, 1341, 1343an, ance, and

Higher up the order breaks (1661 Prince, 1680 can, 1686 by, 1688 but), so the code is only partly alphabetical. Erving made slips of his own: 66 (ing) for in three times, 665 for 605 in change, 870 their for they, and in Hanover he wrote 724. 549. 943 twice and 724. 549. 934 once, while 943 is ly in un-friend-ly. In March he had written Hanover 724. 529. 934.

The rebuilt list (key_pinckney.tsv) has 414 rows: the 395 numbers that occur in this letter and 19 more from Wagner’s page, each with where it is attested.

03 The decoded text: Hanover, Portugal and Godoy’s counter-project

Decoded groups in capitals, Erving’s clear words in lower case; [?] a group with no value, {…} a conjecture

The letter is about Manuel Godoy, the Prince of Peace, and what the peace of Tilsit meant for him. First the Hanover bargain of the spring, which Erving had reported in March:

I did not then know what I now learn that a considerable SUM OF MONEY WAS PAID BY THE PRINCE (OUT OF HIS OWN FUNDS) OVER AND ABOVE the STIPULATION FOR TROOPS. THE TROOPS MARCHED and we read of THEIR ARRIVAL ON THE ODER. … but THE war concluded it is found more convenient TO ADD HANOVER to the KINGDOM OF WESTPHALIA and the PRINCE IS TOLD that HE shall HAVE A TERRITORY somewhere ELSE. It may be the intention OF THE EMPEROR TO GIVE HIM one, but THE PRINCE does NOT THINK so; he believes that he has been DECEIVED AND is FURIOUS. Already a project is formed OF ESTABLISHING A KINGDOM OF EBRO including CATALONIA NAVARRE AND BISCAY and the plan OF INVADING PORTUGAL which during the war SERVED only AS A MEANS OF PROCURING MONEY from time to time IS NOW seriously RENEWED with a view to ACTUAL CONQUEST …

Portugal has been told to close its ports to the English. Godoy is still flattered with EXPECTATIONS of personal aggrandisement, but now begins to see that he will not be forgiven for his [?] intrigues, and “HIS actual determination IS TO RESIST”. Then the counter-project, on the third page:

Five handwritten lines of dotted code numbers with a few clear words: mediation, fails, as a, of some sort, This is a
Frame 0363, right page: “… 1290. 1544. 251. 244. 940 … mediation. 157. 926 fails there 892. as a 491. 868. 934. 1154. 691. 111. 926. 1411. 471. 1340. 1495 of some sort 1407. 940! This is a …”, that is: France HOSTILE TO ENGLAND … IF HE fails there THEN as a DERNIER RESORT HE WILL MAKE AN ALLIANCE of some sort WITH ENGLAND! The left edge of the page is lost in the binding. Image: National Archives and Records Administration, RG 59, Despatches from US Ministers to Spain, vol. 10, microfilm M31 reel 12, frame 0363 (right page), via catalog.archives.gov NAID 188605361.
IN THE mean TIME he has formed a COUNTER PROJECT. The first part OF HIS PLAN IS BY representing the vast [?] [?] [?] SPAIN BY THE WAR TO obtain the permission OF FRANCE TO MAKE A SEPARATE PEACE WITH ENGLAND AND NOT suspecting doubtless that RUSSIA HAS HERSELF any understanding WITH FRANCE HOSTILE TO ENGLAND HE HOPES TO obtain THIS POINT THRO’ HER mediation. IF HE fails there THEN as a DERNIER RESORT HE WILL MAKE AN ALLIANCE of some sort WITH ENGLAND! This is a COURSE OF SO DESPERATE a CHARACTER that it is scarcely to be BELIEVED IN.

Erving has this “from the very [best?] AUTHORITY (not from HIMSELF)”. Godoy regrets sending his troops to Hanover, has no expectation of seeing them again, and wishes he might “QUIETLY RETIRE FROM HIS STATION”. The fourth and fifth pages are a portrait of the French ambassador, François de Beauharnais:

A NARROW LOW INTRIGUING POLITICIAN, AFFECTING CANDOR, [?] perfectly false, assuming TO CONTROUL EVEN OPINION BY THE SUPERIORITY OF HIS TALENTS, THO’ certainly destitute of any particular advantage IN THAT RESPECT; full OF HIMSELF, consummately VAIN AND OSTENTATIOUS, AND IN HIS CONDUCT TO THE PRINCE inSOLENT AND overBEARING. THIS ILL suits with THE PRINCE WHO HIMSELF HAS VANITY Enough to think that HE IS is the greatest MAN IN EUROPE EXCEPT BUONAPARTE …

The sixth page ends on the thought that France may drive “THE ROYAL family OF SPAIN AS WELL AS OF PORTUGAL TO ESTABLISH THEIR EMPIRES ON THE OTHER SIDE OF THE ATLANTIC”. The rest of the letter is in clear. The postscript of the 11th goes back into code: Spain is to send an army into Portugal and French troops will take its place; the Emperor has written to the King, advising him to take the Prince of Asturias into his confidence; and Godoy, talking to the Prussian chargé d’affaires, says that “IF THE KING HAD NO successOR HE THE PRINCE WOULD risque EVERY THING TO KEEP BUONAPARTE OUT OF THE COUNTRY”, but that, unpopular and blamed for every distress of the country, he has “NO course … BUT IMPLICITLY TO SUBMIT to all THAT MAY BE DEMANDED”. Eleven weeks later the treaty of Fontainebleau (27 October 1807) divided Portugal and promised Godoy a principality in the south of it.

04 The code against the Founders text

Founders leaves ten blanks in the coded passages. The code fills six of them with values that recur elsewhere in the letter outside the gaps. Grades follow the adversarial review (codex_review/gaps.md):

FoundersGroupsThe codeGrade
⟨ ⟩ has been informed[15]78. 1010. 284THAT GOVERNMENT (Portugal’s); the first digits of 1578 are in the bindingsolid
flattered with ⟨ ⟩ of personal176. 979. 1593^EXPECTATIONS; 979 and 1593 occur only hereplausible
given for ⟨ ⟩408. 633. 69. 191. 728^for-GIVEN for HIS [?] INTRIGUES; 633 has no value (past is a guess)speculative
deceive him ⟨ ⟩ (to do him[1]343ANDsolid
not destitute of ⟨ ⟩632. 849. 1147. 455. 1482?-r-i-?-?; pride is a guessopen
France ⟨ ⟩ to England1544. 251HOSTILE, the same pair as in “in fact hostile or unfriendly”solid
as a dernier ⟨ ⟩1154. 691. 111RESORT (1154 as in res-is-t)solid
his troops ⟨ ⟩ has no expectation244. 724. 549. 934. 1343TO HANOVER ANDsolid
expectation of ⟨ ⟩ seeing133nothing is missing: of, then seeing in clearno gap
tranquillize ⟨ ⟩ the alarm ⟨or⟩877. 1497. 13[?]THESE AL[ARMS], TO CONCEAL; the group after al is half hiddensolid for THESE

Words Founders supplies in brackets are confirmed by the code: ⟨must⟩ (1250. 1203), ⟨see⟩ (with NOW before begins, 429), ⟨character⟩ (603), ⟨Prince⟩ (1661); “the troops to ⟨be⟩ employed” is THE TROOPS SO employed (1219), and “Embassador here ⟨are⟩” has IS (1484). In three places the code says something else:

05 How the key was rebuilt and checked

The groups were transcribed from the six frames and set against the Founders text phrase by phrase, so that each group took the value Founders gives at that place; a value fixed in one place was then carried to every other occurrence and tested there. This is a key recovered from a plaintext found elsewhere: most values rest on the edition, and the work cannot be a blind test of them. Two checks stand outside it.

Wagner’s 1803 decode. Pinckney’s own despatch of 22 February 1803 (M31 reel 7, frame 0348) is in the same code, and Jacob Wagner, chief clerk of the State Department, wrote its decode between the lines. It shares 47 group numbers with Erving’s letter. For 45 of them the values agree (217 would, 1218 some, 872 then, 748. 887 au-tho, 1402 wor, 1598 tain, 301 give …). Two are undecided: 584 (na in the key, nation in the alignment, Wagner’s nations?) and 943, which in Wagner’s line stands between friend and ship with no word of its own.

Lines of dotted code numbers with Jacob Wagner's decode written above them in a smaller hand
Pinckney to Madison, Madrid, 22 February 1803, frame 0348: Wagner’s decode over the code, “and that I was authorised … 748. 887 [au-tho-]”, “some propositions 1218. 1640. 1147. 248△”, “was sure she would give them the most 390. 116. 1370. 217. 301. 871. 1651. 718”, “I then 1147. 872”. Image: National Archives and Records Administration, RG 59, Despatches from US Ministers to Spain, vol. 6, microfilm M31 reel 7, frame 0348 (right page), via catalog.archives.gov NAID 188604008.

The March letter. Erving’s No. 21 of 24 March, with Madison’s decode (targets/erving1807), gives further pairs. With Wagner it supports 716 of the 1,145 groups (62.5%, 141 different numbers) under a strict match; a value that recurs with the same sense elsewhere in this letter, or has that outside support, covers 908 (79.3%). The rest, about one group in five, is fitted to the Founders text alone.

The transcription. 53 groups, from legible stretches of four frames and the three spellings of Hanover, were re-read on the images by the reviewer: no digit differed. That is a purposive sample, not an error rate for the whole.

The review. OpenAI Codex reviewed the files adversarially and found the result confirmed but overstated (codex_review/review.md). Its corrections are the figures used on this page: 45 of 47 Wagner groups (not 46), 79.3% recurrence or outside support (not 80.5%), and six firm gap fills rather than ten.

06 What remains uncertain

Of the 1,145 groups in the alignment, 1,136 have a value (99.2%) and 1,125 (98.3%) give sense without the eleven marked conjectures. Grades as in the repository’s conventions: most values are C, from the known plaintext; M uncertain; I inferred from context or from the alphabetical order.

07 Sources

Transcription, alignment, key, Wagner pairs, the decoded text and the review: targets/erving1807aug/.