CSC350 - Lab 1
Least Significant Bit

Assigned Aug 28th
Due Sep 4th Beginning of Class


Part 1 - Security

Write your answers to the following questions in a file called lab1.txt. State why you feel your answer is correct.

  1. Which security services are guaranteed by the post office when using Certified mail?

  2. Which type of security attack is being used when a student breaks into a professor's office to obtain a copy of the next day's test?

  3. Which security mechanism is provided when a bank requires the customer's signature for a withdrawl?

  4. Is it cryptography or steganography when a student writes the answers to a test on a small piece of paper, rolls up the paper, inserts it in a ball-point pen, and passes the pen to another student?

Part 2 - Least Significant Bit

Implement the algorithm discussed on page 11 of the textbook for encoding and decoding messages in the least significant bit of an image file.

Download the following files:

They will provide a skeleton for your code. You may write whatever additional methods you feel are necessary to complete this lab, be sure to fully document your code. You should not have to change anything in Picture.java, only LSB.java.

To decode a message from a picture, the command will be

java LSB image.png D

and to encode a message, the command will be

java LSB image.jpg E "My Message Here" image.png

You will need to add code to LSB.java in three places:

  1. Message Conversion

    When encoding, the message must be translated into binary numbers. When decoding, you will need to translate binary numbers back into text.

  2. Message Decoding

    Start with the first pixel in the upper-left corner, you will need to extract the message from the image. Each pixel should be examined in order of Red, Green, Blue. If the number is odd, record a 1, if the number is even, record a 0.

  3. Message Encoding

    To encode a message, again start in the upper-left corner of the image. In each pixel, proceed through the colors in order Red, Green, Blue. If the value is odd for that color, but should be even according to the current binary digit, subtract 1. If the value is even for that color, but should be odd according to the current binary digit, add 1.

You must decode the following images, and write the encoded message in your lab1.txt file:

In addition, you must encode a message of your own, using an image of your choosing. Save the encoded image as "myimage.png".

What to turn in

  1. LSB.java
  2. Picture.java
  3. lab1.txt
  4. myimage.png
To hand in your Lab 1 files, follow the steps listed below from the Wright Lab computers:
  1. Open the Terminal application.
  2. SSH with ssh username@cs.centenary.edu to connect with the cs server.
  3. Type in your password.
  4. Make a new directory with mkdir csc350
  5. Make a new directory with mkdir csc350/lab1
  6. Log out of the cs server with logout
  7. Change to the directory where you have your files on the local computer.
  8. Securely copy your files to your directory with scp filenames username@cs.centenary.edu:"csc350/lab1"