caramelcode
2 min readDec 1, 2016

How to make your own Cipher Translator with Python?

Fascinated with Detective Conan? Sherlock Holmes?

With little knowledge in programming you can make your own cipher translator. Python syntax is easy to understand and has a big community to ask for.

At this era, we can easily know how to decode with a little googling, but, still will take us time before we can come up with the answer as deciphering has certain steps. Creating a program that will automate those steps will be much more convenient, isn’t it?

Let’s start with Vigenère cipher, it was invented by a Frenchman, Blaise de Vigenère in the 16th century. It is a best-known but simplified special case of polyalphabetic cipher that uses multiple substitution alphabets.

To encrypt or decrypt, a table of alphabets can be used, called “tabula recta”. It consists of the alphabet written out 26 times in different rows, each alphabet shifted cyclically to the left compared to the previous alphabet. At different points in the encryption process, the cipher uses a different alphabet from one of the rows. The alphabet used at each point depends on a repeating keyword.

Tabula Recta

So, if we are to cipher the word “SAMPLEDATA” using a keyword “KEYWORD”, in each row our reference will be the keyword and in column will be the word to cipher. Isn’t it familiar? correct! it has the same concept with multiplication table ;)

Example

To put it in code:

Vigenere Cipher

To decipher:

Decipher Vigenère Code

The algorithm used in the python code above was based on the steps we used in encrypting and decrypting the word “SAMPLEDATA” manually.

Try it out and be an instant detective. :)