Mia a naughty young girl who’s been grounded for a week. She wants to sneak out for desert with her friends but obviously can’t let her dad know about it. She’s not allowed to use her cellphone, so the only way for her to call her friends is using the good old landline in her dad’s room.
Since she regularly gets grounded, she and her friends have worked out a simple system for sharing secrets. When she says, “have you read the book I told you about” she actually means “let’s sneak out tonight”. When she says something about “page 10” of the book, she means “pick me up at 10 pm”. Continuing the logic, page 11 would mean 11 pm and so on.
So on the phone she asks her friend “Have you read the book I told you about? Page 12 is really funny”, she means, “Let’s sneak out tonight, pick me up at midnight”.
What we have just seen is cryptography (and a rebellious teenager) in action in the real world.
The sentence “Let’s sneak out tonight, pick me up at midnight” is plain text – what Mia actually wants to convey. The sentence “Have you read the book I told you about? Page 12 is really funny" is the cipher text – something that an adversary (her dad in this case) should not be able to understand.
Encryption is the process of converting plain text to cipher text. The reverse process is decryption.
This science of encrypting and decrypting messages (cryptography) has been used for thousands of years. It is believed that when Julius Caesar sent messages to his generals, he replaced every A in his messages with a D, every B with an E, and so on through the alphabet. Only someone who knew the “shift by 3” rule could decipher his messages.
For example, if we want to encode the word “SECRET” using Caesar’s key value of 3, we offset the alphabet so that the 3rd letter down, (D), begins the alphabet.
So, starting with ABCDEFGHIJKLMNOPQRSTUVWXYZ
and sliding everything up by 3, you get
where D=A, E=B, F=C, and so on.
Using this scheme, the plaintext, “SECRET” encrypts as “VHFUHW”. To allow someone else to read the cipher text, you tell him or her that the key is 3. This method is called symmetric cryptography and involves using the same key for encrypting as well as decrypting a message. This naturally poses a serious problem – what if an adversary gets hold of this key? At some point of time the sender and receiver need to exchange the key. That’s when an adversary could get hold of the key. In modern cryptography, keys are really large numbers.
The secure-key-exchange problem was solved with the birth of asymmetric key cryptography – in which two different but related keys are used - the public key to encrypt data and the corresponding private key to decrypt the data. If Mia were to send an encrypted message to Karan, she would encrypt the message using his public key (which is available to the world). Once encrypted, the message can only be decrypted using Karan’s private key (which would only be available to Karan).