Cryptography

1 Encryption, Decryption and Keys

Learn It

  • This module is going to focus on the science of Cryptography.
  • It begin with a small research project and conclude with the creation of some simple cryptography algorithms using Python.

Learn It

  • Alice and Bob are sitting in a classroom and want to send notes to each other, but Eve is sitting in-between them.
  • Alice can write a message onto a bit of paper, but she needs to pass it to Eve first.
  • Eve can then pass the message onto Bob, so Bob can read the message.
  • Can you see how this system is insecure? Eve is easily able to read the message before passing it onto Bob.

Try It

  • Assemble yourselves into teams of three.
  • Can two of you manage to write messages to each other in such away that the third member of your group is unable to read the message?

Learn It

  • The problem is that Alice and Bob are trying to send messages in what is called Plaintext. Plaintext doesn't necessarily have to be text. It is just any information that is being passed between participants that can easily be read by a third party without needing any special measures. Pictures, Video, Audio as well as Text can all be described as Plaintext.
  • If Alice and Bob want to communicate privately, they'll need to Encrypt their messages.
  • Encryption converts information into what is known as Ciphertext. Ciphertext can't easily be read by Eve unless she knows the Key that was used to encrypt the message.
  • Let's look at an example.
    • Alice tells Bob the key she is going to use prior to the lesson.
    • The key is 'I'll write the message backwards'
    • Alice then writes down her Plaintext message on a piece of paper - I'm loving this lesson on Encryption
    • On a second piece of paper, Alice uses her key to encrypt the message. noitpyrcnE no nossel siht gnivol m'I
    • Alice can then pass the message to Eve, who can't read it (well not quickly anyway).
    • Eve passes the message onto Bob.
    • Bob (knowing the key) can then decrypt the Ciphertext and write out the Plaintext.
  • Of course the encryption method shown above isn't very secure. We'd call it weak encryption.

Research It

  • Encryption methods have been used for millennia by various people.
  • Watch the video below and then answer the questions in the Badge It section.

Badge It - Silver and Gold

  • When you are ready, click here to take the quiz.
  • Silver: Achieve 4 out of 8
  • Gold: Achieve 6 out of 8

Learn It

  • Hopefully you can see that the Caesar Cipher isn't a particularly secure method of encrypting PlainText.
  • To try and combat Frequency Analysis the original Caesar Cipher was improved upon, by using more than one shift value.

Research It

  • Watch this video on the Vignere Cipher

Badge It - Platinum

  • In your own words (remember to use a text editor and the .txt extension), provide a brief description of how the Vigenere Cipher works.
  • Now try decrypting this message using the Vigenere Cipher and the key of "compsci"

Gbogqrbkcz bsmmu qabewvkqmiaqv uortj.

  • Keep the answer a secret so that your friends have to work it out themselves.