Thomas Jefferson's Codes and Ciphers: I (1783-1789)

Three kinds of designations are used for codes/ciphers described herein.
(1) PTJ Code No. x indicates code numbers arbitrarily assigned in the order of appearance by the editors of Papers of Thomas Jefferson.
(2) WExxx is a Weber number assigned by Ralph E. Weber.
(3) THE=xxx identifies a code by the code number assigned to the word "the". This is practical when referring to a yet unclassified code as well as quickly identifying a code used in a letter.

PTJ Code No.1 / WE087 (book code) with Madison (Jan.-Feb. 1783)

Jefferson during the Revolutionary War

Thomas Jefferson was one of the first to foresee American independence from the British Crown and, at thirty-three, drafted the Declaration of Independence in 1776. During the Revolutionary War, he was elected Governor of Virginia (1779-1781) but ended up in showing that he was not a wartime leader.

After resignation, he lived a retired life with his family and wrote Notes on the State of Virginia.

After the death of his beloved wife, Martha, the Congress appointed Jefferson as an additional peace commissioner in November 1782. Robert R. Livingston, Secretary of Foreign Affairs, thought of offering a position of his successor or a commissioner in Spain succeeding John Jay instead of the mission in Paris and asked James Madison to find out Jefferson's mind. Madison, Jefferson's fellow countryman from Virginia and residing in Philadelphia as a Virginia delegate to the Congress, wrote to Edmund Randolph in Virginia and asked him to find out Jefferson's response (2 and 3 December 1782). The substantial part of this letter was written in Virginia Delegates' official code (WE015) and Madison said he did not write to Jefferson directly because of "want of a cypher with him".

When Jefferson came to Philadelphia, he provided Madison with a book code. When he went over to Baltimore to set sail, however, the news of the provisional peace treaty came and his foreign mission was cancelled.


The book code was based on Thomas Nugent's New Pocket Dictionary of the French and English Languages (1774). A word was to be encoded by the column and the line in the column where the word occurs. For example, "a" was encoded as 1.1 and "the" as 816.27.

The edition had no pagination and Jefferson and Madison numbered the pages in the margin themselves. Apparently, their numbering was not consecutive and some numbers were skipped occasionally. For example, page numbers 61-79 were skipped (15 numbers skipped). Thus, "balance" was encoded as 60.27 while "basis" [conjectured reading by PTJ] was 80.15. Similarly, 8 numbers were skipped between "basis" 80.15 and "be" 89.1. (cf. Weber p.71)


A few days after Jefferson left Madison in Philadelphia, Jefferson used this code for the first time in a letter from Baltimore on 31 January 1783.

I use the only cypher I can now get at, using the marginal numbers in order & not as concerted.
Jefferson to Madison, 31 January 1783

Apparently, Jefferson and Madison had arranged some special ordering of page numbers to be used. Somehow, they used the page numbers in order rather than "as concerted" and this helped editors in later generations.

Madison also started to use the code. In his letter of 11 February, he encoded a passage reporting that a letter to the Congress from John Adams showed "his vanity, his prejudice against the French Court & his venom against Doctr. Franklin." The rest of the letter was in plaintext because "Other preparations for the post do not allow me to use more cypher at present."

It is clear that use of code/cipher was not only against prying eyes of foreign spies but also for protecting sensitive remarks from jealousies of fellow Americans.

In reply to Madison's letter of 11 February, Jefferson wrote in code on 14 February, "I am nearly at a loss to judge how he [Adams] will act in the negotiation. He hates Franklin, he hates Jay, he hates the French, he hates the English." Madison had trouble in decoding this letter. Madison's decoding had "has" in place of "hates", which made no sense in the context. Madison's reading, though including other errors and omissions, was long followed in publications until corrected by PTJ.

Book code is handy in that one need not prepare a code list but, in use, it involves a lot of trouble in counting the lines. Jefferson and Madison soon stopped using this code.

PTJ Code No.3 / WE017 / THE=430 with Madison (Apr. 1783-May 1785)

From April 1783 to May 1785, a numerical code of 1-1107 was used in numerous letters between Jefferson and Madison.

The first use of this code on 14 April 1783 was quite personal in nature. In encouraging Madison's courtship, Jefferson wrote in code "as I know it will render you happier than you can possibly be in a single state, I oft made it the subject of conversation, more exhortation, with her and was able to convince myself that she possessed every sentiment in your favor which you could wish."

Soon after this code came into use, in June 1783, Congress was threatened by some 300 mutinous soldiers and it was resolved to remove from Philadelphia to Princeton. In this turmoil, Madison apparently left his code behind. The code was missed when he reported the disposal of the mutineers to Jefferson.

