Lovell's Cipher

Lovell's cipher, advocated by James Lovell of the Committee of Foreign Affairs, is one of many codes and ciphers used during the American Revolutionary War. It was a polyalphabetic cipher in which the same letter in the plaintext may result in different letters in the ciphertext. This provides more security than a simple monoalphabetic substitution cipher. As it turned out, however, Lovell's cipher is notorious for invariably confusing his correspondents.

Basics of Lovell's Cipher

Construction of Cipher Table from Keyword

In Lovell's cipher, correspondents first form a cipher table from an agreed keyword. First, numbers 1-27 are written in a vertical column. Then, the 27 letters of the alphabet (a-z and &), beginning with the first letter of the keyword, are written in a vertical column next to the number column. Next to this first alphabet column, the letters of the alphabet are written in a second alphabet column, this time beginning with the second letter of the keyword. Thus, as many columns as the number of letters in a keyword are written.

The following example shows a cipher table for a keyword "CR". This is the keyword assigned to John Adams. (For convenience, the columns are written horizontally here.)

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
R S T U V W X Y Z & A B C D E F G H I J K L M N O P Q

Enciphering with Lovell's Cipher

In enciphering, the C column and the R column are alternately used.

Let us, for example, encipher "disputed". In enciphering the first letter "d", one looks into the C column, which tells that "d" corresponds to "2". The next letter "i" is enciphered with the "R" column into "19". In this way, the subsequent letters are enciphered by switching the columns for each letter. The resulting ciphertext is 2(d) 19(i) 17(s) 26(p) 19(u) 3(t) 3(e) 14(d) (the bold face letters are enciphered with the C column and the rest with the R column).

It can be seen that the letter "d" is enciphered as "2" in the first instance but "14" in the second. On the other hand, the same ciphertext figure "3" represents "t" and "e" and, similarly, the figure "19" represents "i" and "u". This polyalphabetic feature of Lovell's cipher makes codebreaking difficult.

Deciphering with Lovell's Cipher

In order to decipher the ciphertext "2 19 17 26 19 3 3 14", the recipient of the message uses the same cipher table as above. To decipher the first letter "2", the C column is used to give "d". To decipher the next letter "19", the R column is used to give "i". The following chart illustrates how the two columns are alternately used.

                2 19 17 26 19  3  3 14
C column gives: D  U  S  A  U  E  E  P
R column gives: S  I  G  P  I  T  T  D

Difficulty with Lovell's Cipher and its Solution

When enciphering or deciphering with Lovell's cipher, one easily loses track of which column should be used next. Indeed, the ciphertext enciphered with Lovell's cipher very often includes enciphering errors by use of a wrong column. This caused much confusion, since one such error would make all the subsequent letters garbled.

In the above example, suppose the third letter of "disputed" is incorrectly enciphered with the R column instead of the C column and the switching rule is observed thereafter, the ciphertext would be "2 19 2 14 4 18 15 2". If this ciphertext is deciphered with strict observation of the switching rule, the plaintext would be a garble: "diddfhqs".

                2 19  2 14  4 18 15  2
C column gives: D  U  D  P  F  T  Q  D
R column gives: S  I  S  D  U  H  E  S

Human errors cannot be completely eliminated. What is required is a scheme in which one error does not corrupt all. There is a practical solution to solve this problem of Lovell's cipher. Again, in the above example, the recipient may write, under each figure in the ciphertext, two corresponding letters from the cipher table one on top of the other, without bothering about which column should be used for which figure.

                2 19  2 14  4 18 15  2
C column gives: D  U  D  P  F  T  Q  D
R column gives: S  I  S  D  U  H  E  S

After making up a chart as above, the plaintext may be identified by inspection. Even if the encipherer used the wrong column, there will be always an alternative candidate for the figure at hand. Abigail Adams probably learned this technique from her brother-in-law Richard Cranch and conveyed to her husband in June 1782 (see another article).


One advantage of Lovell's cipher is that the cipher table need not to be sent. Only a keyword need to be sent for the recipient to construct the cipher table. A keyword may be conveyed relatively safely by use of some private information known only to the recipient. For example, the keyword "CR" of the above example was conveyed to Adams as the first two letters of the surname of the family where Adams and Lovell spent the evening together before they set out for Baltimore.

Thus, it is relatively easy to change the keyword or to use different keywords with different correspondents.

