James Madison's Codes and Ciphers

Philip Mazzei's Non-alphabetical Cipher

A cipher that appeared early in Madison's career was Philip Mazzei's non-alphabetical cipher. Mazzei was an Italian who introduced cultivation of olives and grapes to Virginia and a neighbor and friend of Thomas Jefferson. During the Revolution, Mazzei returned to Italy in 1779 as a commissioned agent from Virginia and supplied arms until 1783.

Mazzei's letter to Madison of 30 November 1780 (in Italian) used a cipher that employed non-alphabetic symbols. However, Madison did not have the cipher when he received the letter. He was in Philadelphia as a delegate of Virginia to the Continental Congress (March 1780-December 1783).

Having neglected to bring with me from Virginia the cypher concerted between you and the Executive, I still remain ignorant of the paragraph in your last which I suppose the best worth knowing.
Madison to Philip Mazzei, 7 July 1781

Apparently, the state government of Virginia kept the copy of the cipher but, upon inquiry, Madison found out that it had been destroyed in January, when Benedict Arnold raided Richmond, the capital of Virginia. Governor Thomas Jefferson was helpless when Arnold burnt warehouses and a number of private and public buildings.

If I have received any letter from you desiring Mazzies Cypher it has Escaped me[.] The Cypher was destroyed with the Counci[l] [pa]pers in January.
David Jameson to Madison, 29 September 1781 (PMJ)

Thus, the key to the cipher was lost (the lines in cipher are undeciphered in The Papers of James Madison), until Armin Krauss solved it in 2015 (see another article).

Apparently, the above letter of 7 July 1781 did not reach Mazzei, who learned the loss of the cipher only when he received Madison's letter of 25 October 1781 (not found) (Mazzei to John Adams, 21 May 1782). After a month, Mazzei wanted to rely on Adams' cipher to forward his intelligence about recognition of American independence in Europe.

In my preceding of the 21st. ultmo. I acquainted your Excellency, that Mr. Maddison had written me from Philadelphia, that my cipher had been lost in the late confusions in Virginia, for which reason all I had written in cipher since that time, as well to him for the use of Congress, as to the Governor and Council of my State, still remains unlocked, and must be so untill I get there myself, which I expect will soon be the case, provided I can get a tollerable good opportunity to go. Having now some thing to write, which I would not venture cross the Atlantic unless it was in cipher, I must desire the favour of your Excellency to do in my stead, if you should think it worth the notice of Congress, as I do.
Mazzei to John Adams, 28 June 1782

Adams did not forward Mazzei's intelligence because he did not want to give an alarm unnecessarily and he thought the intelligence incorrect (John Adams to Mazzei, 12 August 1782).

Virginia Delegates' Code (THE=6, WE015)

The thirteen states assembled in the Continental Congress had conflicting interests. The Virginia delegates in Philadelphia decided to prepare a code for secret communication with Richmond.

We shall endeavour to forward by the next mail a cypher, for the communication of secret intelligence without danger of detection.
Virginia Delegates to Thomas Nelson [Governor of Virginia], 23 October 1781

While the Americans had just gained an important victory at Yorktown, jealousies among the states required secret writing. However, it would take time to deliver the code to Richmond.

Mr. Randolph intends shortly to Virginia. By him we will endeavour to send the journals you wrote for and also the Cypher so long promised.
Virginia Delegates to Benjamin Harrison [Governor of Virginia], 15 February 1782

Edmund Randolph was Attorney General of Virginia (1776-1786) and had been Madison's colleague in the Virginia delegation from July 1781. It was on 18 March 1782 that Randolph left Philadelphia and on 21 April, Randolph delivered the code.

I yesterday delivered to Mr. [Foster] Webb the cypher, prepared for the correspondence between the executive and the delegates of Virginia in Congress. It is formed upon the principles of the French cypher, and may, I believe, be said to be inscrutable.
Edmund Randolph to Benjamin Harrison, 22 April 1782

From this time on, the Virginia Delegates' Code was used by the delegates (James Madison, Theodorick Bland, Joseph Jones) in their report to the Governor (Benjamin Harrison). Madison frequently used it in writing to Randolph in Virginia. It comprised numbers 1-846 assigned to words and syllables.

