As a Virginia delegate to the Continental Congress, while secretary of state, and in his personal correspondence with Thomas Jefferson, James Madison feared constantly that unauthorized people would seek to read his private and public correspondence. To deter such intrusions, he resorted to a variety of codes and ciphers.
Most of the early ciphers that Madison used were keyword polyalphabetic code systems involving a complex interaction of a keyword with alphabets and numbers in a preestablished pattern. The codes were designed by James Lovell, a Massachusetts delegate to the Continental Congress and an expert on ciphers. On July 5, 1782, Edmund Randolph wrote to James Madison: "I wish, that on future occasions of speaking of individuals we may use the cypher, which we were taught by Mr. Lovell. Let the keyword be the name of the negro boy, who used to wait on our common friend." Madison noted at the bottom of Randolph's letter, "Probably CUPID." He added, "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."
Like others, Madison often tired of using the time-consuming Lovell ciphers. As a result, he and Randolph tried to circumvent the codes with a secret seal (see Madison to Randolph, May 21 and October 8, 1782, and Randolph's replies of September 27 and November 22, 1782). The Virginia delegates' codes can be found in the appendices of Ralph E. Weber's United States Diplomatic Codes and Ciphers, 1775-1938 (Chicago: Precedent Publishing, 1979).
Even after the 1783 Treaty of Paris ended the American Revolution and the threat of British dispatch capture, the Virginia Congressional delegates remained obsessed with secrecy. Throughout the 1780s, they continued to exchange codes. In his correspondence with James Monroe, a fellow Virginia delegate and another future president, Madison used a major 600-element nomenclator. A nomenclator is a list with numbers keyed to the same number of words or parts of words (elements) in a random pattern and then used as their substitutes in an encoded message. Madison thought that such a code "will answer every purpose" (Madison to Monroe, April 12, 1785).
Gradually Madison, Monroe, Thomas Jefferson, and the other delegates lengthened the code nomenclators into the 1,500-element range, which offered greater security and greater flexibility for dispatches. Among many possible examples, see Madison to Thomas Jefferson, April 16, 1782, and Jefferson to Madison, January 31, 1783.
When Jefferson served as United States minister to France from 1784 to 1789, he and Madison often encoded parts of their letters. These codes, too, are in the appendices to Weber's United States Diplomatic Codes. Madison and Jefferson regularly used a 1,700-element nomenclator called "Jefferson's Third Cypher." As Madison wrote to Jefferson on October 17, 1784, "My two last neither of which were in cypher were written as will be all future ones in the same situation, in expectation of their being read by the postmasters. I am well assured that this is the fate of all the other Countries of Europe. Having now the use of my cypher I can write without restraint."
When Jefferson returned from France, he and Madison abandoned their ciphers until the heated political animosities of the 1790s led them to resume the use of the one devised in 1785. (See, for example, Jefferson to Madison, August 11 and 18, 1793.) Fearing that their letters would be read by postmasters of the opposing Federalist Party, they relied on private conversations for most of their political discussions, left letters unsigned, and began to encipher their letters when forced to put pen to paper about a potentially embarrassing or controversial topic.
"I wish, that on future occasions of speaking of individuals we may use the cipher, which we were taught by Mr. Lovell."
[Detail] Edmund Randolph to James Madison, July 5, 1782.
Manuscript Division, Library of Congress.