In this regard, one may make use of a complete alphabet square as follows.


Once this complete alphabet square is formed, the same square can be used for any keyword. In the above, the C column and the R column are highlighted but columns for any keyword can be found in this table.

James Lovell

James Lovell (1737-1814) taught at Latin school in Boston when the Revolutionary War broke out on 19 April 1775. On this day, the school was closed by the British authority. On 17 June, Lovell watched from the flat roofs the Battle of Bunker Hill that was fought just across the Charles River. In the battle, Lovell's friend Joseph Warren was killed and Lovell's letter providing accurate estimates of British troop strength in Boston was found from his body. Lovell was arrested for spying. When the British and loyalists evacuated Boston in March 1776, Lovell was transported to Halifax.

In November 1776, Lovell was exchanged for Colonel Philip Skene and came back to Boston. He was appointed as delegate from Massachusetts to the Continental Congress. When Lovell accepted the appointment, the American cause was at the lowest ebb. George Washington's army was defeated in New York and fleeing down the New Jersey plains from the pursuit of the British army. Even Philadelphia was threatened and the Continental Congress moved to Baltimore in December 1776. Only on 26 December, Washington struck back and put a stop to his flight by a victory of Trenton.

Lovell set out for Baltimore, with his friend and colleague John Adams, in January 1777 and took seat in Congress in February 1777. He would serve in Congress until April 1782.

Congress returned to Philadelphia in March 1777 and in May, Lovell joined the Committee for Foreign Affairs, reconstituted from the former Committee of Secret Correspondence. Apparently, at first, translation of papers from French into English and sometimes from English into French was Lovell's principal assignment. There were few in Congress who had the command of French. Further, Lovell took on deciphering letters from Dumas (see another article for Dumas' cipher).

In September 1777, the threat from the British army again made Congress move, this time, to York.

In October 1777, Americans gained an important victory in the north when the whole British army under General Burgoyne surrendered to Horatio Gates. In the same year, Commander-in-Chief George Washington lost two battles in September (Battle of Brandywine) and October (Battle of Germantown) and allowed British occupation of Philadelphia. Lovell was probably the most outspoken of the delegates who criticized Washington (see Letters of Delegates).

Removal to York brought change to Lovell's position in the Committee for Foreign Affairs. Until then, the Committee had four active members and Lovell's signature appeared last in the letters sent out by the Committee. From the end of October 1777, Richard Henry Lee and Lovell were the principal members. Then, Lee left Congress in December. From 1778, though occasionally joined by Richard Henry Lee, Robert Morris, or John Witherspoon, Lovell often found himself the only active member of the committee. After Lovell joined the Committee, Lovell was the only member of the Committee to serve without break until its dissolution.

It was recognized that a more permanent system was required. In January 1781, the Congress agreed to replace the Committee for Foreign Affairs with a department under a Secretary of Foreign Affairs and in August 1781, Robert R. Livingston was appointed as the first Secretary of Foreign Affairs. When he took office in October, he took over Lovell's task of corresponding with ministers residing in foreign countries. (See another article.)

In the last months in the Committee for Foreign Affairs, Lovell achieved codebreaking of British correspondence. (See another article.)

As it happened, inauguration of Livingston coincided with the victory of Yorktown in October 1781. Lovell left Congress in April 1782.

Reference: Helen Jones, James Lovell in the Continental Congress 1777-1782 (dissertation).

Use of Lovell's Cipher


Lovell said he gained this cipher "by accident" when he first conveyed it to Franklin in Paris in 1777, probably soon after he joined the Committee for Foreign Affairs. In that letter, he included a specimen with a sample keyword CHARDON (see another article).

Next spring, when a cipher was requested from William Lee in Paris, the Committee for Foreign Affairs recommended Lovell's cipher under the signatures of R. H. Lee, James Lovell, and Robert Morris.

As you seem to think it may be advantageous to have a cypher for correspondence, we would propose the same which has been mentioned to Dr Franklin formerly by Mr. Lovell, and this is the rather chosen, because it may serve between the doctor and you or any number of your friends, taking a different key-word for each.
Committee for Foreign Affairs to William Lee, 14 May 1778

Horatio Gates

In March 1779, Lovell wanted to start using the cipher with a keyword JAMES in his correspondence with Horatio Gates because of interceptions of earlier letters. Gates, victor of Saratoga, was then in Boston and at command of the Northern Department.

