Polyalphabetic substitution


Introduction

In polyalphabetic substitution ciphers the plaintext letters are enciphered differently depending upon their placement in the text. As the name polyalphabetic suggests this is achieved by using several cryptoalphabets instead of just one, as is the case in most of the simpler crypto systems.
Which cryptoalphabet to use at a given time is usually guided by a key of some kind, or the agreement can be to swich alphabet after each word encrypted (which, of course, presumes that the word boundaries are kept intact or indicated in some way), but the latter is seldom practiced in real life.
Several systems exists, and I shall try and explain some of the more common.

Gronsfeld's system

One of the simplest polyalphabetic substitution ciphers is Gronsfeld's system. Gaspar Schott, a German 17-century cryptographer, tells that he was taught this cipher during a trip between Mainz and Frankfurt by count Gronsfeld, hence the name.
Gronsfeld's system uses a numeric key - usually quite short - e.g. 7341, and this key is repeated, one figure at a time, above the individual letters of the plaintext, like this:
 
 
Key:734173417
Text:GRONSFELD

To encrypt, one simply count forwards in the alphabet from the letter to be encrypted, the number of steps given by the keyfigure above, the resulting letter being the crypto. If one happens to reach the last letter of the alphabet, still having remaining steps to count, one begins from the beginning of the alphabet. It helps to think of the alphabet as a ring of letters, instead of a row.

 This is how the example from above will look like:
 
 
Key:734173417
Text:GRONSFELD
Crypto:NUSOZIIMK

Decryption is the reverse process. One writes out the keyfigures above the letters of the cryptogram and counts backwards in the alphabet instead, to reach the plaintext.

 Gronsfeld's system can be made more secure (the original system isn't very safe, even with keys as long as the number of letters in the plaintext) against enemy decryption by using an unordered alphabet instead of the normal sequence.