Apparently, the delegates had only one copy of the code. At one time, Madison mentioned that he could not use it because his colleague was using it.

I am prevented from adding another paragraph by the want of the Cypher which Col. Bland has in his possession & is making use of.
Madison to Edmund Randolph, 21 May 1782

Bland used the code in writing to St. George Tucker, a member of the Virginia Council of State.

Polyalphabetic Cipher CUPID (WE050)

Proposal and First Use

Soon, Randolph felt a need of a private cipher for correspondence with Madison, for keeping secrecy even in the intimate circle having access to the official code.

I wish, that on further occasions of speaking of individuals, we may use the cypher, which we were taught by Mr. Lovell. Let the key-word be the name* of the negro boy, who used to wait on our common friend Mr. Jas. Madison [Sr.]. Billy can remind you, if you should be at a loss for it.
There can be no necessity for this process in the communication of intelligence merely public: but a private hint would be no secret to any person, having access to the cypher of government.
Edmund Randolph to Madison, 5 July 1782

Madison noted "probably cupid" in reference to the name hinted by Randolph. He heartily agreed to introduce the new cipher. Two mail robbery incidents had just occurred in the past few weeks.

Notwithstanding the defensive professions of the enemy, they seem to be waging an active war against the post-riders. The mail for the Eastward, on Wednesday last, shared the same fate which the Southern mail did a few weeks ago, and, it is said, from the same identical villains. This operation has withdrawn them from their Southern stand, and secured the arrival of the mail, which brings your favor of the fifth instant.
I fully concur in the change of cypher which you suggest, and understand the reference for a key-word. I have been in some pain from the danger incident to the cypher we now use. The enemy, I am told, have in some instances published their intercepted cyphers. On our first meeting, I propose to prepare, against another separation, a cypher framed by Mr. Livingston on a more enlarged and complicated plan than ours, of which he has furnished me several blank printed copies.
Madison to Edmund Randolph, 16 July 1782

In this letter, Madison went on to write about domestic issues concerning several states with the Virginia Delegates' Code. Then, Madison switched to the CUPID cipher to write about his colleague Arthur Lee. The original manuscript shows the cipher was first decoded with the Virginia Delegates' Code, which was struck out, and then the reading according to CUPID was interlined.

Trouble in Reading

At the end of the paragraph in CUPID, astute Madison added "This cypher, I find, is extremely tedious & liable to errors." Randolph and Madison had learned this cipher from James Lovell. But apparently they did not know the Lovell cipher invariably puzzled his correspondents such as John Adams and Benjamin Franklin. Indeed, Randolph could not read the passage in the CUPID cipher.

Three clauses in your late favors are impenetrably locked up from me. I can discover, however, that you have fallen into the just keyword, as I am able to make out by this supposition the name of a certain gentleman [Arthur Lee], who probably has been zealous in the late business of finance. But farther than this I cannot go, and must therefore beg you to explain the mode, in which you have managed the cypher. If you will inclose to me a sett of Mr. Livingston's printed cyphers, I will fill them up, and send you a counterpart.
Randolph to Madison, 6 August 1782

That Randolph could not make out the clauses in CUPID cipher was unexpected for Madison, who also used it on 23 July, 30 July, and 5 August. On 20 August, after writing a paragraph in CUPID, Madison explained about the system.

I am at a loss to account for the impenetrability of the cypher [CUPID] in my late letters, of which your favor of the 6th instant complains. I regret it too the more as I have since made liberal use of it.
The rule I have observed has been to select the columns beginning with the several letters of the Key word, to arrange them in the same order in which the letters follow each other in the Key word and to use them in that rotation; always beginning afresh after the use of a word, syllable or letter written in the usual character, & often throwing in these characters merely to break a sentence or paragraph into parts, & thereby circumscribe the influence of an error. This explanation I hope will be satisfactory.
The printed cypher of Mr. Livingston is too large for four sheets to be sent by the Post as you propose. If a private conveyance offers I shall embrace it.
Madison to Randolph, 20 August 1782