The real plan & object of the mutiny lies in profound darkness. I have written this in hopes that it may get to Monticello before you leave it. It might have been made more interesting if I had brought the Cypher from Philadelphia.
Madison to Jefferson, 20 September 1783

Madison used this code in a letter as late as 20 August 1785, in which he acknowledged receipt of Jefferson's letter of 18 March 1785, which notified him of a new code (THE=812 / PTJ Code No. 9 / PJM JM-Jefferson Code No. 2 / WE018).

PTJ Code No.2 / WE094 by Monroe (Feb. 1783)

When Jefferson was appointed a peace commissioner, he offered a young James Monroe an opportunity to accompany him to France. On 8 February 1783, still believing Jefferson would sail from Baltimore, Monroe sent him a small code of 99 elements.

I take the liberty to enclose you a cypher of men & places which will perhaps in some instances form the subject of a correspondence.
8 February 1783, Monroe to Jefferson

Jefferson does not appear to have ever used this code.

Monroe used this code in a letter to Madison on 15 November 1784, 18 December 1784, and 1 February 1785 (Weber p.72).

Madison then proposed to Monroe a new 1-660 code WE014 on 12 April 1785. Its use includes Monroe to Madison, May 1785; Monroe to Madison, 31 May 1786; and Madison to Monroe, 21 June 1786.

PTJ Code No.5 / WE019(WE019b) / THE=907(THE=912) / "1st cipher" with Monroe (May-Dec. 1784)

The session of the Continental Congress from November 1783 to June 1784 was held in Annapolis, for which Monroe was elected as one of the Virginia delegates. It was also in this session that George Washington resigned his commission as commander-in-chief of the Continental Army in December 1783.

It was decided to send Jefferson to Paris to assist Franklin and John Adams in drawing up treaties of commerce (for which Jefferson drafted the instructions himself.)

When Jefferson left Annapolis to Philadelphia to make arrangements for crossing the Atlantic, Monroe was preparing a cipher for use between them.

As I have not been able to finish our cypher I can only give you an acct. of one or two measures. By the next post I will send it and before your departure give you information of whatever hath or may happen.
Monroe to Jefferson, 14 May 1784

When Monroe was to enclose it for Jefferson, however, he found a problem. But he did not have time to finish it. He was leaving for Germantown on that day. Young Monroe was given a first important role as a member of the committee to inspect a possible site for the capital. Thus he left the matter to a clerk.

I inclose you a cypher, which I hope you will be able to read, but upon examining it I find it incomplete & must therefore leave it with Mr. Clerici to be finish'd & sent by post.
Monroe to Jefferson, 20 May 1784

Thus, Monroe's code was enclosed in a letter of 21 May 1784 from Samuel Hardy to Jefferson. It was a code of some 1100 elements.

The first use of the code was in Monroe's letter of 25 May 1784, in which some key words such as "Maryland" or "indecent conduct" were written in code.

Monroe, however, found the code to be unpractical.

The cypher I find is imperfect, I have only us'd it for the present purpose. It appears to me only to want one to write by & in that case we may remedy the inconvenience. Otherwise I will make a new one & forw'd it by Mr. Lucerne or some other gentleman of distinction. I shall write you constantly, as well before you quit the continent as after.
Monroe to Jefferson, 25 May 1784

Monroe did not mean any defect of the code itself. Rather, he had only the code list arranged for decoding (i.e., in the order of code numbers) and not one for encoding (i.e., in alphabetical order).

His inconvenience, however, must have been minimal because this code was basically a one-part code. That is, the sequential code numbers were each assigned words etc. in alphabetical order, though the ordering of the blocks under common initial letters was partially changed (i.e., word beginning with D came first, followed by F, G, H, C, A, B, E, ...). This type of code was less secure against cryptanalysis than two-part code, in which code numbers are assigned words etc. in random order.

As it turned out, lack of a separate encoding sheet was not the only problem with Monroe's code. With all his efforts, Jefferson could not decode Monroe's letter. After interlining decodings, Jefferson found it did not make sense. The original manuscript shows the first decodings struck out and the correct reading written beside them. However, it was only after many months of frustrations that Jefferson could solve the puzzle.

In the first place, not until Jefferson settled down in Paris after a comfortable transatlantic passage which was "remarkably short, being only 19 days from land to land", did Jefferson find the problem. Jefferson waited until after Monroe came back to Congress, this time convened at Trenton, from a westward travel before he informed Monroe of the problem.

