Bring a laptop to recitation if you want help in getting Eclipse up and running. Otherwise you won't need a laptop, but you're welcome to bring one. The recitation will be discussion and thinking rather than coding via Eclipse. You may sometimes code-on-paper.


Name: _____________________  Netid: _________________
 



This week's recitation covers three things:
  1. Installing Eclipse (if you haven't done that)

  2. Looking at the code for the Steganography assignment.

  3. Thinking about thte apts for this week -- to help with that here are some Java idioms for APTs that are due in the first week.

Steganography

HideImage

  1. You have a handout of the code for the Java class ClearBitsFromImage used to demonstrate pixels and the Picture class that's used in Steganography. What are the three individual RGB values returned in the Color/Pixel value from the method reduce when the parameter passed to it has RGB values (40, 102, 13)?
    
    
    
    
    
    
    
    
    
    
  2. In the Java class HideImage there are no methods other than main. Write a header for a method that will take the source image, the target image, and the number of bits that the user enters and that will return a new image in which the source is embedded or hidden in the target. Write just the method header or prototype -- call the method getHiddenPicture
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
  3. For the assignment you must write a class HideText modeled on the HideImage class. In recitation you'll go over how to start writing from scratch the HideText class by copy/pasting to get things going.
    
    
    
    
    
    
    
    
  4. When hiding text, the Steganography assignment suggests using a method that takes an array of byte values and returns a new array consisting of either the one- or two-bit chunks taken from the byte values. Write this method, for example, given a two byte array of [78,100] where values are shown in binary as: [01001110, 01100100] the method would return an 8-byte array with the following values [01, 00, 11, 10, 01, 10, 01, 00]. Creating this new array will make it easier to hide the two-bit chunks in an image. Your program won't deal explicitly with binary values. To get the two-bit chunks you'll just mod/% by 4 and then divide by 4 to get each chunk.

    For example, the binary value 01001110 above is 78. If you repeatedly mod and div by 4 starting with 78 you get:

       78 % 4 = 2   store 2 bit chunk
       78 / 4 = 19
       19 % 4 = 3   store 2 bit chunk
       19 / 4 = 4
        4 % 4 = 0   store 2 bit chunk
        4 / 4 = 1
        1 % 4 = 1   store 2 bit cunk
    
    As you can see, the value 78 yields chunks [2,3,0,1] which in reverse order (most significant chunk to least) are 1,0,3,2 which in binary are 01, 00, 11, 10. Of course you write your program thinking about 78, not thinking about 01001110. You get the value 78 from a byte array.

    Write the method below which returns 2-bit chunks obtained from "chopping" them out of an array of byte/8-bit values. The new array will contain four times as many values (why?). The bit-chunks should be stored in the same order, i.e., most significant first. Look at the example above.

      // return all 2-bit chunks, in same order, from array
    
      public byte[] chunkize(byte[] array)
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
     
    
    
    
    
    
    
  5. In the APT Encryption that's due this week you have to find an encrypting string that's lexicographically smallest/first. In recitation you'll discuss this APT.