CSC 101 Lab Weeks 8 and 9
Security Lab




ISSUED: Friday, 18 May 2012
DUE: Lab 8: Wednesday 23 May 2012, by the end of lab
Feedback: Friday 25 May, during lab
POINTS POSSIBLE: 1
WEIGHT: 1% of total class grade

Specification of Program Caesar

This assignment requires you to write a program that will encipher text using the basic Caesar cipher. This cipher is fairly simple to implement, but the point of the assignment is to write code that is as robust as possible.

The Caesar cipher is an alphabetic shift cipher, which is a type of substitution cipher. This is the simplest and most widely known cipher. It works simply by shifting the alphabet by a specific shift size so that with a shift of 4, an 'a' in the plaintext would be replaced by a 'd' in the ciphertext.

Example:

Shift size: 6
Plaintext (P):    TOBEORNOTTOBE
Ciphertext (C):   ZUHKUXTUZZUHK

Details of the Program

Sample Runs

If there are no command-line arguments, then the program will prompt for and read three values from stdin, like you did in lab 7. For example, here's what it looks like with three command-line args:

caesar 6 intext ciphertext
where "intext" and "ciphertext" are the names of files. If you run the program without command-line arguments, then it will look like this:
caesar
Shift Size: 6
Plain Text File: intext
Cipher Text File: ciphertext
Again, this is just like what you did in lab 7, where the program either reads command-line args, or inputs from stdin if there are no command-line args.

Resources

  1. Useful library functions, constants, and variables:

  2. You can read the UNIX man pages for any of the preceding functions. For example, to read the man page for perror, type the following on a terminal:
    man perror
    
    You can read man pages in emacs by typing <escape>x man, and then entering the name of the man page after the "Manual entry:" prompt.

  3. Some resources on robust programming will be discussed during the Friday lab presentation, and you can do your own internet search on the subject. Here are some specific suggestions from Tanya:

Collaboration

Unlike previous labs, you will work individually on labs 8 and 9.

Submitting and Receiving Feedback on Your Work

On or before the end of lab on Wednesday May 23, submit your work as follows:

handin gfisher 101_lab8 caesar.c

During the lab on Friday May 25, you will meet with security clinician Tanya to examine potential flaws in robustness and what to do to fix the flaws. Remember, you are trying to catch these things before she does, but the important lesson to learn is how to fix them. You will be graded on participation in the clinic and completeness of the second version of the program, which will be the deliverable for Lab 9.

Lab Schedule for Weeks 8 through 10