I informed you from Boston that before I had received your letters of May 25 & June 1, I had packed up our cypher and therefore could not there make out the passages which were put into cypher. I have tried it here & find that by some unfortunate mistake, probably in the young gentleman who wrote the cypher, it will not explain a single syllable. He has arranged all the numbers in their regular order, and then placed against each the words, syllables &c in alphabetical order. You can judge whether this was the plan of it. The want of the cypher would have restrained me from mentioning some things were I not assured of the fidelity of the bearer hereof Colo. Le Maire.
I am to acknowledge the receipt of your letter of Aug. 9. from New York, but not of the previous one therein mentioned to be sent by Mr. Short, he being not yet come, nor any tidings of him.
Jefferson to Monroe, 11 November 1784

Ignorant of the trouble, Monroe continued to puzzle Jefferson by using the code extensively on 1 November 1784 in reporting his westward travel to Jefferson and also on 14 December 1784.

PTJ Code No.6 / WE020 / THE=7 / "2nd cipher" with Monroe (Jul. 1784-Feb. 1785)

Monroe had enclosed with his letter of 20 July 1784 a new code, THE=7 (WE020).

By Mr. Short I have the pleasure to forward you a more complete cypher in which we will correspond in future.
Monroe to Jefferson, 20 July 1784

Jefferson received the code at the end of November by Short, soon to be his private secretary, who arrived in Paris. Jefferson actually used the new code on 10 December 1784.

However, this second cipher from Monroe only exacerbated the confusion. In his attempt of decoding, Jefferson used the new code, instead of the first one which he thought wrong. When Jefferson found out Monroe's letter of 1 November was no more intelligible than before, he reported the error to Monroe.

[W]hat was my mortification when I came to apply the cypher to it to find that I could not make out one syllable of it: and the more so as it is the only letter I have received from America by this packet. Whether you have taken up a cypher established with some other person, or whether it is from my own stupidity that I am thus disappointed, I cannot tell. That you may judge whether I do not understand the application of your cypher, and set me right I will quote the first cyphered paragraph of your letter with the translation
'The council na from  pa  fel appear  ea   *
      912.  746. 65. 397. 463.  334. 500. 962.
 op  tax enemy cer  sea  the council som Penslva. *
712. 170. 442.  58. 659.     912.    633.  803.  968.'
At the same time to shew you in what manner I use it, and so enable you to overcome any difficulties you may have found in the cyphered parts of my former letters, I will now cypher a sentence, putting the words under the cypher.  426.  446.103.   165.
What      is    Congress     doing?
I shall be anxious to hear whether you have been able to decypher my letters.
P.S. To prevent future difficulties I will send you a cypher by the first private hand which shall come.

[Marginal note] *There are no numbers in the cypher so high as these.
Jefferson to Monroe, 14 January 1785

As it happened, though Monroe's letter of 1 November was sent more than three months after he sent his second cipher (WE020, PTJ Code No.6), Monroe was still using the first cipher (WE019, PTJ Code No.5). With hindsight, this might seem obvious even from a mere fact "there are no numbers so high as" 962 and 968 in the second cipher but in the first cipher. The first cipher had some 1100 elements and the second cipher had 925. However, Jefferson knew that the first cipher had failed to decode Monroe's letters. Actually, Monroe did use the first cipher but the code table he had was an inaccurate copy. Jefferson was so desirous to read the letters that, after much effort, he succeeded in solving the puzzle. The report he sent Monroe reveals quite an achievement.

You were informed by my letters of Nov. 11. & Jan. 14. that the cypher established between us would not explain a syllable of your letters. -- Those of Nov. 1. & Dec. 14. having rendered me extremely desirous of deciphering them, I set to work with a resolution to effect it if possible. I soon found that they were written by your first cypher. To this, therefore, I applied myself and after several days spent on it I was able to set to rights the many errors of your copyist, whose inattention alone had inducted those difficulties. I found the numbers in my copy & yours to correspond as follows.
From 1-153 was right.
154. in yours corresponded to 185 in mine.
From 156 to 205 in yours corresponded to from 186 to 235 in mine.
From 206 to 236 in yours corresponded to from 154 to 184 in mine.
From 237 to 248 in yours corresponded to from 236 to 247 in mine.
From 268 to 352 in yours corresponded to from 266 to 350 in mine.
From 359 to 454 in yours corresponded to from 356 to 451 in mine.
From 456 to 551 in yours corresponded to from 452 to 547 in mine.
From 558 to 989 in yours corresponded to from 553 to 984 in mine.
994 in yours corresponded to 988, 989 in mine.
996, 997 in yours corresponded to 01. 02 in mine.
02. 03. 04. 05. 06. 07. 08. 09. in yours corresponded to 06. 07. 08. 09. 009. 008. 007. 006. in mine.
006. 002. 017. 016. 060. 050. 032. 041. 042. in yours corresponds to 002. 017. 013. 012. 020. 021. 036. 045. 046.
The remaining numbers of the cypher either did not enter into your letters at all, or not often enough to detect the errors. I have now therefore completely deciphered your letters of June 1. June 25. Nov. 1. and Dec. 14.
At present my only uneasiness is about my letters which have gone to you in cypher. That of Nov. 11. must have been in the 1st cypher. For this reason I have noted to you the differences in our copies as above that you may translate my numbers into yours. As I received the 2d cypher the 29th of Nov., I think it probable that my letters of Dec. 10. & Jan. 14. were written by that. If they were, I am in hopes you will have understood them. If they were written by the 1st. you will now be able by translating the numbers to understand them also; and thus this comedy of errors will be cleared up. Since writing so far I have made out a table adjusting the numbers in my copy to those in yours, which will enable you to translate with ease.
Jefferson to Monroe, [6] February 1785

