Lecture 33, CS 302-7 and 8, April 13

  1. Exam 2 – talk about next week
    1. Don’t stress out too much – it’s supposed to be hard
  2. Today – something fun!
    1. You are not responsible for this material…
  3. Steganography
    1. Subset of cryptography
    2. “art and science of writing hidden messages in such a way that no one, apart from the sender and intended recipient, suspects the existence of the message, a form of security through obscurity”
    3. Why?  Messages don’t attract attention, unlike normal cryptography
    4. http://en.wikipedia.org/wiki/Steganography
  4. How?
    1. There are all sorts of different ways
    2. See wikipedia for some history
  5. Our example:
    1. Digital Steganography
    2. Concealing messages within the lowest bits of noisy images or sound files.

                                                               i.     Basically, we won’t notice tiny changes to a picture, but we can use that info to store text

  1. Things we’ll need in order to do this
    1. How are images represented in computers?

                                                               i.     There are various image file types

                                                             ii.     We’ll just focused on uncompressed images, using the .bmp format

                                                            iii.     You can think of these images as a 3d array – indexed by X, Y, and RGB

1.    Note – this is a bit of a simplification of how they are actually stored, but we can represent them this way.

    1. How are colors represented?

                                                               i.     RGB

1.    0-255 for each

    1. ImageReader.java

                                                               i.     Won’t show this class

                                                             ii.     Two static methods – readFile and writeFile

1.    Takes a filename, and either reads that file into a 3d array of ints, or writes to that file from a 3d array of ints

  1. How will we actually do the encoding/decoding?
    1. Based upon least significant digit of the red color component.

                                                               i.     If it’s odd, that means that we are currently encoding a piece of text

                                                             ii.     If it’s even, that represents the boundary between characters

    1. How are we encoding?

                                                               i.     We’ll use the ASCII representation of a character.

                                                             ii.     This is a numeric representation of a character

                                                            iii.     http://en.wikipedia.org/wiki/ASCII#ASCII_printable_characters

                                                           iv.     So, if we see x odds in a row, that translates to the ASCII character represented by x

                                                             v.     We reset our counter when we see an even value

    1. Potential issue – junk in picture

                                                               i.     There’s a pretty random distribution of even/odd red color components in a given picture

                                                             ii.     So, before we encode anything, we first must have a ‘blank slate’

1.    We can do this by setting every R pixel to an even value

    1. Is this a good way of doing this?  No…but it’s easy
  1. Finally, decoding…
    1. Read over the pixels in our image, keep track of how many odd reds we see in a row, and when we see an even translate that number into a character
  2. Steganography.java
  3. Homework – For Monday – 8.1-8.3 (8.3 is review)