Enigma Machine

Enigma Machine
German Enigma Machine

Friday, May 15, 2009

Polyalphabetic Ciphers




Well, I've been gone for a while. Things have been busy. I'm going to try to be more regular at this again.




So let's start talking about more substitution ciphers. This time, we'll look at Polyalphabetic ciphers. Remember that Monoalphabetic substitution ciphers used an alphabet that mapped your plaintext characters into the associated ciphertext character. But since there was only one map or table, the same substitution takes place each time a particular character shows up (i.e. 's' always becomes 't' when the alphabet is shifted by 1 place). This is a problem because it allows someone trying to break your code to use character frequency counting to guess at which characters translate to certain frequently used characters. Also, doubled characters are easy to pick out (i.e. 'see' becomes 'tff' since 'e' always becomes 'f').


Starting in the 1500s and 1600s, some people began devising ways of using multiple alphabets within an encoded message (hence, the term 'polyalphabetic'). These maps or tables were either fixed (as with Trimethius' Tabula Recta) or could be based on key words or phrases (Vignere's table). The former used 24 alphabets each shifted 1 additional character to the left. The characters 'i' and 'j' were considered equivalent as well as 'u' and 'v' leaving 24 different alphabets. Successive characters in a message used the next alphabet down for translation. After 24 characters, the encoding with start with the original alphabet again. This masked patterns found in monoalphabetic methods (i.e. the double character problem). Vignere's table as a square with the alphabet across the top and down the left side. A keyword or phrase would be picked and that would be used as the key 'alphabet' to use for each successive character. The keyword was repeated as many times as needed to cover the original message.



Here is part of the table:




a b c d e f g h i …
A A B C D E F G H I …
B B C D E F G H I J …
C C D E F G H I J K …
D D E F G H I J K L
...


The full table is 26x26. The labels on the top (lowercase) are the letters from the plaintext. The letters along the side are from the 'keyword' and select the alphabet used for each successive letter. Using the keyword 'CAB', we can encode the word 'cage' as follows:




c a g e
C A B C
e a h g


The final ciphertext is 'eahg'. For longer messages, this would skew character count statistics. Additionally, using a longer keyword or phrase would be much stronger. You may want to write out the whole 26x26 table and try this with a much longer message and a longer keyword or phrase. Next time, we will look at other polyalphabetic ciphers with some more interesting properties.



Enjoy.

No comments: