






Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
The basics of cryptography and encryption systems. It also introduces the Caesar Shift Cipher and modular arithmetic. problems for practice.
Typology: Study notes
1 / 11
This page cannot be seen from the preview
Don't miss anything!







People have always been interested in writing secret messages. In ancient times, people had to write secret messages to keep messengers and interceptors from reading their private information. In the modern day, computers help us write secret messages to protect our credit card information, personal information, and anything sent over the internet.
Alice and Bob want to send secret messages. They meet in private to decide what kind of key they want to use. Alice uses the secret key to write Bob messages (encryption). Bob uses it to figure out what Alice said (decryption). If Eve intercepts the message as it’s being sent from Alice to Bob, we need to make sure that Eve can’t figure out what they said. If she can, then we don’t have a secure cipher.
We write the alphabet A through Z and then shift the letters as seen below:
In this example, we shifted the letters over by one. In general, we can shift the letters over by n for any n. Encrypting: Alice creates a message to encode. She then shifts the alphabet over by n. Then for every letter in her message, she finds it in the top alphabet and then replaces it with its corresponding letter in the bottom alphabet. Decrypting: Bob must know the secret key, namely n. He shifts the alphabet over by n. He looks up each of the encoded letters in the bottom alphabet and replaces it by the corresponding letter in the top alphabet.
Problem 1: Encrypt THE QUICK BROWN FOX using this Caesar Shift.
Problem 2: Encrypt MATH IS FUN using a Caesar Shift of 5.
Problem 6: How many different Caesar Shift ciphers are there?
Problem 7: Alice decides the Caesar Shift cipher is too easy to break. She decides to use 50 different Caesar Shift ciphers when encrypting a message. She believes that in doing so, there are now 2650 different ways to choose 50 different Caesar Shift ciphers. Is Alice wrong? Why is this a good/bad idea?
Final Thought: Should we use this cipher in modern times?
Perhaps you thought we didn’t really use any math in the Caesar shift cipher. We can make a more “mathy” version by introducing some facts about modular arithmetic: Modular arithmetic finds the remainder of a division problem. If we write a (mod b) , we are finding r = remainder of 𝒂𝒃. So our solution r will always be less than b.
Here are a couple examples: 5 (mod 7) = 5 since 5 < 7
4 (mod 2) = 0 since 𝟒𝟐 = 𝟐 with remainder 0
6 (mod 4) = 2 since 𝟔𝟒 = 𝟏 with remainder 2
We can add remainders together in the natural way: If a (mod b) = g and c (mod b) = h then (a+b) (mod b) = g+h (mod b). Whenever we perform an operation using modular arithmetic, we must reduce the number modulo b.
Problem 1: What is 51 (mod 4)?
Problem 2: What is (500 + 160) (mod 2)?
Problem 3: What are the only possible solutions for x (mod 4)?
Problem 4: In general, what are the possible solutions for x (mod n)?
Before, when we talked about the Caesar cipher, we used the formula m (mod 26) where m stood for a letter in the alphabet. Now, we will generalize this cipher to mx + y (mod 26) where m stands for a letter in the alphabet (counting from A = 0 to Z= 25) and x,y are any natural number. This is called the Affine cipher. Encrypting: We encode as above, determining M = mx+y (mod 26) for each letter in the plaintext and converting this numbers to letters. Decrypting: To decode, Bob must know the secret key , namely x and y. He must also know how to find a multiplicative inverse. He then can decrypt the message by using the following formula: x- (^1) (M – y) (mod 26) = m.
Problem 1: Encrypt HELLO using x = 3, y = 1.
Problem 2: Decrypt MCHX using x = 3, y = 2.
Problem 3: For what values of x can we use this encryption system? Think about the decryption step.
Problem 4: How many possible ciphers are there? Think about the choices for x and for y.
Final Thought: Should we use this cipher today?
Problem 2: Decrypt the following message using length 4: INLRREINVCFIIAOA.
Problem 3: Eve intercepted the following message. Help her break it: HYDAMAPOYPNZ.
Problem 4: If Eve intercepts a message with n letters in it, what techniques do you use to break it?
Problem 5: How can you make your messages more secure?
Problem 6: What are the maximum number of matrices you need to try to break a message?
Final Thought: Should we use this cipher in modern day?
Bonus Problem 1: Encrypt a message using any of the ciphers we talked about today. Exchange messages with your partner, but don’t tell them how you encrypted it. Try to break your partner’s message.
Bonus Problem 2: Create your own cipher. Encrypt a short sentence using this cipher. Explain how it works to your partner and have him or her decipher the message.