## Ciphers

The most basic kind of cipher is when a piece of text gets replaced with another substution cipher. Each single letter can be replaced or blocks of data can be replaced block ciphers Within this famlily there is monoalphabetic ciphers which take the original data and encryt it one piece at a time (I am using piece to describe a letter or symbol). So each piece of data is being independently encrypted/decrypted of the previous piece of data. In other words- one letter always maps to the same letter.

As an example the plaintext: *"the brown fox jumped over the lazy dog" * can be encrypted by shifting each character 3 places to the right. The ciphered text becomes *"wkh eurzq ira mxpshg ryhu wkh odcb grj"*

Below you can see the plaintext letter T becomes W when using a shift of 3

The key feature in breaking the above ciphertext is in the placement of the spaces; reason being becuase we know how many letters are in each word.
One solution is to put spaces at the same intervals. Our ciphertext now looks like *"wkhqu rqira mxpsh gryhu wkhod cbgrj".*

###### Keyed Alphabets

To increase the number of alphabets available for easy use, a common method is to use a keyword such as "VBTESTING," to generate an alphabet. The alphabet can be derived by removing the keyword and appending it to the end of the modified alphabet. Our alphabet would now be "ACDFGHJKLMOPQRUWXYZVBTESTING"

To make monoalphabetic ciphers more complex, we could use multiple ciphers within the data - polyalphabetic cipher. For Example: we could encrypt every odd character with a shift of 7 and encrypt every even character with a shift of 13. The downside to polyalphabetic ciphers is in their key complexity. If a key represents a set of k alphabets, then there are (26!)k different sets of alphabets that could be chosen. (26 multipled by 25, 24... down to 2 equals x. Then multiple x by itself k times.)

###### Vigenere Tableau

The VigenĂ¨re cipher is method of encrypting alphabetic text by using a series of interwoven Caesar ciphers, based on the letters of a keyword.

Seen below is the most common table used to select aphabets is the Vigenere Tableau.

To encrypt using the Vigenere Tableau, just match the current plaintext character with current character of the key. Using "the brown fox jumped over the lazy dog" as our plaintext and "vig" as our key- we look at the top of the table and find "t" then follow that column down until you reach "v" on the left side. The result is "opk wzurv ljf ppuvzl uqmx opk gift lub"

The above methods are all substitution ciphers, another general category of ciphers is transposition ciphers (aka permutation ciphers).
Unlike substiution ciphers, transposition ciphers do not change the actual characters. Instead, transposition ciphers shuffle around the characters.
Not a secure algorithm, but for an example- the plaintext *"transposition"* could be reversed to give us the ciphertext *"noitisopsnart"*

###### Columnar Transpositions

The most common and simple transposition columnar transposition. To use this method, imagine you are working on a spreadsheet with 7 columns; Each individiual character -from the plaintext- gets written into one cell until it fills up a row (7 letters), then move to the row below it and continue. The row length (columns) is referred to as k.

The image below shows this using the plaintext *"you never run out of things that can go wrong"*

To encrypt this plaintext with k=7, we read from the 1st column, top to bottom, then the 2nd column ...etc. So the ciphertext would be *"yeuiaoortntwurogcrnufsaoenttnnvohhgg"*