Thus, it was the copyist's error that created this "comedy of errors". (WE019 printed by Ralph E. Weber is the version in Jefferson's possession, with each line followed by a number used by Monroe. Monroe's version is designated as WE019b herein.)

Jefferson's achievement was not duly appreciated by Monroe. When he received Jefferson's letter of 11 November, in which Jefferson said he did not yet receive the second cipher, and one of 10 December, which was written with the second cipher, he wrote from New York (where Congress had moved at the beginning of the year):

I have had the same difficulty with the cypher but from a different cause. The copy of that I sent by Mr. Short I left in Virga. When I sate out for the wstwd. & have not since been able to command it, but shall most probably by the next post, so that whether you send me one or not our embarrassment will in future be at an end. That you may read my first letter I send you the cypher by which it was wrote.
Monroe to Jefferson, 12 April 1785

Two months later, Monroe could not yet have the code he left in Virginia.

Unfortunately I have not been able to command my cypher from Virga. So that yr. communications in the last & preceding letters, have been hid from my view. I left it with Mr. Jones who hath plac'd it among his papers but where he knows not. He promises to search agn. on his return home which will be shortly. I hope to receive the one by young Mr. Adams wh. will terminate the difficulty.
This Committee hath reported and repeal'd the two first articles. I think it will be adopted. As I have no cypher I cannot risque anything upon this head further than to observe than the letter I allude to will serve to give you some idea of the alteration.
I shod. not have wrote thus freely without the cover of a cypher but from the confidence I repose in Mr. Mazzei. He will deliver it to you personally.
Monroe to Jefferson, 16 June 1785

This letter implies that he received Jefferson's letter of 18 March (see below), telling him of a new code, but he made no mention of receiving the letter of February, including Jefferson's solution. Thus, Monroe's two codes fell into disuse in confusion and Monroe waited for young John Quincy Adams to bring him a new code from Jefferson.

PTJ Code No.9 / WE018 / THE=812 with Monroe/Madison (Mar. 1785-)

With Monroe

Jefferson prepared a new code with a larger vocabulary. Compared to WE019 (PTJ Code No.5) with 1000 elements and WE020 (PTJ Code No.6) with 925, this code, containing 1700 elements, expanded the vocabulary considerably. (An earlier example of a code of this scale is WE016 by Randolph.)

I have used the second cypher in this letter. Either by a gentleman who will go to America in the April packet, or by young Mr Adams who will go in May, I will send you a new cypher which I have prepared on a large & commodious plan.
Jefferson to Monroe, 18 March 1785

It was in May that Jefferson could send the promised cipher by young John Quincy Adams.

I shall endeavor to complete a cypher to accompany this letter by young Mr. Adams.
Jefferson to Monroe, 11 May 1785

Monroe received the code on 15 August (Weber p.104). Finally, the two men could have the common code and both continued to use it during Jefferson's residence in Paris.

With Madison

The same code had been sent to Madison in Virginia on the same day as it was sent to Monroe, to replace the former code (WE017) they had been using since before Jefferson came to Paris.

Having lately made a cypher on a more convenient plan than the one we have used, I now transmit it to you by a Monsr. Doradour who goes to settle in Virginia.
Jefferson to Madison, 11 May 1785
Your favour of the 11 May by Monsr. Doradour inclosing your Cypher arrived in Virga. after I left it, and was sent after me to this place [Philadelphia]. Your notes which accompanied it, remained behind....
Madison to Jefferson, 3 October 1785

This code (WE018), frequently used between Jefferson, Madison, and Monroe during Jefferson's residence in Paris, would be resumed during the years of political strife in 1790s.

PTJ Code No.10 / THE=224 (Jefferson-Jay code, May 1785-)

Jefferson sent out another code on 11 May to John Jay, who had become the second Secretary of Foreign Affairs after long vacancy left by Livingston's resignation. The code, THE=224, was delivered by young John Quincy Adams, who also carried the code WE018 to Monroe.

As it frequently happens that we cannot meet with passengers going hence to the packet, to whom we may commit our letters, and it may be often necessary to write to you on subjects improper for the inspection of this Government, to which the letters by post are subject, I have made out a cypher, which I now enclose, and deliver to young Mr. Adams, who will have the honor of delivering you this.
Jefferson to Jay, 11 May 1785

As its twin, WE018 (PTJ Code No.9), this included 1700 elements. (1700 denotes "been".)

When Jefferson reported to the Secretary of prospected replacement of the French envoy in a letter of 4 February 1789 in this code, he thought the matter so sensitive that he wrote "I must beg you to take the trouble of decyphering yourself what follows."

On 14 and 18 March, he wrote down further proceedings and sent them to the Secretary with notes on 11 May 1789. According to the PTJ editors, who examined the original copies of the report in various archives, it is evident that, when Jefferson succeeded Jay as Secretary of State, "Jefferson must have found that there was no text except those in code for the letter of 4 Feb. 1789 and its three additions, and hence supplied the deficiency" by transcribing from the draft copy.

Later, Jefferson would use this code, THE=224, for correspondence with William Short and William Carmichael (here).

WE013 / THE=82' (Jay-Adams code; Jan. 1785-)

The year 1785, two years after the Revolutionary War ended, marked establishment of diplomatic relation between Britain and the United States. John Adams, the first American envoy residing in London, was provided by Jay with a THE=82' code (WE013) for his correspondence with the home government. (About the same time, the aged Benjamin Franklin was allowed to return to America and Jefferson succeeded him as minister to France.)

Jefferson never used this code and, when William Stephens Smith used this code in transmitting Jay's words in a letter of 30 June 1787, Jefferson, naturally, could not read it.

I have four cyphers, two of which it was possible you might have copies of, and two impossible. I tried both the possible and impossible; but none would explain it.
Jefferson to W. S. Smith, 31 August 1787

In a reply, Smith explained the code and his intended message.

The Cypher which put you to so much trouble I copied from Mr. Jay's Letter to Mr. Adams (This is not exact. See PTJ.) which I had with me and was intended to convey this Idea ....
W. S. Smith to Jefferson, 18 September 1787

W. S. Smith had been sent to London as a secretary to the US legation in London, where he would court and win the hands of John Adams' daughter. When he arrived in England (and before reaching London), he mentioned lack of code.

Not being possessed of a cipher, I must refer you to my letter of this date to Baron Steuben for a small piece of intelligence which I obtained in crossing the Atlantic.
W. S. Smith to Jay, 16 May 1786

PTJ Code No.8 / THE=994 with Adams (Jun. 1785-)

While using THE=82' code with Jay, Adams used THE=994 code with Jefferson and Franklin, American commissioners in Paris. Apparently, this code was originated on Adams' side. Adams used the code in his letters of 20 June, 18 July, and 24 July 1785. Jefferson, however, reported omissions in the encoding table of the code he received.

I was honoured yesterday with yours of the 24th instant. ...
In my copy of the cypher, on the alphabetical side, numbers are wanting from "Denmark" to "disc" inclusive, and from "gone" to "governor" inclusive. I suppose them to have been omitted in copying. Will you be so good as to send them to me from yours by the first safe conveyance?
Jefferson to John Adams, 31 July 1785

Jefferson took care to spell the keywords "Denmark", "disc", "gone", and "government" in code. When Adams supplied the omitted codes, he did not forget to find fault with Jefferson's use of the code.

The Vacancy in your alphabet may be filled from points to points inclusive 1506 970 331 504 1186 1268 356 517 754 1085 269 148 205 1318 1258 942 712 75 246 127 609 885 1461 837 1327 and secondly, in like manner 472 560 820 83. -- Now give me leave. You make use of the number 1672. It has no meaning in my Cypher. Indeed there is a vacancy from 1596 to 1700 inclusive. When you have filled them up as you proposed I should thank you for a Copy by the fist safe Conveyance &c.
John Adams to Jefferson, 7 August 1785

From the manuscript of the letter of 31 July, Jefferson indeed wrote 1672 for 1072. However, Jefferson pointed out that it was an error in the encoding sheet.

The number 1672 is an error in the alphabetical side of the cypher. Turn to the numerical side & in the 11th column & 72d line. You will see the number it should have been & what it was meant to signify. Correct your alphabetical side accordingly if it is wrong as mine was.
Jefferson to Adams, 17 August 1785

