52.

Learn Encryption Techniques with BASIC and C++
(Publisher: Wordware Publishing, Inc.)
Author(s): Gil Held
ISBN: 1556225989
Publication Date: 10/01/98

Previous Table of Contents Next


Reducing Probability of Decipherment

One method that can be used to reduce the potential threat of analysis and decipherment is to extend its repetition period. Although this is time consuming when performed manually and subject to an increased probability of an enciphering error as the number of cipher alphabets increases, you can easily accomplish this through automation via a computer. Because you would also want to eliminate the use of a simple displacement for creating the cipher alphabets, you can use several methods to accomplish this. First, you can base the creation of the plaintext and each ciphertext alphabet upon the use of a keyword or keyword phrase. For example, assume you use the keyword MICROSOFT for the plaintext alphabet and the keyword phrase WINDOWS ARE FUN for the ciphertext alphabets. You can use the first keyword in its normal manner, and the second keyword can be used vertically as a mechanism to establish shifted cipher alphabets.

Figure 5.4 illustrates the use of a keyword-based periodic polyalphabetic substitution system using the keyword MICROSOFT to form the plaintext alphabet, while the keyword phrase WINDOWS ARE FUN is used to form shifted cipher alphabets. You should note that the plaintext keyword-based alphabet at the top of Figure 5.4 serves as a position pointer to each cipher alphabet. Concerning the cipher alphabet, you should note that since I will shortly develop a program using 26 cipher alphabets incorporated into a matrix, I labeled the cipher alphabets 0 to 25 to correspond to the array index that will be used. You should also note that the use of a vertical keyword or keyword phrase to form cipher alphabets positions the keyword or keyword phrase characters to the extreme right of the matrix in the last column. For example, in cipher alphabet 0 W is rotated to the last column; hence, the first column commences with the character X. Similarly, in Row 1 (cipher alphabet 1) the character I in the keyword phrase WINDOWSAREFUN is positioned in the last column, which makes the character J the first character in Row 1.


Figure 5.4  A plaintext keyword-based alphabet and polyalphabetic ciphertext matrix using a shifted keyword-based alphabet


One weakness of polyalphabetic substitution systems was discovered by Auguste Kerckhoffs, a Dutchman born in 1835 who became a naturalized citizen of France. Author of La Cryptographie militaire, considered one of the most extensive works on cryptanalysis, Kerckhoffs developed a general solution for polyalphabetic substitution systems that has deciphered many “unbreakable” messages.

Under the Kerckhoffs method, a group of several intercepted messages is aligned so that the position of each enciphered character in each message is aligned by column. If the same key is used for the encipherment of each message, the letters in each column represent an encipherment process in which the same ciphertext alphabet was used. Thus, each column can be attacked as if it represented a monoalphabetic substitution by performing a frequency analysis of the letters in each column. Of course, if you change the key used to govern the enciphering process, the frequency of key changes and the number of messages enciphered by any one key determines the ability of the Kerckhoffs process to be used against your messages. If you transmit only a few messages with each key prior to changing the key, a frequency analysis of your messages on a column-by-column basis will more than likely produce meaningless results. If you transmit a large number of messages but change keys frequently, your message groups enciphered by a common key will probably be sufficient for a cryptanalyst to apply Kerckhoffs’ method. Thus, you must balance both the change in keys and the number of messages enciphered using a key.


The POLY2.BAS Program

Now that you have reviewed a few techniques to construct a series of cipher alphabets, I’ll show you how to develop a program to encipher a message using a polyalphabetic substitution technique. This program is stored in the file POLY2.BAS on the companion CD-ROM, and, for simplicity of illustration, will use 26 cipher alphabets.

Listing 5.3 contains the main portion of POLY2.BAS. After using four PRINT statements to display information about the program, the first INPUT statement assigns the plaintext keyword or keyword phrase to the string variable TEXT$. The subroutine INITIALIZE is then invoked to form the plaintext alphabet and the subroutine KEYWORD is invoked to form a keyword-based mixed alphabet. This is followed by a FOR-NEXT loop which assigns the keyword-based alphabet to the string array PLAIN$, since the string array PLAINTEXT$ will be reused. Once the ciphertext keyword or keyword phrase is entered, it is assigned to the string variable TEXT$ and the subroutines INITIALIZE and KEYWORD are invoked again to form the ciphertext keyword-based mixed alphabet. This alphabet is placed into the array CIPHER$ through the use of a FOR-NEXT loop. Then, a series of four subroutines is invoked. Subroutines PFORMCIPHER and PCONVERTSTORE are modified versions of the subroutines FORMCIPHER and CONVERTSTORE previously developed, with the prefix P used to denote its modification for polyalphabetic use. Subroutines MSGFILE and PRTOUT remain the same and will not be discussed further.

Listing 5.3 The main portion of the POLY2.BAS program.

 REM PROGRAM POLY2.BAS DIM PLAINTEXT$(26), PLAIN$(26), CIPHER$(26), CIPHERTEXT$(26), KEY$(26)     CLS     PRINT "POLY2.BAS PROGRAM enciphers text based upon the use of                 two keywords"     PRINT "or keyword phrases using a polyalphabetic substitution                  process using"     PRINT "26 cipher alphabets."     PRINT     INPUT "Enter plaintext keyword or keyword phrase in UPPERCASE: ",                  TEXT$ GOSUB INITIALIZE             'initialize plaintext alphabet GOSUB KEYWORD                'form keyword based mixed alphabet    FOR I = 0 TO 25: PLAIN$(I) = PLAINTEXT$(I): NEXT I    INPUT "Enter ciphertext keyword or keyword phrase in UPPERCASE:",                 TEXT$ GOSUB INITIALIZE             're-initialize plaintext alphabet GOSUB KEYWORD    FOR I = 0 TO 25: CIPHER$(I) = PLAINTEXT$(I): NEXT I GOSUB PFORMCIPHER            'create 26 cipher alphabets GOSUB MSGFILE                'assign I/O files, place message on a file GOSUB PCONVERTSTORE          'convert and store ciphertext on a file GOSUB PRTOUT                 'print results STOP 


Previous Table of Contents Next


Learn Encryption Techniques with Basic and C++
Learn Encryption Techniques with BASIC and C++
ISBN: 1556225989
EAN: 2147483647
Year: 2005
Pages: 92
Authors: Gil Held

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net