CIS 459.21 LAB2

*** Due Date: Wednesday 4/27/2005 11:59pm ***


Points: 100


In this lab, you are hired as a security developer and your employer asks you to design, implement and test a set of API that can encrypt an input sentence (assume less than 20 characters) with three different security levels:

  1. simple encryption: replace each letter with its next lexicographical letter, e.g., "Good" will be "Hppe".
  2. medium encryption: add to each letter with its index in the actual sentence, e.g., "Good" will be "Gpqg".
  3. ultra encryption: add to each letter with the square of its index in the actual sentence, e.g., "Good" will be "Gpsm".

Note: if a resulting letter is more than 'Z' or "z", just wrap around. That is to day, given a sentence "end zone", in the first case, your encryption is "doe apof"; in the second case, your encryption is "eof dttl", and so on. You are also given an incomplete driver program, lab2.c, that contains the main function. You need to do the following:

  1. Define a header file as encrypt.h, basically including the prototype function definitions for the three cases;
  2. You need to provide an implementation, encrypt.c, for the functions defined in the above API header file.
  3. You need to complete the main program by filling in the main program with correct functions calls to your API.


With your interests in 459.21, I am assuming you are interested in system programming. So you are required to meet the following requirements:

  1. Document your programs well.
  2. Following a good coding style (see course page for links to different coding styles).
    In the worst case, use the indent program to process your source file before your submission.
  3. Provide a Makefile that compile your API header and source files first, and compile your program lab2.c in a separate step.
    Your Makefile must have at least two targets: lab2 and clean.
    A sample Makefile is provided here. A link to GNU Makefile manual is available here.


When you finish with the lab, you need to turn it in for grading. The submit command submits your lab electronically. You MUST use the submit command to turn in your labs. The format of submit command is as follows:

submit classname labname files-to-submit

where, to submit your first lab for this class, use the following command from the directory which contains your files (lab2.c and Makefile):

submit c459.21aa lab2 lab2.c Makefile encrypt.c encrypt.h

Last updated: Sun Apr 10 00:00:45 EDT 2005