Red and Blue: First Official Codebooks Adapted for Telegraphy

Red Code (Red Cipher) of 1876 (WE108)

In 1876, a new codebook for use by the Department of State, The Cipher of the Department of State, known as the Red Code (Red Cipher) from the color of its cover, was issued. The designer, John H. Haswell, had been a temporary clerk when he did the encoding of the first coded cable message of the US Department of State in 1866 (see another article) and had been appointed chief of the newly organized Bureau of Indexes and Archives of the Department of State in 1873. Several schemes tried after the introduction of trans-Atlantic cable had resulted in much confusion (see another article), which induced Haswell to develop a prototype of the code as early as July 1873 (Weber1993 p.192-193, p.196 n.13). The new code formed the basis of several official codebooks in the following decades such as Blue Code (1899), Green Code (1910), Gray Code (1918), and Brown Code (1938).

Structure of Code

The Red Code ran nearly 1200 pages, by far larger than any of its predecessors in vocabulary. Each of the alphabetically arranged plaintext words/phrases was assigned a code word and a number. The code words consisted of ordinary words rather than artificial sequences of letters as in the code of 1867. This provided some error resiliency because a few transmission errors might be corrected by a human reader. The code numbers consisted of page and line numbers. For example, the word "President" may be encoded with either a code word "Plant" or a number "44384" (from page 443, line 84) (Weber1993 p.202). Use of code numbers was now allowed by the decision of the telegraph companies to consider a combination of 5 digits as the equivalent of one word (Weber p.241). When the trans-Atlantic cable came into operation back in 1866, figures had had to be written (and charged) as words.

The huge vocabulary included not only words but also frequently used phrases. For example, a phrase "enter a protest" is found under the word "protest" and is assigned a code word "Precursors" and a code number "45202" and a phrase "proposed by the" is assigned "Pater" and "45082". Encoding a phrase consisting of several words into a single code word or code number could achieve significant reduction of cable cost.

