# The Gronsfeld Cipher

### Author: R. Morelli

This page describes a method for attacking a Gronsfeld cipher. It is
based on the approach described in F. Pratt, *Secret and Urgent,*
NY: Bobbs-Merrill, 1939.

The Gronsfeld cipher is a variation of the
Vigenere cipher in which a key number is used instead of a
keyword, e.g., 14965. Usually the key does not contain repeated
digits.

Here's a message written in a Gronsfeld Cipher.

cjifk qywtj ioipo wovlh ncxlo peosg gxrkx
baiiq caguy rxrlq klcoy vewql nhsut oiddg
qdrap dnfwk owpgw gzlsk xlt

For this problem, I've simplified things as follows: we allow only the
digits between 0-5 (a-d) to be used in the key. The method for
attacking a Gronsfeld cipher involves the following steps:

**Step 1. **Write the first line of the message, and then write
under each of its letter, the letters that precede it in the
alphabet. Since we know that this version of Gronsfeld uses only
numbers between 0-5, (a-f), we need 6 rows. I've numbered the rows and
columns so that we can refer to them.
0 1 2 3 4 5 6 7
0 c j i f k q y w tj ioipo wovlh ncxlo peosg gxrkx (Message)
1 b i h e j p x v si hnhon vnukg mbwkn odnrf fwqjw
2 a h g d i o w u rh gmgnm umtjf lavjm ncmqe evpiv
3 z g f c h n v t qg flfml tlsie kzuil mblpd duohu
4 y f e b g m u s pf ekelk skrhd jythk lakoc ctngt
5 x e d a f l t r oe djdkj rjqgc ixsgj kzjnb bsmfs

** Step 2.** Construct all reasonable trigrams using
combinations of letters from the first three columns -- i.e., columns
0-2 -- taking 1 letter from each column. For example, we can get the
trigram 'ahe' by picking from rows 2,2,3. We would say that the number
code for 'ahe' is 223. Since this represents the first word of the
message, the trigrams formed should be possible ways to start a word
or phrase. In this case, 'ahe' could be the start of 'ahead.'
Actually, it's not a very likely trigram, since it repeats the number
2. Make a table of the trigrams, their number codes (which represent
a portion of the possible key number) and their frequencies, from
Table XII in Pratt.
Trigram Code Frequency (Table XII in Pratt)
aid 215 24 ********
age 234 20 ********
aff 243 9
ahe 224 2
agi 230 3
agg 232 3
big 114 4
chi 010 22 ******** repeated numbers
che 024 27 ********
cei 050 052 13
bed 155 2
bee 154 32 ********
bei 150 19 ********
bef 153 8
beg 152 5

**Step 3.** Pick the most reasonable looking trigrams from the
list in step 2. In this case we've picked the following entries:
aid 215 24 ********
age 234 20 ********
bee 154 32 ********
bei 150 19 ********
che 024 27 ********

They are all relatively frequent trigrams. They could be used as
the prefix of the first word. None of them involves a repeated digit
in its number code, which rules out 'chi.'

**Step 4.** For each of the likely trigrams, apply the number
formulas to each succeeding trigram in the message. For example, if we
apply 024, to the letters in columns 1,2,3 we get the trigram, 'jgb';
if we apply it to the letters in columns 2,3,4 we get 'idg,' and so
on. A partial table has been constructed below. Impossible trigrams
are marked with (*). Filling in the rows for 'aid' and 'age' is left
as an exercise.
Column 1 2 3 4 5
aid 215
age 234
bee 154 idb hag efm* jlu* pts
bei 150 idf hak efq* jly* ptw
che 024 jgb* idg fim kou qws*

**Step 5. **Note that in the table above, some of the
trigrams for 'bee' and 'bei' are reasonable looking, but they don't
combine well with the assumption that 'bee' or 'bei' form the first
three letters of the message. For example, we can get 'bee--pts' by
combining 'bee' with the trigram that starts in column 5, the first
column that has a possible trigram, since 'efm' and 'jlu' are
impossible. Similarly, we can get 'bei--ptw' by combining 'bei' and
'ptw', which also starts in column 5. Neither of these strings
('bee--pts' or 'bei--ptw') look very promising as the start of the
clear message. On the other hand, combining 'che' as the prefix with
the trigram that begins at column 4 ('kou'), gives the following
partial string: 'che-kou.' That looks pretty promising. So let's work
on it.
**Step 6.** Now, working with our partial solution, that
begins, che-kou, replace the blank with each of the 6 letters from
column 3 of the table in step 1. This gives us all possible trigrams
for columns 2-3-4 that are consistent with che and kou. This list
consists of:
efk, eek, edk, eck, ebk, eak

We want to eliminate 'efk,' 'edk,' and 'ebk' from this list,
leaving Ôeek,Õ ÔeckÕ and Ôeak.Õ If we make these substitutions we get
the following candidates for partial solutions:

Candidate Number Code Comment
cheekou 0241024 Possibly cheek our or cheek out
checkou 0243024 Possible check out or check our
cheakou 0245024 Not very likely

Notice that a cycle is beginning to appear that goes 024-024 and we
now have two candidates 02410241 and 02430243. If we replace the 7th
letter for each of these candidates we get:

02410241 = cheekouw Impossible
02430243 = checkout ********* Solution!!!! ***********

**Step 7. **To complete the decipherment, apply the key number
0243 to the rest of the cipher text. You can use CryptoTool to
complete this if you use the keyword 'aced.'
### For Further Study and Enjoyment

CryptoToolJ. Try using
**CryptoToolJ** break the message given at the top of the page.
Even though CryptoTool does not have a Gronsfeld Analyzer, it should
be able to analyze it with the Vigenere Analyzer.
CryptoToolJ. Try using
**CryptoToolJ** to create and analyze your own Gronsfeld
cryptograms.
The Vigenere Cipher. The
Gronsfeld Cipher is a simple variant of the Vigenere Cipher. Check
the Vigenere page on this site.

To read a more detailed account of the Gronsfeld Cipher, see Fletcher
Pratt's book *Secret and Urgent NY: Bobbs-Merrill, 1939.
*