Since there are numerous ways to design an unordered alphabet, I will show but one method. Using the key (or, preferably, another key of one's own choosing) from the example above, the following table is constructed:
 
 
7AEIMQUY
3BFJNRVZ
4CGKOSW
1DHLPTX

Writing the letters out, row by row, and starting with the row having the lowest keyfigure gives the following unordered sequence:

DHLPTXBFJNRVZCGKOSWAEIMQUY

 The encryption example from above will, when counting in this unordered alphabet, look like this:
 
 
Key:734173417
Text:GRONSFELD
Crypto:ICERURUPF

For an actual cryptosystem employing an unordered alphabet and Gronsfeld's system, see the page on the Swedish naval cipher of 1915


Vigenere

The most common polyalphabetic substitution cipher is the Vigenere or, as it is sometimes referred to, Tritheim's system.

It uses a table, usually containing 26 by 26 cells (one 18-century Swedish table uses 22 by 22 cells, and a 19-century one - also Swedish - has 56 by 56 cells, but it was probably to cumbersome to use) containing the letters of the alphabet in the following fashion:

The Vigenere Table



ABCDEFGHIJKLMNOPQRSTUVWXYZ
BCDEFGHIJKLMNOPQRSTUVWXYZA
CDEFGHIJKLMNOPQRSTUVWXYZAB
DEFGHIJKLMNOPQRSTUVWXYZABC
EFGHIJKLMNOPQRSTUVWXYZABCD
FGHIJKLMNOPQRSTUVWXYZABCDE
GHIJKLMNOPQRSTUVWXYZABCDEF
HIJKLMNOPQRSTUVWXYZABCDEFG
IJKLMNOPQRSTUVWXYZABCDEFGH
JKLMNOPQRSTUVWXYZABCDEFGHI
KLMNOPQRSTUVWXYZABCDEFGHIJ
LMNOPQRSTUVWXYZABCDEFGHIJK
MNOPQRSTUVWXYZABCDEFGHIJKL
NOPQRSTUVWXYZABCDEFGHIJKLM
OPQRSTUVWXYZABCDEFGHIJKLMN
PQRSTUVWXYZABCDEFGHIJKLMNO
QRSTUVWXYZABCDEFGHIJKLMNOP
RSTUVWXYZABCDEFGHIJKLMNOPQ
STUVWXYZABCDEFGHIJKLMNOPQR
TUVWXYZABCDEFGHIJKLMNOPQRS
UVWXYZABCDEFGHIJKLMNOPQRST
VWXYZABCDEFGHIJKLMNOPQRSTU
WXYZABCDEFGHIJKLMNOPQRSTUV
XYZABCDEFGHIJKLMNOPQRSTUVW
YZABCDEFGHIJKLMNOPQRSTUVWX
ZABCDEFGHIJKLMNOPQRSTUVWXY

There are several ways to use this table, all producing ciphers with different names.
 
 

  • Standard Vigenere
  • Beaufort
  • Variant Vigenere
  • Standard Vigenere

    In standard Vigenere the table is used in the following way:
     First a keyword or keyphrase is agreed upon by the communicants, e.g. PYRAMID. The letters of the keyword/keyphrase are written above the plaintext to be enciphered one by one, like the keyfigures of the Gronsfeld system. If necessary, the keyword is repeated over and over till all plaintext letters have received one letter of the key. It may look like this:
     
     
    Key letters:PYRAMIDPYRAMIDP
    Plaintext:ATTACKATSUNDOWN

    The plaintext letter is sought in the topmost row of the table and the keyletter in the leftmost column of the table. At the intersection of the column under the plaintext letter and the row begun by the keyletter, one will find the crypto letter. When the encryption is finished, the example above will have the following appearance:
     
     
    Key letters:PYRAMIDPYRAMIDP
    plaintext:ATTACKATSUNDOWN
    Crypto:PRKAOSDIQLNPWZC

    To decipher a cryptogram in standard Vigenere, one copies the letters of the key above the letters of the cryptogram. The row begun by the first keyletter is sought in the table, and then one proceeds along this row until the cryptoletter is encountered. Next, one goes straight up from the cryptoletter to the first row, where the plaintext letter is found.

     The reader might be interested in knowing, that standard Vigenere was the main cryptographic system used by the Confederated States during the American Civil War, and the following four keyphrases used by the Confederates have survived to this day:
     
     

    In the excellent book The History of Codes and Ciphers in the United States prior to World War I, available from AEGEAN PARK PRESS, the following example of a real Confederate message is given, which the interested reader can try and decipher (the key being one of the four mentioned above):
     
     
    Jackson, May 25th, 1863
    Lieut. Genl. Pemberton: My XAFV. USLX was VVUFLSJP
    by the BRCYIJ 200,000 VEGT. SUAJ. NERP. ZIFM. It
    will be GFOECSZQD as they NTYMNX. Bragg MJ TPHINZG
    a QKCMKBSE. When it DZGJX N will YOIG. AS. QHY.
    NITWM do you YTIAM the IIKM. VFVEY. How and where
    is the JSQML GUGSFTVE. HBFY is your ROEEL.
     
     
    J. E. Johnston

    Beaufort

    In the Beaufort cipher the table is used in the following way:
      The Beaufort way of using the table is somewhat easier than standard Vigenere, since you only have to follow one route instead of finding an intersection of a row and a column.

    Variant Vigenere

    In Variant Vigenere the following modus operandi is used:
     
     

    Vigenere with unordered alphabets

    As is the case with Gronsfeld's system, the cipher produced by Vigenere will be harder for the enemy to break if unordered alphabets are used instead of the normal alphabetic sequence.
    Either the mixed sequence is written down in a fashion similar to the Vigenere table above, or the mixed sequence is written on the top line and down, forming a new leftmost column, which are then used when locating the key-, plaintext, and cryptoletters.


    A table using a body consisting of a mixed sequence based on the keyword SPHINX may look like this:

    Vigenere Table with unordered alphabet



    SPHINXABCDEFGJKLMOQRTUVWYZ
    PHINXABCDEFGJKLMOQRTUVWYZS
    HINXABCDEFGJKLMOQRTUVWYZSP
    INXABCDEFGJKLMOQRTUVWYZSPH
    NXABCDEFGJKLMOQRTUVWYZSPHI
    XABCDEFGJKLMOQRTUVWYZSPHIN
    ABCDEFGJKLMOQRTUVWYZSPHINX
    BCDEFGJKLMOQRTUVWYZSPHINXA
    CDEFGJKLMOQRTUVWYZSPHINXAB
    DEFGJKLMOQRTUVWYZSPHINXABC
    EFGJKLMOQRTUVWYZSPHINXABCD
    FGJKLMOQRTUVWYZSPHINXABCDE
    GJKLMOQRTUVWYZSPHINXABCDEF
    JKLMOQRTUVWYZSPHINXABCDEFG
    KLMOQRTUVWYZSPHINXABCDEFGJ
    LMOQRTUVWYZSPHINXABCDEFGJK
    MOQRTUVWYZSPHINXABCDEFGJKL
    OQRTUVWYZSPHINXABCDEFGJKLM
    QRTUVWYZSPHINXABCDEFGJKLMO
    RTUVWYZSPHINXABCDEFGJKLMOQ
    TUVWYZSPHINXABCDEFGJKLMOQR
    UVWYZSPHINXABCDEFGJKLMOQRT
    VWYZSPHINXABCDEFGJKLMOQRTU
    WYZSPHINXABCDEFGJKLMOQRTUV
    YZSPHINXABCDEFGJKLMOQRTUVW
    ZSPHINXABCDEFGJKLMOQRTUVWY

    The example from above will now become:
     
     
    Key letters:PYRAMIDPYRAMIDP
    plaintext:ATTACKATSUNDOWN
    Crypto:BQJGYOLUYKEZTAX


    When using the unordered sequence as top row and leftmost column, the first few lines may look like this:

    Vigenere Table with unordered entry alphabets



    ..sphinxabcdefgjklmoqrtuvwyz
    s:ABCDEFGHIJKLMNOPQRSTUVWXYZ
    p:BCDEFGHIJKLMNOPQRSTUVWXYZA
    h:CDEFGHIJKLMNOPQRSTUVWXYZAB
    i:DEFGHIJKLMNOPQRSTUVWXYZABC
    n:EFGHIJKLMNOPQRSTUVWXYZABCD
    x:FGHIJKLMNOPQRSTUVWXYZABCDE
    a:GHIJKLMNOPQRSTUVWXYZABCDEF
    b:HIJKLMNOPQRSTUVWXYZABCDEFG
    c:IJKLMNOPQRSTUVWXYZABCDEFGH
    d:JKLMNOPQRSTUVWXYZABCDEFGHI
    e:KLMNOPQRSTUVWXYZABCDEFGHIJ
    f:LMNOPQRSTUVWXYZABCDEFGHIJK
    g:MNOPQRSTUVWXYZABCDEFGHIJKL
    j:NOPQRSTUVWXYZABCDEFGHIJKLM
    k:OPQRSTUVWXYZABCDEFGHIJKLMN
    l:PQRSTUVWXYZABCDEFGHIJKLMNO
    m:QRSTUVWXYZABCDEFGHIJKLMNOP
    o:RSTUVWXYZABCDEFGHIJKLMNOPQ
    q:STUVWXYZABCDEFGHIJKLMNOPQR
    r:TUVWXYZABCDEFGHIJKLMNOPQRS
    t:UVWXYZABCDEFGHIJKLMNOPQRST
    u:VWXYZABCDEFGHIJKLMNOPQRSTU
    v:WXYZABCDEFGHIJKLMNOPQRSTUV
    w:XYZABCDEFGHIJKLMNOPQRSTUVW
    y:YZABCDEFGHIJKLMNOPQRSTUVWX
    z:ZABCDEFGHIJKLMNOPQRSTUVWXY

    The example now becomes:
     
     
    Key letters:PYRAMIDPYRAMIDP
    plaintext:ATTACKATSUNDOWN
    Crypto:HSNMYRPVYOKZUGF


    © Torbjörn Andersson.Torbjörn Andersson Fecit