Steganography is the technique of hiding secret messages/information within other non-secret data/information. One popular way of steganography...

90.2K

Verified Solution

Question

Programming

Steganography is the technique of hiding secretmessages/information within other non-secret data/information. Onepopular way of steganography is hiding text (plaintext) withinimages (cover text). Each image is a collection of pixels, whereeach pixel is typically represented by 3 values (RGB). Each of R,G, and B is a value between 0 and 255 and thus can be representedby 8 bits. The color of the pixel depends on these values. However,if the least significant bit (last bit from the right) is changedfor each of R, G, B then the resulting change in pixel color maynot be noticeable. Using this fact, we can convert a text messageto bits and embed them one by one in R, G, B values of the pixel.That is, each R, G, B value’s last bit actually carries one bit ofthe secret message. This is one way to create a covert (secret)channel to pass information. Upon receipt of the image, thereceiver can extract the last bit from each R, G, B and combinethem to reveal the secret message. In this assignment, we willfollow this simple version of LSB algorithm. The students arerequired to write a Java program that can embed and extract asimple text message into a chosen PNG image. The program shouldalso allow extraction of the message from the stegotext image. Inparticular, the program should do the following: 1. Prompts user toenter a choice of PNG image to hide a text message. 2. Prompts userto enter the text message that is to be hidden. 3. Create amodified image after hiding the text message (as explained above)and save the image as a new PNG picture. 4. Display the hiddenmessage when a PNG image is supplied. [For testing purpose, theuser may choose to use a different image file that already has amessage hidden into it following the above scheme.] [Hint: a sampleJava code (PixelData.java) is provided on BlazeVIEW to give an ideahow to get R, G, B values of a pixel in a PNG image. You can buildon that, but you need to explore BufferedImage class, Color class,ImageIO package in JavaFX, getRGB(), setRGB() methods etc.from JavaAPI.] [This program is simple in terms of coding complexity (use ofsimple loops and arrays), but the logic (design of the steps)should be carefully thought of. Also, it is important to use theJava API methods appropriately. ]

Answer & Explanation Solved by verified expert
3.6 Ratings (291 Votes)
import javautil import javaio import javamathBigInteger import javaximageioImageIO import javaawtColor import javaawtimageBufferedImage public class HidingText private static int PixelDataBufferedImage img int x int y int argb imggetRGBx y int rgb new int3 rgb0 argb 16 0xff Red rgb1 argb 8 0xff Green rgb2 argb 0xff Blue 0xff is hex for 255 and used as a mask to get last 8 bits of a bit string SystemoutprintlnRed rgb0 Green rgb1 Blue rgb2 return rgb public static    See Answer
Get Answers to Unlimited Questions

Join us to gain access to millions of questions and expert answers. Enjoy exclusive benefits tailored just for you!

Membership Benefits:
  • Unlimited Question Access with detailed Answers
  • Zin AI - 3 Million Words
  • 10 Dall-E 3 Images
  • 20 Plot Generations
  • Conversation with Dialogue Memory
  • No Ads, Ever!
  • Access to Our Best AI Platform: Flex AI - Your personal assistant for all your inquiries!
Become a Member

Other questions asked by students