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).
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.
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.
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).
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.
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.
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.
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.
Bland used the code in writing to St. George Tucker, a member of the Virginia Council of State.
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.
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.
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.
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.
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.
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.
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.
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.
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.
Madison welcomed his plan and offered to send Livingston's printed sheets, promised on 20 August.
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.
After some more exchanges, Randolph finally sent Madison a new 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".
A week after sending the code, Randolph started using it, assuming it would soon arrive.
It arrived indeed. Madison was alarmed, however, to find that the code sheet was not sealed.
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.
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.
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.
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.
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)
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.
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]".
Obliging Monroe's wish, Madison provided Monroe with a new 1-660 code TH=432 (WE014) on 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  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.
About the same time, he also wrote to Governor Patrick Henry in clear because the Virginia Delegates Cipher was lost.
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.
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.
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].
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)
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)
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.)