Encryption with Computer Science

                              

Length of lesson: 3-5 days

 

Description of the class:

                     Name of course: Algebra

 

TEKS

 

(7)  Solving problems. The student uses appropriate computer-based productivity tools to create and modify solutions to problems. The student is expected to:

 (C)  develop sequential and iterative algorithms and codes programs in prevailing computer languages to solve practical problems modeled from school and community;

(D)  code using various data types;

 

I.       Overview
            In this lesson the students will program computers to encrypt information and also to decrypt information. They will get into groups and have to implement each encryption scheme and a program that will decrypt them. If there is enough time the students can try to write programs that will break the encryption schemes.
 
II. Performance or learner outcomes

            The students should be able to program a computer to encrypt information, have a better understanding of the different encryption schemes and how they relate to each other, and gain an idea into the difficulty of breaking a code.

 

III. Resources, materials and supplies needed

            A computer lab, or at least one computer for each group.

 

IV. Supplementary materials, handouts. (Also address any safety issues

      Concerning equipment used)

            A handout giving the syntax of common language expressions in the programming language used

            A handout giving instructions on how to compile and run programs, dependent on the system and compiler used

            A reference program that reads in text from a file and outputs text to a file

 


Five-E Organization

Teacher Does                     Probing Questions                      Student Does       

Engage:

For the engagement the teacher should introduce the students to the computer. Depending on their familiarity with computers, the teacher should show them how to use the development environment to compile the sample program. The teacher should put the students into groups, and then lead the class as a whole to write a program for a shift cipher. If the students are having too much trouble then the teacher should help them write a few simpler programs.

What are the steps to compile a program? To run it?

 

How does it read in a file? Where must the file be? What must it’s name be?

 

What data does the program use?

 

 How is the data stored? What forms can it take?

 

What operation needs to be applied to the data for a shift cipher? How do you do that with a computer?

The students should get into groups. They should become familiar with the development environment and learn how to compile and run programs.

 

Then the class should write the program for a shift cipher together as they go over how to use the computer.

                                                   

Explore:

The students should, in their groups, write a program for each encryption scheme discussed in the unit. They should also write a program to decode each encryption scheme.

The teacher should monitor each group to make sure they understand how to translate the mathematical ideas into programs.

What is the method used for encryption?

 

What operations must be applied to the data?

 

How do you apply them? How do you reverse the application?

 

How should the data be stored?

 

 

The students should work in their groups to write the programs that will encode and decode for each encryption scheme.

    

Explain:

Interlaced with the exploration the teacher should allow groups that finished a particular encryption scheme to show off their programs.

What does […] do?

 

Why did you do it that way?

 

Is there another way you could have done it?

 

Did you find this method easy or difficult?

 

What is similar about the different encryption schemes? What is different?

The students should present their program. They should show the program and explain what it does to encode/decode the message. Then they should run their program on a sample data file.

The students in the other groups should pay attention and use the explanations to help them write their own programs.

                                               

Extend / Elaborate:

Each group will have to take a file (given to them by the teacher, perhaps a page from the web) and encode it with their different encryption schemes. Then the encrypted files will be posted and the groups will have to attempt to decrypt them. For some of the files the type of encryption used can be made public, or not at the teacher’s discretion.

What are the weaknesses of each encryption scheme?

 

How can those weaknesses be exploited?

 

How can the frequency of letters be used?

 

How can you use the computer to make cracking the code easier?

 

Can you attempt a “guess and check” at the key?

The students should attempt to crack the codes. If they get stuck then the idea that the computer can

   

  Evaluate:

The students will be evaluated by the programs that they create as well as the explanations that they give. The programs can be tested with input files other than the ones provided to the students to verify if their programs work in generality.


Extra credit can be given during the Elaboration phase, not only for correctly cracking a code but also for generating good ideas.