Although Jefferson generally used THE=994 code with Adams, on one occasion, he used a THE=1196 code, which he "gave to Mr. Adams", in the postscript of his letter to Adams dated 28 September 1787. It is noted that this was three days after Jefferson used the THE=1196 code in his letter to Carmichael for the first time.

PTJ Code No.11[PTJ Code No.13] / THE=1196 with Carmichael etc. (1787-)

Delivery of Code

Jefferson envisaged THE=1196 (also termed "Barclay-Lamb code" or "Adams-TJ-Barclay-Lamb code" in PTJ) code as a common cipher to be used among the American envoys in France, Britain, and Spain and the Secretary at home. However, his attempt to send it to Carmichael in Spain was a succession of frustrations.

William Carmichael stayed in Spain from 1779 as secretary to John Jay and, after Jay's departure for Paris in 1782, as chargé d'affaires.

Jefferson, who was already using a code with Madison and Monroe, told Carmichael of his intention of sending a code (missing letters of 30 January and 3 May 1785) . In this May, Jefferson sent a new code (WE018, PTJ Code No.9) to Monroe and Madison and another (THE=224, PTJ Code No.10) to Jay. To Carmichael, however, a bearer was hard to find.

I have hopes of sending the present by a Mr. Jarvis who went from hence to Holland some time ago. About this date I suppose him to be at Brussels and that from thence he will inform me whether in his way to Madrid he will pass by this place. If he does, this shall be accompanied by a cypher for our future use, if he does not I must still await a safe opportunity.
Jefferson to Carmichael, 22 June 1785

Carmichael, who had used code under Jay (see here), recognized the need to have a common cipher. In letters on 27 June and afterwards, Carmichael repeatedly urged the need of a code. When Carmichael received Jefferson's letter of 22 June, he suggested sharing a common cipher with Adams in London.

If you should have a proper occasion to send me a cypher, might it not be useful to give Mr. Adams a copy of the same?
Jefferson to Carmichael, 28 July 1785

Jefferson acknowledged his point when he next found a person going to Spain.

I will send the cypher by a gentleman who goes from here to Madrid about a month hence. It shall be a copy of the one I gave Mr. Adams.
Jefferson to Carmichael, 18 August 1785
the constant expectation of the departure of the persons whom I formerly gave you reason to expect has prevented my writing as it has done yours. They will probably leave this in a week, but their route will be circuitous and attended with delays. Between the middle and last of November they may be with you. By them you will receive a cypher by which you may communicate with Mr. Adams and myself. I should have sent it by Baron Dreyer the Danish minister, but I then expected our own conveyance would have been quicker.
Jefferson to Carmichael, 18 October 1785
At length, a confidential opportunity arrives for conveying to you a cypher; it will be handed you by the bearer Mr. Lambe. Copies of it are in the hands of Mr. Adams at London, Mr. Barclay who is proceeding to Maroco and Mr. Lambe who is proceeding to Algiers. This enables us to keep up such correspondences with each other as may be requisite.
Jefferson to Carmichael, 4 November 1785

However, this John Lamb, being sent by Congress to be an envoy in Algiers, would turn out to be an unfortunate choice. Though he arrived at Madrid on 4 December, he failed to hand the code to Carmichael. During his stay in Madrid for almost two months, he did not even let Carmichael copy his. Carmichael reported the situation after Lamb left for Africa.

on examining his papers Mr. Lamb found that he had but one copy of the cypher and says that he recollects that Mr. Barclay has the one destined for me. Your Excellency therefore until that Gentleman arrives cannot receive from me any confidential communications.
Carmichael to Jefferson, 4 February 1786

Soon Thomas Barclay arrived at Madrid on 10 March for preparation for his mission in Morocco. When Carmichael found that Barclay did not have the code Lamb said he should have, neither Carmichael nor Barclay made any noise over it. Jefferson, when acknowledging this report after returning from two months' visit to England (5 May), said nothing about Lamb's explanation, either. Actually, dissatisfied with the proceedings at Algiers, he soon recommended recall of Lamb. Lamb returned to Spain and stayed in Alicante on the southeastern coast of Spain.

Somehow Carmichael no longer complain of lack of code and attributed his silence on sensitive topics to the attitude of Jefferson's own silence (15 July 1786).

To this, Jefferson only wrote that he was not yet sure if Carmichael received the code from Barclay.

You observe that I do not write to you on foreign subjects. My reason has been that our letters are often opened; and I do not know that you have yet received the cypher Mr. Barclay was to leave with you. If you have not, be so good as to ask a copy of his, which being already in the hands of Mr. Jay, Mr. Adams, and myself, will enable you to write in cypher to any of us. Indeed I wish you could get the one from Mr. Lamb, which is a copy.
Jefferson to Carmichael, 22 August 1786

Acting upon this, Carmichael turned to Lamb, "expressing a wish ... of having the original of the paper in question to be sent to me by a safe conveyance". This resulted in no success.

That Gentleman thinks without a peremptory order, he ought not send it.
Carmichael to Jefferson, 29 September 1786

In contrast with Lamb's failure, Barclay was successful in Morocco. Barclay sent his secretary, Colonel David Franks, ahead with treaty documents. Barclay himself reached Madrid in early November 1786. Thus, finally, Colonel Franks brought the code to Carmichael (see the note of PTJ on p.177, which provides detailed analysis of the proceedings).

Somehow, however, Carmichael did not use the code until almost a year later. Nor did he mention that now he possessed of the code he had so wanted. Thus, Jefferson felt Lamb needed a push from him.

I send, also, a note desiring Mr. Lamb to deliver you his cypher, and a copy of a letter from the Minister of Finance here to me announcing several ...
Jefferson to Carmichael, 26 December 1786

Lamb, now formally recalled by Congress, refused to hand over the code.

I received your Excellency's letter concerning the cypher. The vessel I am in here is bound to America, and does not take practique; and all papers are so defaced with vinegar that it will be impossible to get the cypher sound to hands where it is ordered; therefore I must deliver the same to Congress, who can dispose of it at their pleasure.
Lamb to Jefferson, 20 May 1787

Carmichael's silence and Lamb's intransigence induced Jefferson to broach the subject to Carmichael again. (The PTJ Editors conjecture that Jefferson may have learned from Barclay that Carmichael had received a copy from Franks (PTJ p.178).)

Have you yet the cypher of which I formerly wrote to you, or any copy of it?
Jefferson to Carmichael, 14 June 1787

Only on receiving this, Carmichael admitted his possession of the code he received from Colonel Franks, albeit in an impassive tone.

I have the cypher you mention & you may make use of it when you think proper. By your manner of employing it I shall judge of what I ought to do.
Jefferson to Carmichael, 9 July 1787

Thus, more than two years after Jefferson decided to send Carmichael a code, he could use the code in his letter of on 25 September 1787. However, this was not the end of the story. Carmichael could not decipher Jefferson's letter with the code in his hands!


Carmichael reported the problem to Jefferson.

I am afraid there is some mistake with respect to the manner you imploy to express yourself confidentially to me. Please to examine whether you have made use of the same characters as those which you intrusted to Mr Barclay. With all my indeavours your meaning is unintelligible.
Carmichael to Jefferson, 15 October 1787

In order to allow Carmichael to verify the code, Jefferson encoded three lines from his past letter.

I am very sorry you have not been able to make out the cypher of my letter of September the 25th, because it contained things which I wished you to know at this time. They have lost now a part of their merit; but still I wish you could decypher them, as there remains a part which it yet might be agreeable to you to understand. I have examined the cypher from which it was written. It is precisely a copy of those given to Messrs. Barclay and Lamb.
In order that you may examine whether yours correspond, I will now translate into cypher the three first lines of my letter of June the 14.
'1420 1250 1194 1307 1531 458 48 1200 134 1140 1469 519 563 1129 1097 1201 1199 1531 1571 1040+ 870 423 1001 855 521 1173 917 1559 505 1196 51 1152 698 141 1569 996 861 804 1337x 1199'
This will serve to shew whether your cypher corresponds with mine, as well as my manner of using it. But I shall not use it in future till I know from you the result of your reexamination of it.
Jefferson to Carmichael, 15 December 1787

Though Carmichael received this letter on the 26th of December, Carmichael spent many weeks working on the cipher and it was only in next April that he responded to this.

I have endeavoured in vain to decypher by means of the cypher which Mr. Barclay left with me the three first lines of your letter of the 14th June 1787. Nor have my efforts been more successful in my attempts to decypher that of Sep. 25th altho' I have tryed every method perscribed for that effect.
I therefore take it for granted that Colonel Franks must have made some mistake in the delivery of the cypher. In the course of this I will merely for the sake of conviction employ some phrases of my cypher of which you may divine the sense, should not our cyphers correspond as I really am persuaded they do not.
It is a vexatious circumstance for me, as it has not only deprived me of your sentiments and information but occupied uselessly some hours almost every day for several weeks in endeavours to break the shell that I might enjoy the kernel.
Carmichael to Jefferson, 14 April 1788

As Carmichael explained himself, he only made some trivial use of the code, including 223 [Massachusetts], 278 [majority], and 597 [you]. (Readings in brackets are conjectures by PTJ.)

