# Spy Game

Shodor > Interactivate > Lessons > Spy Game

### Abstract

Students will learn about modular arithmetic in order to decipher encrypted messages.

### Objectives

Upon completion of this lesson, students will:

### Student Prerequisites

• Technological: Students must be able to:
• perform basic mouse manipulations such as point, click and drag
• use a browser for experimenting with the activities

### Teacher Preparation

• paper
• pencil
• scissors
Prior to the lesson the teacher should prepare encrypted codes for the students to decipher.

### Key Terms

 affine cipher Affine ciphers use linear functions to scramble the letters of secret messages cipher Ciphers are codes for writing secret messages. Two simple types are shift ciphers and affine ciphers modular arithmetic A method for finding remainders where all the possible numbers (the numbers less than the divisor) are put in a circle, and then by counting around the circle the number of times of the number being divided, the remainder will be the final number landed on modulus A unit of measure. For example, when measuring days, a modulus could be 24 for the number of hours in a day. 75 hours would be divided by 24 to give 3 remainder 3, or 3 days and 3 hours. See also modular arithmetic

### Lesson Outline

1. Focus and Review

• Have a clock drawn on the board with hands aligned as if it were 12:00.
• Ask the students according to the clock on the board what time it would be in:
• 3 hours
• 8 hours
• 13 hours
• 28 hours
• 334 hours
• Ask students to think about the answers for a moment. See if they can recognize a pattern that might make it easier to calculate an answer for the "What time will it be in 334 hours question?"

2. Objectives

• Students will demonstrate their ability to use modular math by deciphering several encrypted codes.

3. Teacher Input

• Explain to the students that an easy way to calculate what time it will be in x number of hours is to divide x by the number of hours on the face of the clock (the mod), take the remainder, and count that far on the clock.
• Introduce this method in writing. For example: 334 mod 12.
• As a class, calculate:
• 36 mod 6
• 53 mod 8
• 420 mod 22
Show how they can check their answers using the Clock Arithmetic Applet
• Explain the term multiplier.
• Explain how to decode a message if they are given the multiplier.

4. Guided Practice

• Have the students convert the alphabet into numbers setting A=0, B=1, C=2, etc.
• Tell the students to write a short sentence about themselves that they won't mind someone else reading.
• Have the students convert the letters in their sentence to numbers using the alphabet numbers they just calculated.
• Explain the term shift.
• Have the students shift their numbers by 5 and convert their list back into letters.
• Explain that their sentences should now look like a bunch of letters.
• Have the students swap messages and try to decode them using their current knowledge.

5. Independent Practice

• Have the students pair up and open the Caesar's Cipher applet.
• Have each student use the computer to encrypt a message by changing the constant value.
• Tell the students to swap messages with someone else in the class.
• Instruct the students to decode the message they received from their classmate.
• Now, have the students encrypt a message using a multiplier.
• Have the students swap messages and decode the message they receive.
• Explain that the messages you are about to pass out have been intercepted from a company that has discovered the fountain of youth and that the encrypted messages will lead them to the fountain.
• Hand out several messages for the students to decipher.
• Have the pairs of students work to decipher the codes.
• In order to ensure that each partner is doing an equivalent amount of work require that each student must be responsible for deciphering at least 3 messages.

6. Closure

• Once the first group has finished give the class 10 more minutes to work on completing deciphering their messages
• Review vocabulary
• Ask several groups to share their ciphers and solutions with the class

### Suggested Follow-Up

You may wish to follow-up with the Caesar Cipher 2 activity.  