As Madison explained, the CUPID cipher involves columns, each beginning with the letters of the keyword (the columns are written horizontally in the table below).
 1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
 C  D  E  F  G  H  I  J  K  L  M  N  O  P  Q  R  S  T  U  V  W  X  Y  Z  &  A  B
 U  V  W  X  Y  Z  &  A  B  C  D  E  F  G  H  I  J  K  L  M  N  O  P  Q  R  S  T
 P  Q  R  S  T  U  V  W  X  Y  Z  &  A  B  C  D  E  F  G  H  I  J  K  L  M  N  O
 I  J  K  L  M  N  O  P  Q  R  S  T  U  V  W  X  Y  Z  &  A  B  C  D  E  F  G  H
 D  E  F  G  H  I  J  K  L  M  N  O  P  Q  R  S  T  U  V  W  X  Y  Z  &  A  B  C

The crucial point is that the "columns" are regularly switched for every enciphered letter. Madison was aware that this was liable to errors. When one lost track of the key letter being used, all the subsequent letters would become unreadable. In view of this, Madison would throw in characters in clear here and there, which would indicate the key letter cycle would start afresh. Even with this caution by Madison, however, Randolph could not read Madison's cipher.

A week later, Madison sent the keys to Randolph.

As I do not find that any of my letters in which Mr. L____s Cypher was used have miscarried, I inclose you a Key exactly copied from mine. If it arrives safe, and unlocks the past letters, it may be of future use [by?] us[.] observe & inform me whether the seal of [this letter?] obviates all suspicion of its having been opened.
27 August 1782, Madison to Randolph

Enciphering Errors

Although Madison was aware that the Lovell cipher was liable to errors, he did not realize he made many enciphering errors in his very first use of it. The following is the passages in CUPID in the above illustrated letter of 16 July. In this short specimen, no less than 11 characters are wrongly enciphered, even without taking into account that use of a wrong column results in all the subsequent letters wrongly enciphered.

 2 D V Q J E
22 X O J C Y
15 Q H C W R
12 N E & T O
12 N E & T O
16 R I D X S (Doctor)
19 U L G & V
17 S J E Y T
17 S J E Y T *wrong column (Lee)
15 Q H C W R
25 & R M F A *supposed to be "was"
18 T K F Z U *should be 17(S)?
24 Z Q L E & *wrong column?
 6 H Z U N I *wrong column?
12 N E & T O *supposed to be "sent", switching of the column apparently forgotten
 7 I & V O J
21 W N I B X
 5 G Y T M H
 7 I & V O J (into)
 2 D V Q J E
22 X O J C Y
15 Q H C W R
12 N E & T O
12 N E & T O
 6 H Z U N I *should be 16(R) (Doctor)
 1 C U P I D
22 X O J C Y
26 A S N G B
12 N E & T O
14 P G B V Q *should be 15(R)
26 A S N G B
10 L C Y R M
 5 G Y T M H
11 M D Z S N (contracts)
 6 H Z U N I
12 N E & T O (in)
27 B T O H C
 3 E W R K F
20 V M H A W
 1 C U P I D
 3 E W R K F (trade)
 2 D V Q J E
23 Y P K D Z *should be 22(O)
15 Q H C W R
12 N E & T O
12 N E & T O
 6 H Z U N I *should be 16(R) (Doctor)
11 M D Z S N
22 X O J C Y
 3 E W R K F
 1 C U P I D
16 R I D X S (Mor[r]is)
13 O F A U P
26 A S N G B *should be 25(R) (or)
18 T K F Z U
10 L C Y R M
25 & R M F A
12 N E & T O
18 T K F Z U
24 Z Q L E &
 1 C U P I D
11 M D Z S N (Franklin)

Parallel Use of Virginia Delegates' Code and CUPID Cipher

Madison used the Virginia Delegates' Code or the CUPID cipher as occasion required. He sometimes used both in the same letter. In one such example, a letter of 5 August, Madison wrote "You will be able to distinguish the paragraphs in which each cypher is used without my specification of them." Indeed, the CUPID cipher has only numbers from 1 to 27 and it can be easily distinguished from the Virginia Delegates' code that had numbers up to 846. However, from 20 August, Madison often marked "Mr L--l" to indicate the beginning of a section in CUPID.

