

Using a short binary password is weak protection and using a long one is inconvenient. Submit LFSR.java, PhotoMagic.java, and a completed readme.txt file.Ĭhallenge for the bored 1. When implementing a class, include a comment next to each instance variable indicating its purpose, and one above each instance method documenting what it does. The file lfsr.zip contains a number of sample PNG files, including the ones used above an optional template for getting started with LFSR.java and this week's readme.txt template. You may assume that the arguments to transform() are not null.įiles for this assignment. Thus, for example, you can post a transformed picture on the web, but only friends who have the password (and your program) can see the original. Takes as input the transformed picture Xpipe.png (left) and displays as output the original picture pipe.png (right).Īnyone knowing this password and tap can recover the original picture, but another password won't work. Now, here's the magic: running the same program with the same binary password and tap on the transformed picture recovers the original picture! For example, typing Takes as input the picture pipe.png (left) and displays as output the transformed picture Xpipe.png (right). It must display the transformed picture on the screen, using the show() method in the Picture data type. The main() method takes three command-line arguments: the name of an image file, a binary password (the initial LFSR seed), and an integer (the tap position). Create a new Color object using the result of the xor operations, and set the pixel in the new picture to that color.

Do the same for the green (using another new 8-bit integer) and, finally, the blue.

Then, xor the red component with a newly-generated 8-bit integer. extract the red, green, and blue components of the color (each component is an integer between 0 and 255). The transform() method takes a Picture and an LFSR as arguments and returns a new Picture object that is the result of transforming the argument picture using the LFSR as follows: For each pixel ( col, row), in column-major order-(0, 0), (0, 1), (0, 2). The Picture data type is part of stdlib.jar the Color data type is a Java library. Your first task is to write a data type that simulates the operation of a LFSR by implementing the following API: public class LFSR Here are a few more details about the API.
