0% found this document useful (0 votes)
61 views4 pages

APCSA Steganography Lab A2

Uploaded by

owlsdonthavebugs
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
61 views4 pages

APCSA Steganography Lab A2

Uploaded by

owlsdonthavebugs
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Name:

Date:

In original form, arch.jpg is 360 X 480, while beach.jpg is 640 X 480.

Recall from Activity 1 that changing the lowest two bits of each color in all pixels of an
image did not noticeably change the image. Taking advantage of this will allow hiding
secret.jpg source.jpg
two bits of each color in all pixels of source.jpg with the highest two bits of each
color in all pixels of secret.jpg

source pixel: java.awt.Color[r=104,g=89,b=191]


secret pixel: java.awt.Color[r=221,g=193,b=47]
combined pixel: java.awt.Color[r=107,g=91,b=188]
revealed pixel: java.awt.Color[r=192,g=192,b=0]

Student Lab Handout 7


If the top left pixel of source.jpg has the color java.awt.Color[r=234,g=172,
b=92] and the top left pixel of secret.jpg has the color java.awt.
Color[r=120,g=34,b=196] then what would be the color of the top left pixel of the
combined image?

What would be the color of the top left pixel of the revealed image?

Why are the lowest two bits of each color in all pixels in source.jpg replaced
rather than the highest two bits?

Why are the highest two bits of each color in all pixels in secret.jpg used in the
resulting image rather than the lowest two bits?

After arch.jpg has been hidden in another image and then revealed, the revealed
image is shown below. It almost looks pixelated. Why?

8 Student Lab Handout


Write the static method canHide
checks picture sizes to make sure you can hide the secret in source. For now, this
method should check if the two images are the same size, returning true if the two
pictures have the same height and width, and false otherwise. This method will be
main to test this method.

Write the static method hidePicture


and hides the secret in source using the algorithm previously discussed, returning the
new picture. Add code to main to test this method.

One iterative process can trigger a second iterative process, requiring the

process provides input values through control variables for the second
process. Regardless of where the iterative statement is in the overall
program code, the only control variables that are changing are within that
iteration statement.

Verify that the method revealPicture added to the Steganography class

reveals the secret picture by returning a new picture containing only the hidden pixels.

Write the main method which should construct two images and call canHide
with them. If canHide returns true, the method calls hidePicture, calls explore
on the picture returned, calls revealPicture and then calls explore on the new
picture.

Student Lab Handout 9


would need to change to allow a smaller image to be hidden in a larger image at a
random location.

How could the hiding algorithm be altered so the revealed image is more like the

10 Student Lab Handout

You might also like