The first page of the letter of 20 August is shown below. While the second paragraph is marked "Mr. L--l" to indicate the switch of cipher, the transition should be fairly obvious.

Randolph-Madison Code (TH=308, WE012)

Proposal and Delivery

Both Madison and Randolph found the Lovell-style CUPID cipher too complicated. Expecting a troublesome session in the forthcoming Virginia State Assembly scheduled in October, Randolph wrote about need of a new code.

This, united with the other legislative evolutions will demand a veil, not to be found in the cypher of the delegation, and costing too high a price in the use of Lovell's. I shall therefore send you a fresh sheet, not very elaborate indeed, but correspondent to our epistolary wants.
Randolph to Madison, 27 September 1782

Madison welcomed his plan and offered to send Livingston's printed sheets, promised on 20 August.

I hope you will execute your plan of framing a fresh Cypher. In case of a conveyance I will send the printed sheets I promised. But do not suffer this expectation to interfere with your own purpose.
Madison to Randolph, 8 October 1782

However, Randolph, Attorney General of Virginia, was too occupied. On 26 October, he finally had a prospect of having time to prepare a new code. In this letter, he could not mention particular names because of the incompletion of the code but he wrote "The court being about to rise will enable me to finish this cypher for the next post."

Madison was impatient to receive the new code.

