Affine Cipher

a (Digital Character)
a (Uppercase Character)
a (Lowercase Character)
b (Digital Character)
b (Uppercase Character)
b (Lowercase Character)

Affine Cipher is a type of monoalphabetic substitution cipher, where each letter in an alphabet is mapped to its numeric equivalent, encrypted using a simple mathematical function, and converted back to a letter. The formula used means that each letter encrypts to one other letter, and back again, meaning the cipher is essentially a standard substitution cipher with a rule governing which letter goes to which. As such, it has the weaknesses of all substitution ciphers. It encrypts a text using an affine function (f(x) = ax + b). [Wikipedia]

How it works?

Firstly, each character of the initial text (message to encrypt) is converted in a number from 0 to 25, corresponding to its position in the Latin alphabet which contains 26 letters --> (a = 0, b = 1 ... z = 25 ).

Then, each number obtained is transformed by an affine function (f(x) = ax + b). "x" is representing the number while "a" and "b" are defined during the encryption. "a" and "b" are the keys required to decrypt the final message.

If we take all the images and put them in a list, we obtain n numbers corresponding to n characters of the initial text. The next step consists in finding the values of modulo 26 of each number. (Modulo means remainder)

Example : Modulo 4 of 19 is 3 because 15 = 4 * 4 + 3 In the other hand, modulo 26 of 26 is 0 because 26 = 26 * 1 + 0

Therefore, we obtain a new list with n element, each between 0 and 25 both included. All these numbers are converted in letters of the Latin Alphabet using the tables below.

We finally create the final message by putting all the letters side by side.

In this example showing encryption and decryption, the alphabet is going to be the letters A through Z, and will have the corresponding values found in the following table.

ABCDEFGHIJKLMNOPQRSTUVWXYZ
012345678910111213141516171819202122232425


ROT13 Cipher is a simple letter substitution cipher with a specific key where the letters of the alphabet are offset 13 places.

ROT13 Cipher

ROT13 Cipher is a simple letter substitution cipher with a specific key where the letters of the alphabet are offset 13 places.
Simple Substitution Cipher is a cipher that has been in use for many hundreds of years. It basically consists of substituting every plaintext character for a different ciphertext character.

Simple Substitution Cipher

Simple Substitution Cipher is a cipher that has been in use for many hundreds of years. It basically consists of substituting every plaintext character for a different ciphertext character.
Running Key Cipher is a type of polyalphabetic substitution cipher in which a text, typically from a book, is used to provide a very long keystream.

Running Key Cipher

Running Key Cipher is a type of polyalphabetic substitution cipher in which a text, typically from a book, is used to provide a very long keystream.
Straddle Checkerboard Cipher is a substitution cipher, except that the substitutions are of variable length. It has formed a component of several impotant field ciphers, the most notable being the VIC cipher used by russian spies during the cold war.

Straddle Checkerboard Cipher

Straddle Checkerboard Cipher is a substitution cipher, except that the substitutions are of variable length. It has formed a component of several impotant field ciphers, the most notable being the VIC cipher used by russian spies during the cold war.