I wish I had a Mode of conveying to you some Things in Cyphers. I am most cruelly pinched for Time now but will speedily write again. Ask Doctr. Joseph Gardner one of my best earthly Friends to let your Clerk copy an Alphabet which he had from me, and which a thousand Persons may use with a thousand different Key-Words. If he has lost the Paper he will describe it so to you that you may make one. The figure from 1 to 27 denominate each & every letter of the Alphabet. It is a little tedious in its usages, but is perfectly inscrutable by the art of man if managed with a little art in the placing figures for the particles as well as your secret Substantives.
Lovell to Horatio Gates, 1 March 1779

Lovell trusted that Gates will learn the cipher from Doctor Gardner and used the JAMES cipher in the subsequent portion of the letter. But apparently, Gates could not obtain explanation from Doctor Gardner and Lovell had to explain his ciphered message in a roundabout way (Lovell to Horatio Gates, 13 April 1779) and the JAMES cipher with Gates was abandoned.

John Adams, Benjamin Franklin, Henry Laurens, John Jay, William Palfrey

In early 1780, Lovell was told of concern from Luzerne, French minister at Philadelphia.

The Chevalr. De la Luzerne expressed to me an Anxiety because we do not correspond by Cypher. I early communicated to you from Baltimore a very good one, tho' a little tedious like that of Mr. Dumas. I inclose you a Sample at this Time.
Lovell to Franklin, 24 February 1780

On 4 May 1780, Lovell used the cipher with keyword COR in his letter to Franklin in Paris (see another article). On the same day, he conveyed the cipher with a hint of keyword CR in his letter to John Adams in Paris (see another article). But Lovell's cipher was a puzzle for both.

In the fall of 1779, Congress had appointed Henry Laurens as minister to Holland and John Jay as minister to Spain. Jay had arrived in Spain in January 1780 but Laurens would sail only in August 1780. Laurens was assigned keyword YO and Jay was assigned keyword BY.

William Palfrey, who was to be the first American consul in France and to bring a new cipher (probably a code with some 600 elements; see here) to Jay in Spain but was lost at sea in December 1780, was assigned keyword UNT.

Keywords JOHN, FOR

Papers of Continental Congress includes a sheet which shows cipher tables for keywords JOHN and FOR (see PCC). A ciphertext with keyword FOR of the instructions to peace commissioners John Adams, Benjamin Franklin, John Jay, Henry Laurens, and Thomas Jefferson is also found in PCC.

Francis Dana

To Francis Dana in Paris, about to be sent to Russia, Lovell assigned keyword BRA in his letter of 6 January 1781. Lovell's explanation of the keyword was "the 3 first Letters of the name of that family in Charlestown, whose Nephew rode in Company with you from this City to Boston". (See another article#dana.)

Elbridge Gerry

In June 1781, Lovell assigned a keyword EO to Elbridge Gerry, his former colleague as a delegate from Massachusetts. He made it a point of having confidential letters ready so as not to lose opportunities when a safe bearer is at hand. But he could not lose time to report the recent movement under the pressure from the French minister at Philadelphia that would change the nature of commission of John Adams to negotiate a peace treaty (see another article).

I think I gave you some Time ago the same Advice as to my Family[,] vizt - to keep confidential ready written till a private hand offers that you may not lose such Opportunities, now, more than ever, necessary.
My Impatience, however, to communicate some Hints to you will induce me to use Cyphers before this Post sets off. You will readily understand them by making a Column of Figures from 1 to 27 and place two other Columns of Letters by the side of it; the 1st of them beginning with the 2d Letter and the 2d of them beginning with the 3d Letter of the maiden Name of the Wife of that Gentleman from whom I sent you a Little Money on a Lottery Score. Look alternately into these Columns against my Figures and you will have proper Letters for Words. The Number, and natural Sequence of the Alphabet is
1 a 10 j 19 s
2 b 11 k 20 t
3 c 12 1 21 u
4 d 13 m 22 v
5 e 14 n 23 w
6 f 15 o 24 x
7 g 16 p 25 y
8 h 17 q 26 z
9 i 18 r 27 &
Lovell to Elbridge Gerry, 5 June 1781

James Madison and Edmund Randolph

