CS 102 (Spring 2003)
Quiz 4: Encryption using Exclusive-Or

Quiz Posted Given in class
31 Mar 1 Apr
  1. (25 points) Solve the encryption puzzle given in class, submitting that part in class
  2. Take the following problem home.

    Suppose the encrypted form of a password is stored as an array of bytes:

    byte[] encrypted;
    The above array is fully formed, and ready to send somewhere over a Socket.

    Your job is to transmit the encrypted password as a sequence of Color objects. Recall each Color object has three 8-bit fields that indicate how much red, green, and blue is in the Color.

    1. (25 points) First, show how a sequence of Color objects will represent the above byte array. Try to be efficient in your use of the Color objects, using all three, 8-bit fields if possible.

    2. You must then devise two protocols for transmitting the password.
      1. (25 points) One sends the data in binary -- the data is not printable ASCII characters in this case. The recipient must somehow know how many Colors you will be transmitting, so be sure to include that in your protocol.
      2. (25 points) The other sends the Color objects in ASCII, as a printable String. Here, you can use a space or some kind of terminating character to mark the end of what you transmit. The data you transmit must consist only of lower-case letters and digits (ASCII 0, 1, 2, ... 9)
    While we won't try to compile your solution, please express your answers in Java and pseudocode, in sufficient detail so the TAs can figure out how you will do the above things. Turn in the take-home part by 4 PM Monday, 7 April 2003 to my mailbox in Bryan 509

    Last modified 09:36:26 CST 01 April 2003 by Ron K. Cytron