Japanese naval codes
The vulnerability of Japanese naval codes and ciphers was crucial to the conduct of World War II, and had an important influence on foreign relations between Japan and the west in the years leading up to the war as well. Every Japanese code was eventually broken, and the intelligence gathered made possible such operations as the victorious American ambush of the Japanese Navy at Midway (JN-25b) and the shooting down of Isoroku Yamamoto in Operation Vengeance.
The Imperial Japanese Navy (IJN) used many codes and ciphers. All of these cryptosystems were known differently by different organizations; the names listed below are those given by Western cryptanalytic operations.
The Red Book code was an IJN code book system used in World War I and after. It was called "Red Book" because the American photographs made of it were bound in red covers. It should not be confused with the RED cipher used by the diplomatic corps.
This code consisted of two books. The first contained the code itself; the second contained an additive cipher which was applied to the codes before transmission, with the starting point for the latter being embedded in the transmitted message. A copy of the code book was obtained in a "black bag" operation on the luggage of a Japanese naval attache in 1923; after three years of work Agnes Driscoll was able to break the additive portion of the code.
Knowledge of the Red Book code helped crack the similarly-constructed Blue Book code.
A cipher machine developed for Japanese naval attaché ciphers, similar to JADE. It was not used extensively, but Vice Admiral Abe, a Japanese representative to an Axis military council, passed considerable information about German deployments in CORAL, intelligence "essential for Allied military decision making in the European Theater."
A cipher machine used by the Imperial Japanese Navy from late 1942 to 1944 and similar to CORAL; see JADE (cypher machine).
A succession of codes used to communicate between Japanese naval installations. These were comparatively easily broken by British codebreakers in Singapore and are believed to have been the source of early indications of imminent naval war preparations.
The Fleet Auxiliary System, derived from the JN-40 merchant-shipping code. Important for information on troop convoys and orders of battle.
An inter-island cipher that provided valuable intelligence, especially when periodic changes to JN-25 temporarily blacked out U.S. decryption. JN-20 exploitation produced the "AF is short of water" message that established the main target of the Japanese Fleet, leading to a decisive U.S. victory at the Battle of Midway in 1942.:p.155
JN-25 is the name given by codebreakers to the main, and most secure, command and control communications scheme used by the IJN during World War II. Named as the 25th Japanese Navy system identified, it was initially given the designation AN-1 as a "research project" rather than a "current decryption" job. The project required reconstructing the meaning of thirty thousand code groups and piecing together thirty thousand random additives.
Introduced from 1 June 1939 to replace Blue (and the most recent descendant of the Red code), it was an enciphered code, producing five-numeral groups for transmission. New code books and super-enciphering books were introduced from time to time, each new version requiring a more or less fresh cryptanalytic attack. John Tiltman with some help from Alan Turing (at GCSB) had "solved" JN25 by 1941, i.e. they knew that it was a five-digit code with a codebook to translate words into five digits and there was a second "additive" book that the sender used to add to the original numbers "But knowing all this didn’t help them read a single message".
By April 1942 JN25 was about 20 percent readable, so codebreakers could read "about one in five words" and traffic analysis was far more useful.  Tiltman had devised a (slow; neither easy nor quick) method of breaking it and had noted that all the numbers in the codebook were divisable by three. "Breaking" rather than "solving" a code involves learning enough code words and indicators so that any given message can be read. 
British, Australian, Dutch and American workers co-operated in attacks on JN-25 well before the Pearl Harbor attack, but because the Japanese Navy was not engaged in significant battle operations before then, there was little traffic available to use as raw material. Before then, IJN discussions and orders could generally travel by routes more secure than broadcast, such as courier or direct delivery by an IJN vessel. Publicly available accounts differ, but the most credible agree that the JN-25 version in use before December 1941 was not more than perhaps 10% broken at the time of the attack, and that primarily in stripping away its super-encipherment. JN-25 traffic increased immensely with the outbreak of naval warfare at the end of 1941 and provided the cryptographic "depth" needed to succeed in substantially breaking the existing and subsequent versions of JN-25.
The American effort was directed from Washington, D.C. by the U.S. Navy's signals intelligence command, OP-20-G; at Pearl Harbor it was centered at the Navy's Combat Intelligence Unit (Station HYPO, also known as COM 14), led by Commander Joseph Rochefort. However in 1942 not every cryptogram was decoded as Japanese traffic was too heavy for the undermanned Combat Intelligence Unit. With the assistance of Station CAST (also known as COM 16, jointly commanded by Lts Rudolph Fabian and John Lietwiler) in the Philippines, and the British Far East Combined Bureau in Singapore, and using a punched card tabulating machine manufactured by International Business Machines, a successful attack was mounted against the 4 December 1941 edition (JN25b). Together they made considerable progress by early 1942. "Cribs" exploited common formalities in Japanese messages, such as "I have the honor to inform your excellency" (see known plaintext attack).
Later versions of JN-25 were introduced: JN-25c from 28 May 1942, deferred from 1 April then 1 May; providing details of the attacks on Midway and Port Moresby. JN-25d was introduced from 1 April 1943 and while the additive had been changed large portions had been recovered two weeks later; and provided details of Yamamoto's plans as used for Operation Vengeance, the shooting-down of his plane.
This was a naval code used by merchant ships (commonly known as the "maru code"), broken in May 1940. 28 May 1941, when the whale factory ship Nisshin Maru No. 2 (1937) visited San Francisco, U.S. Customs Service Agent George Muller and Commander R. P. McCullough of the U.S. Navy's 12th Naval District (responsible for the area) boarded her and seized her codebooks, without informing Office of Naval Intelligence (ONI). Copies were made, clumsily, and the originals returned. The Japanese quickly realized JN-39 was compromised, and replaced it with JN-40.
JN-39 was replaced by JN-40, which was originally believed to be a code super-enciphered with a numerical additive in the same way as JN-25. However, in September 1942, an error by the Japanese gave clues to John MacInnes and Brian Townend, codebreakers at the British FECB, Kilindini. It was a fractionating transposition cipher based on a substitution table of 100 groups of two figures each followed by a columnar transposition. By November 1942, they were able to read all previous traffic and break each message as they received it. Enemy shipping, including troop convoys, was thus trackable, exposing it to Allied attack. Over the next two weeks they broke two more systems, the "previously impenetrable" JN167 and JN152.
The "minor operations code" often contained useful information on minor troop movements.
A simple transposition and substitution cipher used for broadcasting navigation warnings. In 1942 after breaking JN-40 the FECB at Kilindini broke JN-152 and the previously impenetrable JN-167, another merchant shipping cypher.
A merchant-shipping cipher (see JN-152).
Chicago Tribune incident
In June 1942 the Chicago Tribune, run by isolationist Col. Robert R. McCormick, published an article implying that the United States had broken the Japanese codes, saying the U.S. Navy knew in advance about the Japanese attack on Midway Island, and published dispositions of the Japanese invasion fleet. The executive officer of Lexington, Commander Morton T. Seligman (who was transferred to shore duties), had shown Nimitz's executive order to reporter Stanley Johnston.
The government at first wanted to prosecute the Tribune under the Espionage Act of 1917. For various reasons, including the desire not to bring more attention to the article and because the Esponiage Act did not cover enemy secrets, the charges were dropped. A grand jury investigation did not result in prosecution but generated further publicity and, according to Walter Winchell, "tossed security out of the window". Britain's worst fears about American security were realized.
In early August, a RAN intercept unit in Melbourne heard Japanese messages, using a superseded lower-grade code. Changes were made to codebooks and the call-sign system, starting with the new JN-25 codebook (issued two months before). However the changes indicated the Japanese believed the Allies had worked out the fleet details from traffic analysis or had obtained a codebook and additive tables, being reluctant to believe that anyone could have broken their codes (least of all a Westerner).
- Greg Goebel. "US Codebreakers In The Shadow Of War". 2018.
- Sterling, Christopher H. (2007). Military Communications: From Ancient Times to the 21st Century. ABC-CLIO. pp. 126–127. ISBN 978-1-85109-732-6. Retrieved 1 May 2009.
- "Red Code". Retrieved 1 May 2009.
- Budiansky 2000.
- "Bletchley Park Jewels Japanese Cryptographic Machines". www.mkheritage.co.uk.
- Smith, p.125
- https://www.nsa.gov/about/cryptologic-heritage/center-cryptologic-history/pearl-harbor-review/early-japanese/ Early Japanese Systems NSA Center for Cryptologic History
- Smith, p.93
- Mundy, Liza (2017). Code Girls. Hachette Books. ISBN 978-0-316-35253-6.
- Budiansky, Stephen (2000). Battle of Wits: The complete story of Codebreaking in World War II. New York: Free Press. pp. 7–12. ISBN 0-684-85932-7.
- Wilford, Timothy. "Decoding Pearl Harbor: USN Cryptanalysis and the Challenge of JN-25B in 1941", in The Northern Mariner XII, No.1 (January 2002), p.18.
- Dufty 2017, p. 122,123.
- Dufty 2017, p. 14,64.
- Dufty 2017, p. 96.
- Wilford, p.18.
- Wilford, p.20: citing Kahn, The Codebreakers.
- Twomey, Steve (2016). Countdown to Pearl Harbor: The Twelve Days to the Attack. New York, NY 10020: Simon & Schuster. p. 152. ISBN 978-1-4767-7646-0.CS1 maint: location (link)
- Wilford, p.19.
- Kahn 1967, p. 566.
- Wilford, pp.19 and 29.
- Kahn 1967, pp. 99,564,567.
- Blair, Silent Victory, passim
- Farago, Ladislas. The Broken Seal (New York: Bantam, 1968), pp.393-395.
- "Obituary: Brian Townend". London: The Times. 2 March 2005. Retrieved 1 May 2009.
- Smith 2000, p. 150.
- Smith 2000, pp. 191.
- Smith (2000) page 153 & (2001) pp140-143
- Gabriel Schoenfeld (March 2006). "Has the "New York Times" Violated the Espionage Act?". Commentary Magazine. Archived from the original on 18 January 2012. Retrieved 4 October 2017.
- Smith 2000, pp. 142,143.
- Budiansky, Stephen (2000). Battle of Wits: The complete story of Codebreaking in World War II. New York: Free Press. ISBN 0-684-85932-7.
- Dufty, David (2017). The Secret Code-Breakers of Central Bureau. Melbourne, London: Scribe. ISBN 9781925322187.
- Kahn, David (1996) . The Codebreakers. Macmillan.
- Smith, Michael (2000). The Emperor's Codes: Bletchley Park and the breaking of Japan's secret ciphers. London: Bantam Press. ISBN 0593-046412.
- Smith, Michael and Erskine, Ralph (editors): Action this Day (2001, Bantam London; pages 127-151) ISBN 0-593-04910-1 (Chapter 8: An Undervalued Effort: how the British broke Japan’s Codes by Michael Smith)
- "Bletchley Park In Mombasa". Coastweek Newspapers Ltd. Retrieved 19 October 2006.
- Michael J. O'Neal. "World War II, United States Breaking of Japanese Naval Codes". Retrieved 19 October 2006.