I am anxious for the new Cypher which it promises as well for my use as yours; and for the same reasons. I conclude from your silence as to my late communications in L--ls [Lovell's] Cypher that the key I sent you some time ago answered its purpose.
Madison to Edmund Randolph, 5 November 1782

After some more exchanges, Randolph finally sent Madison a new code.

The inclosed cypher, tho' not nicely executed or arm[e]d with every possible combination, is, I trust, sufficiently involved to serve, as a secure seal to our correspondences. I send it by the post, as the transactions of this week require no cover.
Edmund Randolph to Madison, 22 November 1782

The Code

When Madison mentioned, in his letter of 16 July 1782, blank printed copies of a "more enlarged and complicated" cipher given by Robert R. Livingston (Secretary of Foreign Affairs), probably he meant a 1100-element template prepared by Livingston in May 1782, which served as the basis for the Livingston-Adams-Dana code (WE010) and the Livingston-Washington code (WE009) (see here).

However, Randolph's new code appears to be based on the same template of 660 elements used for Robert Morris' codes (THE=169'/WE006, THE=19'/WE008, THE=504'/WE011) etc. (see here).

Possibly, Randolph had intended to use the 660-element template as of 27 September, when he wrote of "a fresh sheet, not very elaborate indeed, but correspondent to our epistolary wants". Considering that Randolph and Madison learned of cipher from James Lovell and Madison was given the 1100-element template, it would be possible that they had access to the 660-element template. Probably, Randolph used the small code template when Madison did not send him the enlarged 1100-element template.

Randolph's code had substantially the same vocabulary as the template, (except that, according to the code list printed in Weber, it had "feast" instead of "fast" and "heard" instead of "head".) The template had 60 unassigned numbers for extension and Randolph assigned 20 numbers from 557 to 576 to the following terms not listed in the template: at, secretary, foreign, affair, journal, Nova Scotia, governor, speaker, senate, delegate, committee, one, two, three, confederation, colleague, financier, tobacco, resolution, president.

The vocabulary of Randolph's code totaled 625 elements, which was smaller than 846 for the Virginia Delegates' Code. However, apart from the size of vocabulary, it had a further weakness in that it was a blockwise alphabetical code. That is, words and syllables from "A" to "and" were assigned consecutive code numbers 27 to 50 in alphabetical order and those from "ang" to "ax" were assigned codes 85 to 97, and so on. Such regularity facilitates code breaking.

Further, John Laurens' code and Morris' codes adopted a convention that a dot above a code number indicates an ending "-e". Thus, while the template did not include a code for "the", the most frequently used word in English, it could be represented with one number. However, Randolph's code did not provide such an arrangement. Thus, Randolph wrote "the" in plaintext in the context of cipher or enciphered it as "308(th) 352(e)". In his first use, Madison would use "316(thi)" to mean "the".

Unsealed Delivery

A week after sending the code, Randolph started using it, assuming it would soon arrive.

I fear, that my latter by the last post, inclosing the new cypher, may have miscarried in its way from hence to the post office. But as I cannot hear any thing of it I am hopeful, that it will salute you on Monday; and on this supposition I shall invelop a part of this letter in it.
Randolph to Madison, 29 November 1782

It arrived indeed. Madison was alarmed, however, to find that the code sheet was not sealed.

Your favor of the 22d Ulto. with the cypher enclosed came by yesterdays post; but very unluckily without having ever been sealed. This omission lessens much my confidence in the Cypher; altho, it seems scarcely possible for any advantage to have been taken unless the letter lay longer out of your hands before the mail was closed, than the interval between its arrival here, and its coming into my hands; to say nothing of the honor of the post offices. I enquired of Mr. Hazard, without mentioning the fact, how far the regulations of the mail admitted of such frauds. His answer altho' not absolutely conclusive favors the purity of the Cypher; & I shall venture to make use of it unless you recommend the contrary, or untill you transmit a new one.
Madison to Randolph, 3 December 1782

As if evidencing his concern about Randolph's new code, Madison continued to use Virginia Delegates' Code in his letter to Randolph on 10 December, with a note in the margin "I make use of the Official Cypher as more familiar & equally proper here". On 17 December, he again used the Virginia Delegates' Code, with a mark of "(Official Cypher)" before the paragraph in it. On 24 December, he abbreviated the mark to "Of-l Cy-r".

Randolph was optimistic on his part.

Nothing, I think, need be apprehended from the conveyance of the cypher in an unsealed letter. The curiosity of the postmaster or any other person must [have] been extravagant, if a copy was taken of it. Indeed it seems impossible, for the hurry in which the letter was sent to the office from home on the morning of the departure of the post, would not suffer a transcription here, and I presume, you received it, before any thing of the sort could have been done in Phila.
Randolph to Madison, 13 December 1782

Use by Madison

A month after Randolph switched to the new code, Madison finally began using it on 30 December, when he encoded three phrases in it:
632<I> 362<ef> 413<fer> 228<second>[should be 248<so>] 100<N> [i.e., Jefferson]
428<for> 316<the> 494<west> 646<indi> 352<e> 219<s>
Soon, however, he found it unsatisfactory.

I find a great check to secret communications from the defects of your cypher. It in the first place is so scanty as to be extremely tedious and in the next both the letters & figures are in so ambiguous a character that great caution is necessary to avoid errors. I wish we could some how or other substitute a more convenient one
Madison to Edmund Randolph, 4 February 1783

Though Madison continued to use Randolph's code in February and March, he again complained on 18 March 1783: "The tediousness of the Cypher does not permit me now to enter into detail." In this letter, he encoded in a brief passage in Randolph's code his concern about finalizing a peace treaty. His remarks were so sensitive that he asked Randolph "not to hazard even an interlined decypherment of those which I have deposited in your confidence."

On 24 June 1783, he again stressed the tediousness of encoding to Randolph: "If I had leisure to use a Cypher, I would dilate much upon the present state of our Affairs; which as it is I must defer to another occasion." The delegates then were indeed faced with an iminent danger. On the same day, Madison and his colleague John F. Mercer signed a letter to Governor Benjamin Harrison written by Mercer in the Virginia Delegates' Code, which detailed on the mutiny that threatened Congress and reported that Congress would move to Princeton or Trenton if Pennsylvania authority would not take satisfactory measures to restore peace. In the end, Congress met in Princeton.

Thereafter, Madison ceased to write in code to the governor or Randolph. He returned to Virginia when his term as delegate expired at the end of October.

Randolph's Extended Code (THE=1625, WE016)

In his letter of 18 March 1782, Madison urged Randolph to prepare a new code: "Pray hasten the new cypher which you have promised."

According to the editors of The Papers of James Madison, Randolph did not comply with this wish. On the other hand, Ralph E. Weber considers this may be the handwritten 1700-element code that he lists as WE016. Although this nearly tripled the number of elements from the earlier code, again, this was a blockwise alphabetical code.

Correspondence with Thomas Jefferson

Thomas Jefferson (1743-1826) had become a close friend of Madison (1751-1836) since 1779, when Madison as a council member (1777-1779) worked for Jefferson as the governor of Virginia (1779-1781). When Jefferson visited Philadelphia from December 1782 to January 1783, he arranged a book code with Madison (THE=816.27). Book code dispensed the labor of preparing a code list but, in use, it involved a lot of trouble in counting the lines.

In April, they introduced a code THE=430 (WE017) of elements 1-1107. This code was extensively used in the correspondence between them till August 1785. In October, Madison received from Jefferson a new code THE=812 (WE018) of elements 1-1700. Thereafter, 1700 would be the standard size of American diplomatic code. The new code THE=812 (WE018) was frequently used between Jefferson, Madison, and James Monroe during Jefferson's residence in Paris and its use would be resumed during the years of political strife in 1790s. (See here.)

The code THE=812 (WE018) which Jefferson sent from Paris to Madison appears to have the same vocabulary as Randolph's extended code THE=1625 (WE016). Jefferson may have received it when he became a delegate to the Continental Congress for the session from November 1783.

Letters using cipher from this period:

Monroe to Madison, May 1785 TH=432 (WE014)

Monroe to Madison, 14 August 1785 TH=432 (WE014)

Monroe to Jefferson, 15 August 1785 THE=812 (WE018)

Madison to Jefferson, 20 August 1785 THE=430 (WE017)

Monroe to Jefferson, 25 August 1785 THE=812 (WE018)

Madison to Jefferson, 3 October 1785 THE=812 (WE018)

Monroe to Madison, 26 December 1785 TH=432 (WE014)

Monroe to Jefferson, 19 January 1786 THE=812 (WE018)

Monroe to Madison, 31 May 1786 TH=432 (WE014)

Monroe to Jefferson, 16 June 1786 THE=812 (WE018)

Madison to Monroe, 21 June 1786 TH=432 (WE014)

Monroe to Jefferson, 16 July 1786 THE=812 (WE018)

Madison to Jefferson, 12 August 1786 THE=812 (WE018)

Monroe to Jefferson, 19 August 1786 THE=812 (WE018)

Monroe to Jefferson, 12 October 1786 THE=812 (WE018)

Monroe to Jefferson, 27 July 1788 THE=812 (WE018)

Monroe to Jefferson, 12 July 1788 THE=812 (WE018)

Madison to Jefferson, 8 December 1788 THE=812 (WE018)

Correspondence with James Monroe

Monroe's Small Code (WE094)

James Monroe (1758-1831) was received by Thomas Jefferson to study law under him in 1780 and soon they became close friends. When Jefferson was appointed as an additional peace commissioner to work in Paris, Monroe sent him a small code of elements 1-99 (WE094) on 8 February 1782. Jefferson's foreign mission, however, was cancelled when the news of the preliminary peace treaty arrived and Jefferson apparently never used Monroe's small code.

In June 1783, the Virginia legislature reelected delegates to the Continental Congress to sit for the next term. As a young man of promise, Monroe was elected with distinguished leaders such as Thomas Jefferson and Arthur Lee.

Soon after the session of Continental Congress opened in Annapolis in November 1783, it was decided to send Jefferson to Paris to assist Franklin and John Adams in drawing up treaties of commerce. Jefferson not only sold his collection of books he acquired in Annapolis to Monroe but he recommended him to Madison on 8 May 1784: "He wishes a correspondence with you; and I suppose his situation will render him an useful one to you. The scrupulousness of his honor will make you safe in the most confidential communications. A better man cannot be."

Monroe provided Jefferson with a fuller code of some 1100 elements (THE=907, WE019) in May 1784 and another of some 900 elements (THE=7, WE020) in July 1784 (see here). Apparently, Monroe's code THE=7 (WE020) was based on the Virginia Delegates' Code (THE=6, WE015), to which Monroe probably had access as a delegate. Inspection of the code list printed in Weber shows that (disregarding possible transcription errors) 606(trea)-660(nor) in WE020 correspond to 660(trea)-606(nor), 661(far)-716(york) in WE020 (the number 671 is absent) correspond to 715(far)-661(York) in WE015, and 717(governor)-771(mean) in WE020 correspond to 716(mean)-770(governor), each in reverse order. While other portions may not be as regular as these, Monroe apparently used the code numbers 1-846 of the Virginia Delegates' Code in different orders and added numbers 847(Gov. Harrison), 848(R.H Lee), 849(a Lee), and 900-925.

While providing Jefferson with a full code, Monroe sent Madison the small code (WE094) prepared for Jefferson in a letter of 7 November 1784, which began with "Dear Sir, I enclose you a cypher which will put some cover on our correspondence." This is the first known letter from Monroe to Madison after Jefferson's recommendation on 8 May (PJM n.1; see also Madison to Monroe, 14 November 1784). Madison duly acknowledged its receipt.

Your favor without date [i.e., 7 November] was brought by thursday's post. It inclosed a Cypher for which I thank you & which I shall make use of as occasion may require, though from the nature of our respective situations, its chief value will be derived from your use of it.
Madison to Monroe, [ca. 20] November 1784

Monroe used the small code in letters to Madison at least on 15 November 1784, 18 December 1784, and 1 February, 6 March 1785. Madison modestly used it on 8 January 1785, in writing "51 [R.H.Lee] and RRL [Robert R. Livingston]".

TH=432 (WE014)

Obliging Monroe's wish, Madison provided Monroe with a new 1-660 code TH=432 (WE014) on 12 April 1785.

In one of your letters recd before I left Richmond you expressed a wish for a better Cypher. Since my return to Orange I have been able to get one made out which will answer every purpose. I will either enclose it herewith or send it by the Gentleman who is already charged with a letter for you.
Madison to Monroe, 12 April 1785

Although the code sheet in the James Madison Papers is handwritten, similarity of vocabulary suggests that Madison prepared this code on the basis of the 660-element printed template used by Randolph-Madison code (TH=308,WE012).

Monroe, now in New York where the Congress convened, used it for the first time on [8] May 1785. Its further use includes Monroe to Madison, 14 August, 26 December 1785, and 31 May 1786; and Madison to Monroe, 21 June 1786.

In several occasions from July to September 1786, Monroe refrained from writing in code because Madison was on trip (15 July and 3 September). On 14 August, he ventured to write in clear.

I write in Congress & therefore am deprived of the advantage of the cypher, but am so desirous of yr. sentiments as to risque mine without that cover.
Monroe to Madison, 14 August 1786

About the same time, he also wrote to Governor Patrick Henry in clear because the Virginia Delegates Cipher was lost.

I have wish'd to communicate for sometime since to you an account of a transaction here for your sentiments respecting it, but have declin'd from the want of a cypher, that of the delegation being we fear lost. The affr. however has come to such a crisis and is of such high importance to the U.S. & ours in particular that I shall risque the communication without that cover.
Monroe to Patrick Henry, 12 August 1786

This letter shows the Virginia delegates continued to rely on the official Virginia cipher, though the present author does not know of its use after June 1783. The topic that made Monroe to risk writing without cipher was the Jay proposal (see the next section).

Monroe, having served in Congress since 1783, was not eligible for the next term from November 1786 by virtue of the Articles of Confederation, ratified in March 1781, which stipulated that no person could serve for more than three years in any term of six years. Monroe returned to Virginia and Madison succeeded him in Congress in New York.

Father of the Constitution

In 1787, Madison resumed use of the earlier code (TH=308,WE012) in writing to Edmund Randolph in 1787 (11 March, 15 April). The topic that required secrecy was the negotiation with the Spanish about navigation of the Mississippi. In the spring of 1786, Secretary of Foreign Affairs John Jay had proposed that claims for the navigation should be abandoned for twenty-five years in exchange for a favorable commercial treaty. This proposal, however, was considered to profit New York. The main reason that Madison accepted to be a delegate to Congress was to fight the Jay proposal.

The Negociations with Spain are carried on if they go on at all entirely behind the curtain. The business has been put into such a form that it rests wholly with Jay how far he will proceed with Guardoqui [i.e., Spanish minister] and how far he will communicate with Congress.
Madison to Edmund Randolph, 11 March 1787 Words in italics were in code.

Madison was active in the Philadelphia Convention from May to September 1787, which led to adoption of the Constitution of the United States.

After returning to New York, he sent Randolph two numbers of the Federalist Papers, advocating the ratification of the Constitution. He used Randolph's code to cover his revelation that he was the author for a few numbers and another was a member of the Convention [i.e., Alexander Hamilton].

Political Strife in the 1790s

In 1793, in a political turmoil, Jefferson, now Secretary of State, resumed use of an old code (THE=812, WE018) (see here).

During Monroe's residence in Paris as a minister (1794-1796), the same code was used regularly in correspondences between Madison and Monroe (see here).

Letters using cipher from this period:

Monroe to Madison, 3 June 1795 THE=812 (WE018)

Monroe to Madison, 30 June 1795 THE=812 (WE018)

Monroe to Madison, 15 August 1795 THE=812 (WE018)

Monroe to Madison, 8 September 1795, another version THE=812 (WE018)

Monroe to Madison, 24 October 1795 THE=812 (WE018)

Monroe to Madison, 29 October 1795 THE=812 (WE018)

Madison to Monroe, 25 December 1795 THE=812 (WE018)

Monroe to Madison, 12 January 1796 THE=812 (WE018)

Madison to Monroe, 26 January 1796 THE=812 (WE018)

Monroe to Madison, 27 February 1796 THE=812 (WE018)

Monroe to Madison, 24 March 1796 THE=812 (WE018)

Madison to Monroe, 18 April 1796 THE=812 (WE018)

Monroe to Jefferson, 7 May 1796 THE=812 (WE018)

Monroe to Madison, 7 May 1796 THE=812 (WE018)

Madison to Monroe, 14 May 1796 THE=812 (WE018)

Monroe to Madison, 7 June 1796 THE=812 (WE018)

Monroe to Madison, 5 July 1796, another copy THE=812 (WE018)

Monroe to Madison, 5 August 1796 THE=812 (WE018)

Monroe to Madison, 1 September 1796, another version THE=812 (WE018)

Monroe to Madison, 19 September 1796 THE=812 (WE018)

Monroe to Madison, 20 September 1796 THE=812 (WE018)

Monroe to Madison, 26 September 1796 THE=812 (WE018)

Monroe to Madison, 29 September 1796 THE=812 (WE018)

Monroe to Madison, 15 November 1796 THE=812 (WE018)

Secretary of State

When Jefferson became the third President of the United States, Madison was appointed Secretary of State. Robert R. Livingston, minister to France (1801-1804) used a 1700 element code THE=968 (WE027) in more than 45 letters to Madison. In one of them, Livingston referred to "540 1675 1460 1541" (person-al inter-est), which was a euphemism for a bribe, for French foreign minister Talleyrand (Charles Cerami, Jefferson's Great Gamble: The Remarkable Story of Jefferson, Napoleon and the Men Behind the Louisiana Purchase (2004) p.89). Livingston's successor John Armstrong (1804-1810) used a THE=972 code in 40 letters to Madison.

When, in 1803, Monroe was sent to Paris to assist Livingston in negotiating with the French government under Napoleon Bonaparte about the purchase of Louisiana (concluded in April), Madison sent him a code THE=1385 (WE028) of 1600 elements. Interestingly, two letters between Madison and Marquis Yrujo, a Spanish minister in Washington, in the James Madison Papers are encoded in this code (see [Yrujo to Madison, 2 July] 1803 and Madison to Marquis Yrujo, 8 July 1803).

While Monroe stayed in London as a minister from 1803 to 1807, he used THE=1385 (WE028) with Madison.

The State Department continued to use THE=1385 (WE028) under the two Secretaries of State under President Madison: Robert Smith (1809-1811) and Monroe (1811-1814). A draft shows President Madison used this code when he wrote on 2 August 1813 to Albert Gallatin, who had been dispatched to negotiate a peace of the War of 1812. Eventually, this code was known as the "Monroe Cypher". (See another article.)

©2009 S.Tomokiyo
First posted on 19 July 2009. Last modified on 12 September 2015.

Articles on Historical Cryptography
inserted by FC2 system