In 1782, Edmund Randolph, a former delegate to Continental Congress and Attorney General of Virginia, felt he needed a private cipher for his correspondence with James Madison, a delegate from Virginia. At the time, they used an official cipher of Virginia (a code of some 850 elements) but it would not provide secrecy from a person having access to the official cipher. Thus, Randolph proposed to use the cipher which they had been taught by Lovell. Randolph's hint for the keyword CUPID was "the name of the negro boy, who used to wait on our common friend Mr. Jas. Madison [Sr.]." (See another article.)

Thomas Jefferson and William Short

In 1784, Thomas Jefferson used a Lovell-style cipher with keyword NICHOLAS. (See another article.)

Variations of Lovell's cipher

There are other polyalphabetic ciphers with keywords, which might be considered as variations of Lovell's cipher.

XZA (WE034, Livingston-Jay)

Manuscript source: PCC Roll 72, Page 139, Jay Papers ID 7596

In August 1780, Robert R. Livingston, newly appointed as the first Secretary of Foreign Affairs on 10 August, sent John Jay in Spain a polyalphabetic cipher with a keyword XZA. The cipher table includes three columns corresponding to the three letters of the keyword as follows (columns and rows are inverted):

  a b c d e f g h i  k  l  m  n  o  p  q  r  s  t  u  v  w  x  y
x 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
z 4 5 6 1 2 3 7 8 9 10 11 12 13 14 15 17 16 19 20 18 22 24 21 23
a 6 3 4 5 1 2 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24

As with Lovell's cipher, three different columns are alternately used for every letter enciphered. On the other hand, the sequence of numbers is irregular in the second and third columns. Theoretically, this makes codebreaking more difficult (though, for this particular case, polyalphabeticity is lost for the letters g-p).

In this cipher, the keyword "xza" plays no role. It was supposed to be used to track the column to be used by marking every letter to be enciphered or deciphered "x, z, a, x, z, a, ...." However, Jay immediately noticed that the keyword was not required either in enciphering or deciphering and mere numbers 1-2-3 could be a perfect substitutes for x-z-a.

In another respect, one advantage of Lovell's cipher is lost. That is, in Lovell's cipher, the cipher table need not to be sent and the correspondents can readily form it from the keyword. In the XZA cipher, since the number sequence is irregular, the cipher table need to be sent.

It is noted that the alphabet does not contain the letter "j", "&" (and somehow "z"), whereas Lovell used a 27-letter alphabet including "&".

In the XZA cipher, 15 codes are assigned to frequently used words. They include "a." for Congress, 92 for Washington, etc.

Anyway, Jay thought the cipher was inspected by the Spanish authority and proposed a YESCA cipher as a replacement.

(See also another article.)

YESCA (WE033, Jay-Livingston)

Manuscript sources: Jay Papers ID 7596 and PCC, Roll 72, Page 141

Jay proposed a YESCA cipher to Livingston in April 1781 to replace the compromised XZA cipher from Livingston. This was a similar polyalphabetic cipher with five columns corresponding to the five letters in the keyword YESCA. It also included a small code using numbers above 26, ranging from 27 (America) to 61 (Rhode Island).

Jay used a regular 26-letter alphabet with "j" and "v" but without "&".

WAR (WE031, Dana-Livingston)

Manuscript source: PCC Roll 117, Page 656 and PCC Roll 134, Page 102 (transcript)

In October 1782, Francis Dana residing in Russia proposed a WAR cipher to Livingston. This was also a similar polyalphabetic cipher with three columns corresponding to the three letters of the keyword WAR. It also included a small code, using numbers above 27, for some eighty words. Thus, "Adams" is enciphered into "30", "61", or "92" and "administration" is enciphered into "31", "62", or "93", and so on.

It is noted that Dana used the same 27-letter alphabet, including "&", as Lovell's cipher.

(See another article.)

WHO (WE030, Dana-Adams)

Manuscript source: Adams Papers

In October 1782, Dana sent another cipher with a keyword WHO for John Adams. It is very similar to the WAR cipher for Livingston.

NOT (WE032)

Manuscript source: PCC Roll 72, Page 137

PCC includes another similar cipher with a keyword NOT. It bears an endorsement "Dana" but unlike Dana's other ciphers, the alphabet includes "&" but not "j" and "v". It includes a small code of some twenty elements that use numbers above 25.

©2009 S.Tomokiyo
First posted on 6 November 2009. Last modified on 22 November 2009.
Articles on Historical Cryptography