Affine & Hill Cipher Types

The Affine (Linear Substitution Encryption) and Hill (Lester Hill, U.S. mathematician) Cipher techniques manipulate numbers in ciphertext with complicated formulae base to disguise message plaintext over and above the simple substitution process. Numbers have been commonly used to encipher plaintext but the Affine and Hill Ciphers use mathematical formulae and logic to disguise the plaintext further through a series of mathematical equations.

The Affine Linear Substitution Encryption in its most basic application form may first apply addition and then multiplication to its plaintext message. To convert the plaintext letter “C” by this method, 5 might be added to the numerical value of the letter (C = 3; 3 + 5 = 8) and that sum multiplied by some other constant, such as 5 (5 x 8 = 40). The resulting cipher letter is N (40 modulo* 26 = 14 – N). (Encyclopedia of Cryptology, David E. Newton, Instructional Horizons Incorporated, 1997.)

In mathematics, modular arithmetic (sometimes called clock arithmetic) is a system of arithmetic for integers, where numbers “wrap around” after they reach a certain value—the modulus. A familiar use of modular arithmetic is in the 12-hour clock, in which the day is divided into two 12-hour periods. If the time is 7:00 now, then 8 hours later it will be 3:00. Usual addition would suggest that the later time should be 7 + 8 = 15, but this is not the answer because clock time “wraps around” every 12 hours; in 12-hour time, there is no “15 o’clock”. Mathematics would refer to 15 o’clock as mod (12) 3.

Likewise, when working with enciphering the English 26 letter alphabet there is no 27th digit bur mod (26) 1.

The Hill Cipher suggests that a series of plaintext letters can be converted into ciphertext with the use of four simultaneous linear equations where variables are raised to no power higher than the first and all variables have the same values.

Needless to relate, such complex base formulae do not allow for the ease of plaintext encryption and certainly will not relate to the desire of making elementary classroom mathematics fun and games. But they do provide a path to a simplistic approach of making secret messaging through elementary mathematics fun while achieving the primary objective of simultaneously educating the student. Supported by the Affine and Hill Cipher premises and willed with the desire to make mathematics fun, we set out on a journey to make math fun for our younger solvers as they work at uncovering secret messages and learn to embrace those dreaded multiplication tables.

We will begin this chapter with two numerical ciphers, dissimilar to the usual ACA cipher types that we are used to seeing in The Cryptogram.  They are cipher types from our Young Tyros Junior Newsletter which we use to make mathematics fun for our younger solvers.

Determine what mathematical process must be used with the following ciphertext numbers so that each represents a letter of the alphabet with a value from 1 to 26. Keep in mind that the mathematics base has been constructed for younger elementary students, so keep the thought stream simple.

A&H-1. Turkey Day.                      LIONEL

 87  77 749  53  10  68  38 577  25 63 859
 72 563  61  22  01 889  10  66  75 96 778
 41 378  10  67  50  99  36  21  01 33  10
 94  81  84  36  05 757 775  18 884 40  96
788  95 785  78  04  36  86  68 113 99  10
569 668  53  32 775  10 382  41  85 96  58  
 41  77 839  71  10  66  24 758  81 94  14.

A&H-2. Bewhiskered Santa.              LIONEL

838 01  77 749 10 883 995 53 45 775
 83 32  99 676 68  14  41 22 95  96 668
 99 63  85  58 72  59  62 23 65  45 991
199 50 919  83 72  31 883 86 87 992
299 71  05 887 27  67  76 63 59  11 777
774 58  10 775 53  01 877 23.

Use the key below to decipher the mathematical computations which follow it.

Key    a b c d e f g h i j k l m n o p q r s t u v w x y z
       4 8 1 1 2 2 2 3 3 4 4 4 5 5 6 6 6 7 7 8 8 9 9 9 9 9
           2 6 0 4 8 2 6 0 4 8 2 6 0 4 8 0 2 1 4 0 4 6 8 9

A&H-3. (12×3-24)(8×9-2)(12×8+2)(8×8)(9×8+9)(12×5)(7×4)(8×7+14)(36-32)(26×2)

A&H-4. (X=2+2)(X=52-4)(X=7×4)(X-5=15)(X-2=6)(X=10×7)(X×15=19)

Let’s use our Affine & Hill Cipher discussion as an opportunity to introduce fractions into our ciphering activity.

Cracking the Fraction Code

Fractions, like the multiplication tables, tend to scare the “bejeebies” (spell check will have its own wits “bejeebied” with this word) out of elementary student’s first time exposure to this part of their mathematics lessons but I have found the following explanation of fractions, one with which the first time fraction student is able to relate:

¼

The bottom number of a fraction tells you how many equal pieces there are in the whole  object. The top number tells you how many pieces of the whole object that you are thinking about. Let us suppose that you receive ¼ of a pie. The bottom number tells you that there were four equal pieces in the pie. The top number tells you that you received one of those four equal pieces.

Exercises

FR1.
A pizza has eight slices. You eat three of the pieces. What fraction did you eat?
FR2.
An apple is cut in two parts. You eat one part of the apple. What apple fraction did you eat?
FR3.
Since it is your birthday, your mother has promised you two pieces of your birthday cake. The cake has eleven pieces. What fraction of the cake will you receive?

Let’s have some fractioning ciphering fun.

Key:

             a     b    c    d    e    f    g    h    i    k    l    n    o    r    s    t    u    w
            1/4   2/4  3/4  1/5  2/5  3/5  4/5  1/6  2/6  3/6  4/6  5/6  1/6  2/8  3/8  4/8  5/8  6/8

FR4. Pizza Pieces Cipher         

         Determine the fraction, the letter and solve the message.

PIZZA PIECES
Your Share Whole Fraction Letter
6 8    
1 6    
1 4    
4 8    
1 6    
1 4    
2 8    
3 5    
1 8    
5 8    
2 8    
6 8    
1 6    
2 5    
2 5    
4 6    
3 8    
1 4    
5 6    
1 5    
3 5    
4 6    
2 6    
2 5    
3 8    
1 4    
4 5    
1 4    
2 8    
2 4    
1 4    
4 5    
2 5    
4 8    
2 8    
5 8    
3 4    
3 6    

You’re thinking that this is an over simplification and huge distance from the Affine & Hill Ciphers concept and objectives for someone outside of the realm of elementary school mathematics. You wish for a better example of an actual Affine Cipher Linear Encryption Process. Be careful what you wish for. Far be it from us to leave the reader wanting more and receiving less. We will leave you with the task of constructing an Affine Cipher key based on the Affine Linear Substitution Encryption process described in paragraph two of this chapter. Using 5 as your addition and multiplication constant determine the ciphertext for the 26 letters of the alphabet to provide an enciphering key for the Affine Linear Encryption Process.

A&H 5. Affine Linear Substitution Encryption                    LIONEL

We will start you out with plaintext letters “a” thru “d” – You complete the key.

Pt    a b c d e f g h i j k l m n o p q r s t u v w x y z
CT    D I N S

Use this key to decipher the following cipher.

A&H-6. Incarceration.           LIONEL

    UMX   JVKPU   AKRPVQ   RP   D   NGVPXS   LRQS.