预定/报价
COMP3621 Advanced Data Structures
珠玉2024-04-12 14:39:41
COMP 3621 (Winter 20204)
Advanced Data Structures
Lab 3 — Bitmap Steganography
You are going to produce a modified version of BitmapHacker named BitmapHacker2. Sub mit both Pixel.java and BitmapHacker2.java to Moodle (you can also update Pixel.java if there were things you needed to fix in your earlier version). Note that you do not need to include a main method in the code you submit (but, of course, you should perform your own extensive testing).
Overview
Your challenge is to enhance BitmapHacker.java to perform steganography, which is the art and science of hiding information, often inside other information. This differs from cryptog
raphy, which involves transforming information in order to protect it from adversaries, but not necessarily concealing the presence of the information.
In particular, your goal is to hide information inside Bitmap files (uncompressed, 24-bit-color Bitmap files), and also to extract such hidden information. For most BMP images, it is pos sible to hide 6 bits inside each pixel without altering the image in a way that is noticeable to the human eye. This is done by replacing the least significant 2 bits of each color component
of some of the pixels with 2 bits of hidden information. Because these are the low-end bits, modifying them rarely alters the appearance of the image perceptibly. (Note that we’re only
playing around with pixel data; we don’t touch the header portion of a BMP file, in order to avoid corrupting the file.)
To be precise, suppose you want to hide a file of length B bytes inside a BMP file. Form an int array of length B + 4, each position of which will store a single byte as a value in the
range 0 . . . 255. Use the first 4 positions to encode the value B as a 4-byte (32-bit) integer in the little-endian format. Then fill the remaining positions in the array with the bytes of the file in order (so the first byte of the file goes in the 5-th position in the array, i.e., in the position with index 4). This array of data can be hidden inside a BMP file as long as the number of bits it contains is less than or equal to the “hiding room” of the BMP file, which is 6 bits per pixel.
(As you may have guessed, the reason for including the length of the to-be-hidden file in the hidden data is that this makes it possible for an extraction procedure to determine how many bytes to extract.)
To be even more precise, suppose the bytes in the array are x0, x1, x2, . . ..

• The 2 most significant bits of x0 will replace the 2 least significant bits of the red component of the pixel in row 0, column 0. (To be even more precise, the most  significant bit of x0 will replace the second least significant bit of the red component of this top-left pixel.)

• The 3-rd and 4-th most significant bits of x0 will replace the 2 least significant bits of the green component of the pixel in row 0, column 0.
• The 5-th and 6-th most significant bits of x0 will replace the 2 least significant bits of the blue component of the pixel in row 0, column 0.
• The two least significant bits of x0 will replace the 2 least significant bits of the red component of the pixel in row 0, column 1.

• . . . and so on . . .

my wechat:_0206girl
Don't hesitate to contact me