Please enable JavaScript to use CodeHS

Encryption Ciphers

This tutorial goes over cryptography and a few well-known ciphers.

By Jennifer Campbell

Cryptography is the science of protecting information by encrypting and transforming it into a secure format.


Cryptography is a fun and interesting way to dive into the advanced encryption algorithms that have evolved over time and are used in today’s protection of privacy. This video reviews how mathematics and number theory are used in cryptography and encryption in credit cards, ISBNs, and more.

Source:

“The Framework: Cryptography”. BJU Press Homeschool. 2020. https://www.youtube.com/watch?v=FiKzB3FJbZc.


Alternative Videos:

“The Framework: Cryptography”. Video.Link. 2020. https://Video.Link/w/FwKN.



Substitution Cipher


A substitution cipher changes one character or symbol into another.



In this tutorial, you'll learn a few well-known ciphers and will be challenged to encode and decode messages using the cipher! If you haven't heard of the Caesar and Vigenère ciphers yet, you can learn about them here.

Challenge 1: Mixed Alphabet Cipher


A mixed alphabet cipher is a substitution cipher in which the encryption key is also a word that is used to create a substitution table.


For example, below is a substitution table created by using a key of “CODEHS”. The first letters are replaced by the letters in the key word and the rest of the substitution letters are the remaining letters in the alphabet.


KEY: CODEHS


With this key, how would you encrypt the word “ATTACK”? In the editor below, type in your answer and press Enter.


Other things to consider:

  1. What do you notice about the last couple of replacement letters when the key CODEHS is used?
  2. What might be a stronger key to use?
  3. What are the weaknesses of this encryption method?
  4. What is an advantage of using a key word instead of a random substitution?
  5. How could you make this cipher stronger?


Challenge 2: Pigpen Cipher

The Pigpen cipher is a simple substitution cipher that was originally invented in the 1500s! There are still surviving examples of letters written using this cipher found on Masonic medals, certificates, tokens, and even gravestones.


The cipher key is based on drawing the letters of the alphabet inside lines with circles.



When encrypting a message, the sender uses the line and dot combination to represent each letter.


Using this key, decrypt the message below. In the editor, type in your answer and press Enter.



Other things to consider:

  1. Is this cipher stronger than the Mixed Alphabet cipher? Why or why not?
  2. What is the main weakness of the PigPen cipher?


Use this fun encoder to create your own message to share with a friend!



Challenge 3: Rail Fence Cipher

The Rail Fence Cipher is not a substitution cipher but rather a transposition cipher. A transposition cipher shifts the positions of plaintext character (or groups of characters) according to a regular system. The plaintext here is written downwards and bounces back and forth on a diagonal. The ‘rails’ refers to the number of rows.


For example, the message “this is a secret message” would be written as follows using 3 rails:

The message is then written using the rows instead of the columns and grouped into blocks of five letters to become:


TIETS HSSSC EMSAE IAREG 


Using the rail fence cipher, decrypt the message below using 5 rails. If you get stuck or need help getting started, check out this resource (remove the spaces if using this resource).


THDHE AEELS DEGLN AA