All these new features --the huge vocabulary, dual representation with either a code word or a code number, use of ordinary words as code words, entry of not only words but also phrases and sentences -- were typical features adopted by commercial codes (e.g., Bolton's Telegraph Code (1871)).

Polyalphabetic Substitution

As with the 1867 code, words/names not in the code had to be enciphered letter by letter. But while the 1867 code used a simple substitution cipher, the Red Code specified a polyalphabetic substitution scheme, not unlike those used after the 1867 code (see another article). The codebook included three sets of ten mixed alphabets numbered 0, 1, 2, ..., 9. Correspondents should agree on a key number beforehand. (A later modification specified that the key number may be the first code number, or the number corresponding to the first code word, in the message.) If the key number was 20736, the first letter was enciphered with the mixed alphabet numbered "2", the second letter with that numbered "0", the third letter with that numbered "7", and so on. The sixth letter reverts to the number "2" but the mixed alphabet numbered "2" in the second set of mixed alphabets should be used. (Weber p.243)

Security Measures

Unlike published commercial codebooks, the Red Code was for exclusive use by the Department of State. Secretary of State Fish required that every copy of the codebook be numbered and each person assigned a copy be held responsible for its security and return (Weber1993 p.205). In comparison, when the 1867 code was issued, Secretary of State Seward only asked that the code be used with discretion and that the minister should have a small box made that could be fastened with a lock, the key to which should be kept by the head of the legation (Weber1993 p.136). The new security measures appear to be part of upgraded diplomatic security adopted by Fish (History of the Bureau p.xxiii).

Apparently, Fish also recognized that keeping encoded despatches with their translation in the archives might give clue to the code to those who should not have access to the codebook, for the record group of despatches from ministers overseas in the National Archives includes "translation of cipher telegrams" but very few encoded material after 1876 (Weber p.253).

Indeed, Haswell made a point of economy in the introduction of the codebook rather than secrecy (Weber1993 p.203; cf. p.193). The one-part form (both the plaintext and code words are arranged alphabetically and thus a single book serves for both encoding and decoding) was less suited for secrecy than two-part form (correspondence between the plaintext and code words is random). Later, one code clerk who handled a similar code in 1918 deprecatingly recollected (rather exaggeratingly) that the plaintext words and the code words parallelled so closely that occasionally a code word was too similar to its plaintext counterpart (Weber1993 p.206, Kahn p.491). Requirement of economy in the telegraph age replaced a small, two-part code with a large, one-part code, whose security rested solely on the size of the vocabulary (Kahn p.190).


The following is one of the few specimens preserved in encoded form.

In interviews with our 12557 (ambassador) 30868 (to France) page nine column three todays 33339 (Herald) Taylor has just cabled that the whole 38413 (Madrid) Press bitterly denounces this alleged interview and demands disavowal Taylor says that this incident gravely 44231 (prejudices) Mora negotiations which were 11269 (advancing) most 48632 (satisfactorily) and adds that a few 37101 (kind) 57006 (words) 57357 (from you) all important at this moment Later Taylor telegraphs 37380 (minister of state) 14956 (asks you) to 26044 (disavow) 21643 (conduct) of 12557 (ambassador).
(Rewick to Richard Olney, Secretary of State, Washington, 9 July 1895; quoted in Weber p.244)

No doubt such partial encoding along with the one-part nature of the code helped codebreakers significantly.

Measures for Secrecy

Secrecy was by no means forgotten. Several months after the codebook was printed, Haswell prepared Holocryptic Code, An Appendix to the Cypher of the Department of State, which prescribed fifty rules for enhancing security (Weber1993 p.203-205). The rules included various route transpositions of code words, addition of a specific number to code numbers, and miscellaneous other methods and were specified by words (termed indicators) such as "Ape", "Ass", "Dam", "Deer", "Moie", "Pony", "Stag", "Tapir", "Tiger", "Wolf", and "Zebra".

The route transposition provides for writing code words in separate columns in a specific order in a specific direction (e.g., first writing down the second column and then down the first column, according to Rule 1 "Ape") and then reading code words as ordinary text (i.e., row by row, from left to right). There were two rules using two columns, sixteen using three columns, and another sixteen using four columns.

There were twelve rules using addition, with the number added varied from 33 ("Moie") to 322 ("Stag"). When code words rather than code numbers should be used, the code word corresponding to the resulting code number may be transmitted.

Two of the miscellaneous class provide for simple transposition of code words: exchanging the first and second, third and fourth, etc. ("Tapir") and transmitting the code words in reverse order ("Tiger"). A third ("Wolf") call for letting the first two figures represent the line and the last three the page, as opposed to the usual "page-line" order. The fiftieth "Zebra" does not use any such methods and simply transmits the code words or numbers found in the codebook.

Similar provisions for secrecy are also seen in published commercial codes. Bloomer's Commercial Cryptograph: A Telegraph Code and Double Index-holocryptic Cipher (San Francisco, 1874) provides for addition/deduction of numbers (whereby it is proposed to transmit a code word corresponding to the augmented number rather than the new code number itself and use of code numbers is contemplated only for indexing and on post cards), transposition of words, etc. The book even anticipated the use of the word "holocryptic" (literally, "completely concealing"), the term reserved for a specific technique of adding different numbers to successive code words -- an idea similar to a Vernam cipher or a stream cipher today.


A possibility of the code being known to the Spanish emerged in March 1898. The Department made sure that the minister in Madrid had "the printed holocryptic Appendix to the cipher code" but soon the minister had to leave for Paris because of the Spanish-American War (April-August 1898) (Weber1993 p.208). (This episode shows that use of the holocryptic appendix was not mandated for encoding despatches which were supposed to be secret.)

Just a few months before this, John Haswell, the designer of the Red Code now in retirement since 1894, wrote to the Secretary of State to express concern about security of the Red Code, which had been in use for almost twenty-five years, and offered to prepare a new codebook. It was on 24 March 1898 that his offer was accepted by the Secretary of State (Weber1993 p.215).

Designer's Self-Evaluation

Some time after "the middle of the eighties" (possibly in the years after retirement), Haswell wrote an essay "Secret Writing: The Ciphers of the Ancients, and Some of Those in Modern Use", which would be published posthumously in a magazine in 1912. He boasted of the State Department code, without mentioning his authorship.

The cipher of the Department of State is the most modern of all in the service of the Government. It embraces the valuable features of its predecessors and the merits of the latest inventions. Being used for every species of diplomatic correspondence, it is necessarily copious and unrestricted in its capabilities, but at the same time it is economic in its terms of expression. It is simple and speedy in its operation, but so ingenious as to secure absolute secrecy.

Indeed, the Red Code not only adopted features of latest commercial codebooks but also polyalphabetic substitution and route transposition learned in the early 1870s (see another article).

Blue Code (Blue Cipher) of 1899 (WE109)

Haswell submitted a new codebook within a year (Weber1993 p.216) and the first copy of the Blue Code was despatched in May 1899 (Weber1993 p.222).

Structure of Code

The updated codebook, again titled The Cipher of the Department of State and known as the Blue Code of 1899 from the color of its cover, was expanded to 1500 pages (from 1200 of the Red Code). In structure, it was similar to the Red Code of 1876: it was a one-part code and assigned both a code word and a code number to a plaintext word or phrase. Thus, the plaintext "and" was either represented as "Bedstaff" or "14804" and "the" was either represented as "smooth" or "67108."

A polyalphabetic substitution cipher, similar to that of the Red Code, was also provided to encipher words and names not found in the code.

As with the Red Code, a holocryptic code appendix was issued. It prescribed as many as seventy-five rules including various route transpositions of code words, addition of a specific number to code numbers, subtraction of a specific number from code numbers, and miscellaneous other methods. Subtraction was a feature not used for the Red Code.

In September 1900 (Haswell had died in November 1899), a system for encoding the time and date of the telegram in five letters was introduced. The first letter represents the month, the second and the third the day, the fourth the hour, and the fifth forenoon/afternoon. Thus, "7 P.M. 3 September" was encoded into one code word "JOCGP". (Weber1993 p.222)

Code Numbers vs. Code Words

In the instructions of the codebook, Haswell recommended use of code words rather than code numbers: "it seems advisable that the economical advantages offered by the Code Word system be availed of, and its use in preference to the use of the figure system is therefore recommended." (Weber1993 p.217) Haswell explained that the International Telegraphic Conference in Paris (in 1890) had determined (or, more accurately, maintained) that 10 letters (for code words) or 4 figures (actually, 3 figures) would be regarded as one word (for outside Europe), which meant each five-figure code of the Blue Code would be counted as two words. (The United States was not a party to the International Telegraph Convention but the regulations were applied to exchanges with contracting states.) Haswell appears to have been unaware that the Conference in Budapest in 1896 (after his retirement) reverted to 5 figures as one word. Sometime later, a revised instruction was added to the codebook to the effect that because of telegraph tariff revisions, there was now no added expense in transmitting five-figure code numbers (Weber1993 p.220). Thus, again, code numbers, which could be more readily recognized worldwide, were preferred over code words.

A cable message from an American ambassador to Italy of 19 January 1904 encoded 54 words (apart from two unencoded names "Tittoni" and "Meyer") with 42 code numbers and one code word (Weber p.246).

Compromise and Replacement

Unfortunately, the codebook was stolen in St. Petersburg in mid-1905. In June 1907, the copy in the US legation in Rumania disappeared and the Japanese Ministry of Foreign Affairs alerted the US government about an attempt to sell photographs of the copy (Nickles p.170).

Thus, it gave way to the next Green Code (Green Cipher) of 1910 (WE110). Again, this codebook represents a plaintext word or phrase with a code word or a code number. Now, however, the code words were artificial words systematically formed by combining consonants and vowels such as babba, babca, babda, babfa, babga, ..., babab, babac, babad, babaf, babag, .... Since a 10-letter group was counted as one word, two five-letter code words were to be merged into one code group of ten letters. (Weber p.246) The date/time encoding system was slightly altered (Weber p.247).

President Wilson's Use of Blue Code and Other Later Uses

Old codes were not discarded altogether upon issuance of new codes. In 1912, the State Department sought, unsuccessfully, to use the Blue Code for secret communication among the Departments of State, War, and the Navy (Nickles p.171; Kahn p.489; ASA p.127).

During the early years of World War I, President Wilson and his adviser, Colonel Edward House, used the Blue Code for their private correspondence (Nickles p.171, Weber1993 p.223). This may refer to the one printed in Ray Stannard Baker, Woodrow Wilson, Life and Letters, vol.V (quoted in Army Security Agency [ASA2], (ed.) Wayne G. Barker, The History of Codes and Ciphers in the United States during World War I (1946, 1979), p.69). ("Beverly" for "House" was one of some thirty special code words agreed between them.)

Cablegram from President Wilson to Colonel House, 8 March 1915
For Beverly. Misspend rosebud Plunkets repulses upsets mightier innerly upstream apogee lamely bedsite slacked joined locates orthoepic impleader jetson presidency truncation contraries spines graduation francs smallness snells burdons rightfully pavo Hoosiers solemnized jitter lowlanders moons nugify growth bedside foddered hopping smiter jaunties blendons adiposity sunk lobar alkalize unpunished Tacoma argol bedsore implead nonpluses Hester truss lobular lignum baby pouched hundreds Benthamite adhesion.
(For House. There is nothing special to report on this side, and you do not need instructions. Your admirable letters and telegrams keep me posted in just the right way. Your cable of today gives me the feeling that there is at least some real hope. This is just a message of personal greeting and to express the hope that the journey you are about to undertake may be accomplished without untoward adventure and in perfect health. You may manage all the rest. I have no anxiety about it.)

By comparison, it can be seen that words/phrases are assigned code words in alphabetical order (of the main word).

code wordsplaintext      code wordsplaintext
adhesion.about itlobarmay be
adiposityabout tolobularyou may
apogeeadmirablelowlandersa message
argoladventuremightierdo not need
babyallMisspendThere is nothing
Benthamiteno anxietyorthoepicposted
blendonsyou arepavoreal
burdonsat leastPlunketsto report
contrariesyour cable ofpouchedthe rest
fodderedto expresspresidencythe right
francsthe feelingrepulseson this side
graduationgives merightfullysome
hoppingthe hopesmiterthat
hundredsI havesnellsThere is
impleadinsolemnizedThis is
jauntiesthe journeyTacomauntoward
lamelylettersupsetsand you

Baker Vol.VI (quoted in ASA2 p.72-74; the code partially reconstructed p.75) prints Wilson's message to House sent on 11 January 1916, encoded in five-digit code words: 72610 for "adjust(ed)" ... 12726 for "with". The reverse alphabetical assignment indicates this is something different from the Red Code, the Blue Code, or the Green Code, though there remains a possibility that a simple superencipherment by reversal was employed. The typescript begins "CABLE. Amembassy, London. Hagyzkedun - 39608 ...", of which the ten-letter group "Hagyzkedun" appears to indicate date or the like but it is not consistent with the scheme of Blur (Weber1993 p.222) or Green (Weber1979 p.247).

Even when the Green Code (Green Cipher) was issued in 1910 as well as when the Gray Code (Gray Cipher) was issued in 1918, Red or Blue Code were to be used for not so confidential messages such as verbatim messages from officials of a foreign government (Weber p.247, 248).

Elongated use of such obsoleted codes symbolizes the "puny" state of American cryptology from before World War I to the middle of World War II (Kahn p.488).


Ralph E. Weber (1979), United States Diplomatic Codes and Ciphers, 1775-1938

Ralph E. Weber (1992), "America's First Encrypted Cable", Studies in Intelligence Vol. 36 No. 5 (PDF); cited as "Weber1992" here.

Ralph E. Weber (1993), "Masked Dispatches: Cryptograms and Cryptology in American History, 1775-1900" (PDF, accessed in August 2013; as of March 2014, it is updated to a 2013 "third edition"); cited as "Weber1993" here.

United States Department of State, Bureau of Diplomatic Security (2011), History of the Bureau of Diplomatic Security of the United States Department of State (online, Introduction (PDF))

David Paull Nickles (2003), Under the Wire: How the Telegraph Changed Diplomacy

John H. Haswell (1912), "Secret Writing: The Ciphers of the Ancients, and Some of Those in Modern Use", The Century Illustrated Monthly Magazine, p.83-92 (Internet Archive) (The article appeared in the November 1912 issue (Weber1993 p.143, n.36).)

©2013 S.Tomokiyo
First posted on 2 August 2013. Last modified on 6 March 2016.
Articles on Historical Cryptography
inserted by FC2 system