How Encryption Works| Encryption For Dummies

Posted by in Articles, Hacks

Here we will look at an important connection between Julius Caesar and encryption. Caesar used to maintain the privacy of his communications by coding them. He would change the order of letters using a code known only to him and his generals, but if his enemies got hold of the key, they could decipher his messages.

cesar encryption

Mary Queen of Scots sent coded messages from prison using a more sophisticated cipher; rather than changing the order of letters she used letter substitution; however her code was vulnerable to cracking by analysing letter and symbol frequencies and distributions.

In the Second World War the discovery of its key meant that the Enigma code could be cracked, giving the allies a huge military advantage. The vulnerability there was that the key was transmitted as part of the message.

Modern encryption techniques are far more sophisticated, and its roots were laid in 1970. The technique is called public key cryptography.

Imagine a spy (Mr S) who needs to send a secret one letter message to a colleague (Mr C) announcing his arrival at a specific location. Mr S checks the public information on Mr C and sees that he has two numbers, his public key. These are 247 and 5. He wants to send the letter J, ASCII code 74.

Next he calculates 74 raised to the power 5, modulo 247. In other words the remainder after dividing 74 multiplied by itself 5 times and divided by 247. The answer is 120, so he simply sends this number to Mr C.

Mr C derived his public key 247 by multiplying two prime numbers together, 13 and 19. He also uses the same prime numbers to find a value for a so that 5a/(13-1)x(19-1) has a remainder of 1. The answer is 173, which is Mr C’s private key.

He now deciphers the number 120 by calculating the remainder when 120 is raised to the power of 173 and divided by 247 and finds the answer is 74, which he knows is ASCII code for J.

Naturally any hacker could factorise 247 and come up with its primes of 13 and 19, but if he used very large primes, say with 50 or so digits, then doing so would be impossible even using supercomputers.

Nowadays you can use add-on programmes to encrypt your email using public key cryptography. It is very straight forward and very secure, though it is possible that in the future it might be cracked by quantum computers.


This is a guest post by Adam a new Londoner, who has interests in recruitment, all things techie, a passion for travel and a love of fashion. He blogs about recruitment, travel and IT/technology as well as latest trends in men and women fashion.