Assignment Cipher
Assignment Cipher
TRANSPOSITION CIPHER
This is one of the oldest ways to encrypt and decrypt that was created by the ancient Egyptians and Greeks. This technique was very useful in ancient battles; the Spartans are known to have used this rather extensively. It works by picking a matrix of a fixed size (say, 6x10) and then writing your message across the rows. The encipherment step consists of writing down the letters in the matrix by following the columns.
Where we've written the message: troops heading west need more supplies. send general dubois' men to aid row by row into the matrix. Then, to encipher this, we simply read off the columns to get: TIDIE MRNME REOGO SANOW RSLTP EEEDO SSSNU AHTUD BIENP GODAE PEIDE LNS
MONOALPHABETIC CIPHER A monoalphabetic cipher is a method for encrypting while substituting one character for another character. A popular example of a monoalphabetic cipher is the Caesar cipher. Even though there can be a possible 26! number of keys, it is one of the more simple ciphers to break. This cipher can be broken using a frequency analysis to make accurate guesses to predict the message. Many people solve these every day while doing cryptograms in their newspapers. Because of the ease to break the ciphers, more complicated polysubstitution ciphers were made which makes frequency analysis more difficult. In order to do the frequency analysis on polygraphic substitution ciphers, we can do find out how many times a digraph, trigraphs, or other groups of letters appears in the text. Even though monoalphabetic ciphers are easier to break, using these frequency analyses, polygraphic ciphers are breakable.
HILL CIPHER The Hill cipher is a polygraphic substitution cipher based on linear algebra. Invented by Lester S. Hill in 1929, it was the first polygraphic cipher in which it was practical (though barely) to operate on more than three symbols at once. Each letter is first encoded as a number. Often the simplest scheme is used: A = 0, B =1, ..., Z=25, but this is not an essential feature of the cipher. A block of n letters is then considered as a vector of n dimensions, and multiplied by an n n matrix, modulo 26. (If one uses a larger number than 26 for the modular base, then a different number scheme can be used to encode the letters, and spaces or punctuation can also be used.) The whole matrix is considered the cipher key, and should be random provided that the matrix is invertible in ensure decryption is possible). A Hill cipher is another way of working out the equation of a matrix. Consider the message 'ACT', and the key below (or GYBNQKURP in letters): (to
PLAYFAIR CIPHER The Playfair cipher or Playfair square is a manual symmetric encryption technique and was the first literal digraph substitution cipher. The scheme was invented in 1854 by Charles Wheatstone, but bears the name of Lord Playfair who promoted the use of the cipher. The technique encrypts pairs of letters (digraphs), instead of single letters as in the simple substitution cipher and rather more complex Vigenre cipher systems then in use. The Playfair is thus significantly harder to break since the frequency analysis used for simple substitution ciphers does not work with it. Frequency analysis can still be undertaken, but on the 600 possible digraphs rather than the 26 possible monographs. The frequency analysis of digraphs is possible, but considerably more difficult and it generally requires a much larger ciphertext in order to be useful. The Playfair cipher uses a 5 by 5 table containing a key word or phrase. Memorization of the keyword and 4 simple rules was all that was required to create the 5 by 5 table and use the cipher. To generate the key table, one would first fill in the spaces in the table with the letters of the keyword (dropping any duplicate letters), then fill the remaining spaces with the rest of the letters of the alphabet in order (usually omitting "Q" to reduce the alphabet to fit, other versions put both "I" and "J" in the same space). The key can be written in the top rows of the table, from left to right, or in some other pattern, such as a spiral beginning in the upper-left-hand corner and ending in the center. The keyword together with the conventions for filling in the 5 by 5 table constitute the cipher key. To encrypt a message, one would break the message into digraphs (groups of 2 letters) such that, for example, "HelloWorld" becomes "HE LL OW OR LD", and map them out on the key table. The two letters of the digraph are considered as the opposite corners of a rectangle in the key table. Note the relative position of the corners of this rectangle. Then apply the following 4 rules, in order, to each pair of letters in the plaintext: 1. If both letters are the same (or only one letter is left), add an "X" after the first letter. Encrypt the new pair and continue. Some variants of Playfair use "Q" instead of "X", but any uncommon monograph will do. 2. If the letters appear on the same row of your table, replace them with the letters to their immediate right respectively (wrapping around to the left side of the row if a letter in the original pair was on the right side of the row). If the letters appear on the same column of your table, replace them with the letters immediately below respectively (wrapping around to the top side of the column if a letter in the original pair was on the bottom side of the column). 4. If the letters are not on the same row or column, replace them with the letters on the same row respectively but at the other pair of corners of the rectangle defined by the original pair. The order is important the first letter of the encrypted pair is the one that lies on the same row as the first letter of the plaintext pair. To decrypt, use the INVERSE (opposite) of the last 3 rules, and the 1st as-is (dropping any extra "X"s (or "Q"s) that don't make sense in the final message when finished). Using "playfair example" as the key, (assuming I and J are interchangeable) the table becomes: 3.
P I B K T
L R C N U
A E D O V
Y X G Q W
F M H S Z
Encrypting the message "Hide the gold in the tree stump": 1. The pair HI forms a rectangle, replace it with BM
6. The pair DI forms a rectangle, replace it with BE 7. The pair NT forms a rectangle, replace it with KU 8. The pair HE forms a rectangle, replace it with DM 9. The pair TR forms a rectangle, replace it with UI 10. The pair EX (X inserted to split EE) is in a row, replace it with XM
11. The pair ES forms a rectangle, replace it with MO 12. The pair TU is in a row, replace it with UV
13. The pair MP forms a rectangle, replace it with IF BM OD ZB XD NA BE KU DM UI XM MO UV IF Thus the message "Hide the gold in the tree stump" becomes "BMODZBXDNABEKUDMUIXMMOUVIF".