You are on page 1of 5

Cracking the Japanese JN-25 Cipher

Author(s): Chris Christensen and Jared Antrobus


Source: Math Horizons, Vol. 24, No. 3 (February 2017), pp. 22-25
Published by: Mathematical Association of America
Stable URL: http://www.jstor.org/stable/10.4169/mathhorizons.24.3.22
Accessed: 12-02-2017 11:24 UTC

JSTOR is a not-for-profit service that helps scholars, researchers, and students discover, use, and build upon a wide range of content in a trusted
digital archive. We use information technology and tools to increase productivity and facilitate new forms of scholarship. For more information about
JSTOR, please contact support@jstor.org.

Your use of the JSTOR archive indicates your acceptance of the Terms & Conditions of Use, available at
http://about.jstor.org/terms

Mathematical Association of America is collaborating with JSTOR to digitize, preserve and extend access
to Math Horizons

This content downloaded from 128.122.230.148 on Sun, 12 Feb 2017 11:24:38 UTC
All use subject to http://about.jstor.org/terms
Cracking the Japanese
JN-25 Cipher
I
Chris Christensen and Jared Antrobus
f you were a mathematician recruited to serve
as a codebreaker with Naval Communications’
Research Section OP-20-GM during World War
II, you might be assigned the Japanese inter-
cept shown in figure 1. The message is hid-
den by an enciphered code that was designated by
Allied codebreakers as JN-25.
JN-25 was introduced by the Imperial Japanese
Navy on June 1, 1939, as a general-purpose cipher for
command and operational needs of the Japanese fleet.
It was used until the end of World War II.
The British codebreaker John Tiltman made the first
break into JN-25 in 1939. Unfortunately, only frag-
ments of messages could be deciphered at the time of
the attack on Pearl Harbor. British and U.S. code-
breakers’ eventual success in cracking JN-25 contribut-
ed to many Allied victories in the Pacific, such as the
May 1942 Battle of the Coral Sea and the June 1942 Figure 1. An intercepted JN-25 message.
Battle of Midway.
faculty who might be interested in cryptanalysis. When
The U.S. Navy played only a small part in World
the United States entered the war as a combatant,
War I, but the Navy learned the value of codebreaking.
In 1924 Laurance Safford came to the research desk in mathematicians who successfully completed the cor-
Naval Communications. Safford recognized the need for respondence course were recruited into OP-20-GM,
codebreakers, so he published cryptograms in the com- the research section of Naval Communications OP-
munications bulletin and encouraged solvers to share 20-G, which was headed by former Yale mathematician
their solutions with him. He was searching for men Howard Engstrom.
with cipher brains. Those cryptograms evolved into a
correspondence course in elementary cryptanalysis— Sending and Receiving JN-25 Messages
codebreaking—that was offered to Navy officers. (You Two books were necessary to communicate using JN-25.
can take the course here: http://bit.ly/1QlAqCs.) One was a codebook, which had two parts—one for
After World War II broke out in Europe, Navy lead- sending messages and one for receiving. The other was a
ers realized that more codebreakers would be needed, book of random numbers used to encipher the messages.
and they searched college campuses for mathematics The sender’s part of the codebook was like a diction-

22 February 2017 : : Math Horizons : : www.maa.org/mathhorizons


This content downloaded from 128.122.230.148 on Sun, 12 Feb 2017 11:24:38 UTC
All use subject to http://about.jstor.org/terms
ary that listed words and phrases that could be used
in messages and the corresponding five-digit clear code
groups that substituted for the words or phrases. For
example, to encipher a message reporting 10 U.S. bat-
tleships, the sending operator would use the codebook
to determine that 24396 corresponds to “U.S. Navy,”
31143 to “battleship(s),” and 74412 to “10.”
Because of the possibility of radio transmissions be-
ing garbled, the Japanese built error detection into JN-
25. All the clear code groups were divisible by 3, which
is equivalent to the sum of the digits being divisible by
3. If a number was divisible by 3, the British and U.S.
codebreakers said it scanned. The scanning property
was exploited by Allied codebreakers until July 25,
1944, when it was dropped from JN-25.
After finding the clear code groups, the sending
operator would encipher them using the additive book.
Each page of the book contained a grid of random five-
digit numbers called additives.
He would select a string of consecutive additives—
say, 41729 50769 92916—then he would add them to
the clear code groups using false addition. False addi-
tion, which we denote by means to add in columns
modulo 10—that is, with no carries. For instance, the
transmitted code for “U.S. Navy” is
24396
⊕41729 .
65015
The false sums for the other two phrases are computed
similarly, and the transmitted string would be 65015
81802 66328.
Because the sending operator selected the location of
the additive string, it was necessary for him to trans-
Figure 2. The first page of a reconstructed JN-25A
mit that information to the receiving operator. Until
codebook.
late 1943, to do so, he sent an indicator—a five-digit
number consisting of the three-digit page number and
we denote and recover the clear code groups. For
the single-digit row and column numbers indicating
instance, when the operator receives 65015 and sub-
the beginning of the additive string (rows and columns
tracts the additive 41729, he obtains
were numbered 0 to 9).
For example, if the first entry of our additive string
was found in the third row and first column of page 27,
the indicator would be 02731. The indicator was enci-
phered using a small table that came with the instruc- He would then look up the clear code groups in the
tions for using JN-25. second part of the codebook, which was arranged in
The receiving operator would decipher the indi- numerical order, and determine their meanings. Figure 2
cator and determine where the string of additives shows the first page of the receiver’s part of a codebook
began. Then he could remove the additives using false that was reconstructed by U.S. Navy codebreakers for
subtraction (subtract in columns modulo 10, which JN-25A, the first version of JN-25.

www.maa.org/mathhorizons : : Math Horizons : : February 2017 23


This content downloaded from 128.122.230.148 on Sun, 12 Feb 2017 11:24:38 UTC
All use subject to http://about.jstor.org/terms
Breaking the Code
We now share a procedure developed by U.S. Navy
mathematicians—that they called jiggling—to crack
JN-25.
A codebreaker’s initial attack on JN-25 is on the
enciphering of the indicator because knowing the indi- Figure 5. We subtract
cator permits him to align messages in depth. Aligning from each code group.
messages in depth means to align rows from different entries are in depth, they all have the same additive Z.
messages so that the columns have been enciphered First, one code group, Gt in this example, is sub-
with the same additive. tracted from all the others (see figure 5). We chose Gt
For instance, if we have five transmitted messages because it produces many 0 entries.
and the first entries—the indictors—are broken and are Observe that subtracting Gt strips off the additive:
00300, 00303, 00301, 00302, and 00304, then they were Hence, the
enciphered with additive strings starting in various
nine differences are the differences of two clear code
columns of row zero on page three. Using this informa-
groups. Thus, if we can find Gc, then we can add it
tion, the five messages can be aligned in depth, as in
to the differences to find the other clear code groups.
figure 3.
The key facts we need about Gc are that it scans, and,
when it is added to each of the differences, the sum
scans.

Finding the Code Groups


The first difference, is
Figure 3. Five messages aligned in depth. congruent to 1 modulo 3; therefore, to result in a value
that scans, the sum of Gc and 20050 must have one
Because of the large number of JN-25 messages that or four carries. For instance, 00060 is a possible value
were transmitted and because the operators did not for Gc because it scans and
choose the beginnings of the additive strings randomly scans, and notice that the sum has one carry. Similarly,
(they tended to use the first third of the additive book 76422 is congruent to 0 modulo 3, so must
and to start near the upper left part of the page), por- have zero or three carries. Figure 6 shows the number
tions of additive strings were often repeated, and depth of carries that must occur for the sums to scan.
among messages was common. Figure 6. The number of possible
Suppose we have the column of transmitted JN-25 carries when is added.
code groups shown in figure 4, which is in depth. We
use Xt and Xc to denote the transmitted and the clear
code groups for message X, respectively. Because these

Figure 4. A column
of transmitted code
groups.

A 0 cannot produce a carry regardless of the digit


added to it; therefore, we colored the 0s red in figure 7.
(Remember, we chose Gt so that it produced many 0s.)
So, the third, eighth, ninth, and tenth groups cannot
have five carries, and they must have two carries.

24 February 2017 : : Math Horizons : : www.maa.org/mathhorizons


This content downloaded from 128.122.230.148 on Sun, 12 Feb 2017 11:24:38 UTC
All use subject to http://about.jstor.org/terms
2 0 0 5 0 1, 4 2 0 0 5 0 1, 4
7 6 4 2 2 0, 3 7 6 4 2 2 0, 3
1 7 0 0 6 2,5 1 7 0 0 6 2,5
3 9 5 5 6 1, 4 3 9 5 5 6 1, 4
8 8 1 4 3 0, 3 8 8 1 4 3 0, 3
6 3 7 9 1 2, 5 6 3 7 9 1 2, 5
− − − − − − − − − − − −
0 3 3 3 5 2,5 0 3 3 3 5 2,5
Figure 8. The final array with
0 5 0 7 2 2,5 Figure 7. Digits that do not carry 0 5 0 7 2 2,5 carries and noncarries colored
0 9 0 8 0 2,5 are red; those that carry are green. 0 9 0 8 0 2,5 green and red, respectively.

Likewise, the first group must have one carry. Now we add 89529 to the differences
That reasoning leads to a force for the last group and obtain the po-
09080: The 9 and the 8 must carry. Because the 8 car- tential clear code groups, 09579, 55941, 96525, 18075,
ries in column four, any digit greater than 7 in that 67662, 42210, 89529, 82854, 84591, and 88509.
column must also carry; therefore, the 9 in row four If and if the codebreakers were lucky, all
carries. Because the 9 in 09080 carries, the 9 in 39556 or many of these numbers would be clear code groups
also carries. All digits that carry are colored green. that had already been recovered and the meanings of
Either the 2 or the 5 in 20050 must carry; therefore, which were known. If some clear code groups had not
we have two cases. It is, of course, more likely that the been recovered and their meanings were not known, per-
5 will carry, but we assume that the 2 carries. (The haps their meanings could be determined by the context
reader is encouraged to try the other case. It explodes of the messages, and it could be added to the growing
into a multitude of subcases, which more accurately codebook.
reflects what happens in jiggling than the easier case Moreover, if 89529 were the correct Gc, then the addi-
presented here.) tive Z is 42752. As the codebreakers recovered additives,
At this point the logic continues in a similar fashion, they could build the additive book.
and we mark entries as carries or noncarries. We give a When the mathematicians of U.S. Naval Communi-
brief sketch of the argument, but the reader is encour- cations OP-20-GM left their colleges and universities,
aged to follow along with pencil and paper. they stepped into the world of cryptologic problems—
Because the 2 in 20050 carries and the 5 does not, problems for which they had only cursory training.
we mark every digit greater than 1 in the first col- But they brought their mathematical problem-solving
umn as a carry, and we mark every digit less than 6 skills, and they contributed to the Allied victory. The
in column four as not carrying. It follows that 39556 success of mathematicians as codebreakers changed
has four carries and 88143 has three carries, and 39556 the nature of cryptology; it became a mathematical
becomes a force—both the 5 in column three and the 6 discipline.
in column five must carry. Try your codebreaking skills on another JN-25
Hence, 76422 has three carries and 63791 has five cipher, which can be found in the Playground (page
carries. Like a cascade, it follows that 63791, 03335, 30). n
17006, and 05072 are forces. The determination of the
remaining carries is straightforward. Figure 8 shows Chris Christensen teaches mathematics and cryptol-
the final array. ogy at Northern Kentucky University. Years ago, after
Now we can determine the possible values of Gc. In running out of Tom Clancy novels, he read Robert
column one, 2 carries but 1 does not; therefore, the Harris’s Enigma and was drawn to cryptology.
left-most digit of Gc is 8. In column two, 3 carries but
0 does not; therefore, the second digit of Gc is 7, 8, or Jared Antrobus is a mathematics doctoral student at
9. In column three, 5 carries but 4 does not; therefore, the University of Kentucky. When not scratching his
the digit is 5. In column four, 8 carries but 7 does not; head over a math problem, Jared likes to read novels,
therefore, the digit is 2. And, in column five, 1 carries play video games, and fiddle with computers.
but 0 does not; therefore, the digit is 9. This leaves
three possibilities for Gc: 87529, 88529, and 89529.
However, Gc must be divisible by 3. Therefore, 89529 is
the only candidate for Gc. http://dx.doi.org/10.4169/mathhorizons.24.3.22

www.maa.org/mathhorizons : : Math Horizons : : February 2017 25


This content downloaded from 128.122.230.148 on Sun, 12 Feb 2017 11:24:38 UTC
All use subject to http://about.jstor.org/terms

You might also like