Jefferson confirmed that Carmichael was right in saying their codes "do not correspond" in his letter of 3 June (see below). PTJ designation Code No. 11 is reserved for the original Adams-TJ-Barclay-Lamb code, while the wrong version is given Code No.13.

Code in Use

Meanwhile, Jefferson had sent Carmichael a new copy of the code.

I have a moment's warning only of the departure of Mr. Symonds for Madrid, which place however he will not reach till the month of April, which is another reason for my making this letter merely the vehicle for a cypher which I can answer for in point of correspondence with mine.
Jefferson to Carmichael, 1 February 1788

At last, Carmichael could use the code substantially in his letter of 8 May 1788.

Mr Syomond delivered me on the 3d instant your[s] of the 1st of Feb. The cypher inclosed in that letter has enabled me to profit altho' late of information: I shall in[close] the one left with [me] by Mr. Barclay & Mr. Franks & trust [mine] to the care of Mr. Symond, in order that you may have it in your power by seeing the paper to discover the reason of this extraordinary mistake. I regret exceedingly that this circumstance should have so long interrupted an intercourse which would have been both agreable & useful to me. I have no advice of 1237 1509 950 1509 694 861 America for many months. 1077 1097: The Pacquet brought me ....
Carmichael to Jefferson, 8 May 1788

Ten days later, Carmichael would entrust with the bearer from Jefferson the code that he received from Franks, now of no use.

Agreable to what I had the honor to mention you in a late Letter I now inclose you the Cypher delivered me by Colonel Franks. Mr. Symons will put it into your Exys hands.
Carmichael to Jefferson, 18 May 1788

Even with the new copy of the code, however, it was not without trouble. In the above quotation of Carmichael's letter of 8 May, the passages in italics were written in code and interlinearly decoded by Jefferson, with some minor modifications by the PTJ editors (shown in brackets [ ]). The code numbers left undecoded in the above quotation require some explanation.

For the sequence 1077 1097, Jefferson wrote plaintext "never :", which does not fit the context. Carmichael may have failed to delete 1077, an error for 1097, and simply meant ":".(PTJ)

The sequence "1237 1509 950 1509 694 861" also resulted in a garbled decoding: "an ral fical ral owl e" (This transcription is taken from PTJ). Jefferson tried possible corrections for the written codes, such as "1508 of" for "1509 ral" but could not solve the puzzle by himself.

The cyphered words in your letter of Apr. 14 prove to me that Mr. Barclay left you a wrong cypher.
In those of May 8. taken from the cypher I sent you, are several things which I cannot make out. From an expression in your letter I suppose some of these to have been intended, others I ascribe to the equivocal hand writing in the cypher, which I believe was by one of Mr. Barclay's clerks. I cannot always distinguish the letter e from o, n from u, t from f and sometimes from s. I observe you use repeatedly 1360 instead of 1363 which I presume to be an error of the copyist to be corrected in your cypher. I cite the following passage, drawing lines under the numbers I do not understand.
'1001. 739. 1264. 1010. 1401. 1508. 1237. 1509. 950. 1509. 694. 861. 221. 742. 658. 233. 1017. 1077. 1097.'
and I do it that we may come to a perfect understanding of our cypher. The separating the numbers by a dot, as above, would add a facility to the decyphering of yours.
Jefferson to Carmichael, 3 June 1788

At least, Jefferson could feel sufficiently sure to use the code in some subsequent portions of this letter. (Carmichael also started to regularly use the cipher (e.g., 29 May, 5 June).)

In responding to this, Carmichael did not give the decoding Jefferson asked for, which is given by PTJ as: "I have no advice of an official nature [from] America for many months."

Ere this you will have received from Mr. Symonds the Cypher left with me by Mr. Barclay. In the one you sent me I have equal difficulty to distinguish the Letters you mention. I find that 1360 instead of 1363 has been appropriated to the signification of the latter. I have corrected this error so that I hope we shall soon come to a perfect good understanding.
Carmichael to Jefferson, 24 July 1788

It is interesting to note that this letter, which employed the code now shared with Jefferson, includes a null use of the code. There appears at one point a code sequence 707. 1555. 959. 1371. 1611. Jefferson correctly decoded this as "4. yet 8. Tunis Mr. Barclay." This sequence, apparently carrying no information in the context, may have been inserted for distraction. Carmichael occasionally made such use of a code (PTJ).

In October 1789, after five years' activities in Europe, Jefferson sailed for America and, in March next, he was sworn in as Secretary of State of the Washington administration under the new Constitution. Jefferson continued to use this code in writing to Carmichael (11 April 1791).

©2009 S.Tomokiyo
First posted on 8 March 2009. Last modified on 1 September 2015.
Articles on Historical Cryptography
inserted by FC2 system