Appendix VIII – Algorithms

The Cryptogram ND 13


An algorithm (pronounced AL-go-rith-um) is a procedure or formula for solving a problem. The word derives from the name of the mathematician, Mohammed ibn-Musa al-Khwarizmi, who was part of the royal court in Baghdad and who lived from about 780 to Al-Khwarizmi’s work is the likely source for the word algebra as well.

Although our familiarity with the word “algorithm” may be one of a mathematical sense as an aid to solving ciphers, its use is far from simply mathematical. We use this procedure as a set of unambiguous steps in many of our everyday activities. It may be used for something as common as following a recipe for baking a blueberry pie:

An algorithm is characterized by the fact that certain distinct steps must be taken (find the largest number that can be divided into the first two numbers of the dividend) and that those steps may need to be repeated before a distinct answer is obtained. In modern cryptology, encipherment and decipherment are both mathematical operations that follow specific algorithms, differing from one ciphering system to another. An awareness of the algorithm system allows us to work at solving the cipher at hand. The algorithm stated above for long division is a simple one, easily followed. Algorithms used in cryptology can be simple or more complex.

The complexity of an algorithm is defined by the number of arithmetical operations it performs and represented by the length of the input, i.e., the number of bits required to store. Fermat’s Theorem or Einstein’s Theory of Relativity are examples of complex algorithm procedures requiring a vast accumulation of mathematical computations.

Cryptographic Algorithm Applications

We practice algorithm procedures every time we make use of letter frequency and digraph / trigraph counts, study a Columnar Cipher or Route Transportation path, utilize keyword alphabets, follow ACA and You encryption procedures, use the 26 x 26 Vigenère Square or even execute the solution of a Caesar Cipher. The Caesar Cipher encryption can be depicted by (N + X) letter shift in the alphabet where N is a fixed integer and X equals a numbered letter shift.

Deep-dish Blueberry Pie LIONEL

Serves 8 to 10 people
Six cups of fresh blueberries
1/2 cup flour
2/3 cup sugar
1/2 teaspoon cinnamon
One teaspoon lemon juice
Mix ingredients together and place in a deep, 8 by 11 inch rectangular pan which has previously been sprayed with Pam. Cover with rolled out pastry for a one crust pie.
Bake it in oven at 425 degrees for 40 to 45 minutes, or until the crust is brown.

A far better algorithm encryption technique is to use a keyword alphabet table to define the letter substitutions to be made for each letter of the plaintext. We will use a twenty-six letter pangram to do this:

Plaintext 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

One Time Pad

There is a simple classical cipher which makes use of mathematical algorithms and has proven to be secure, the One Time Pad (OTP). This is a is an encryption algorithm where the plaintext is combined with a random key or “pad” that is as long as the plaintext and used only once. Each bit or character from the plaintext is encrypted by a modular addition with a bit or character from a secret random pad of the same length as the plaintext, resulting in a ciphertext. For these examples, A=0, B=1, C=2, . . . , Z = 25. To encipher a message, you may take the value of the first letter in the plaintext message and add it to the value of the first random letter from the one-time pad. For example, suppose you are enciphering the letter S(18) and the one-time pad gives you C(2). You add the two letters. When you add S and C, you get 20 which is U. Each letter is enciphered in this method, with the alphabet wrapping around to the beginning if the addition results in a number beyond 25 (Z).

Encryption = pt (n) + OTP (n) = CT. To decipher this message, you would take the first letter of the ciphertext and subtract the first random letter from the one-time pad. If the number is negative you wrap around to the end of the alphabet.


Encryption rule = pt (n) + OTP (n) = CT e (4) + U (20) = Y (24)
Decryption rule = CT (n) – OTP (n) = pt U (20) – C (2) = s (18)
pt/ plaintext : secretmessage
OTP/onetime pad: CIJTHUUHMLFRU (random key)

MJ 2013 Cm E-9 Baconian Cipher Algorithm

An algorithm for the Baconian Cipher which appeared in our MJ2013 issue might read something like this:

DC (may) to NC POS 115 + LFBAP (aaaabbbb) + ATCT = SOL

Meaning: Drag Crib (may) to Non Conflict Position 115, Look for Biliteral Alphabet Pattern (aaaabbbb), Apply to Ciphertext = Solution

Algorithms need not be simply mathematic equations. They are a part of our everyday life.

We use them when we take the shortest route to the grocery store, cut the grass, water the flowers, instruct our young ones in the “do’s” and “don’ts” and choose our words carefully in debates with our significant other. Algorithms need not be complicated algebraic equations used to attempt to insure coverage of plaintext such as in Affine and Hill cipher types, but simply a way to plot a logical procedure to arrive at the cipher solution of the day or the baking of that delicious deep-dish Blueberry Pie.