Information About This Project
Steganography is related to cryptography and attempts to disguise a message
in a plaintext statement block.
Consider receiving the text message that is shown below.
the plaintext message reads as:
Hello Stan and Marilyn!
Let us meet for lunch
at noon on Tuesday.
We will be waiting
at the East building of
train station C.
I will ask Hank, Quincy,
Denise, Eddy and Roni
to join us there!
Best Regards,
KZ
Using the grid below, write the above message into the cells below – use one letter per cell. Use lower case letters.
| 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | |
| line 1 | H | e | l | l | o | S | t | a | n | a | n | d | M | a | r | i | l | y | n | ! | ||||
| line 2 | L | e | t | u | s | m | e | e | t | f | o | r | l | u | n | c | h | |||||||
| line 3 | a | t | n | o | o | n | o | n | T | u | e | s | d | a | y | . | ||||||||
| line 4 | W | e | w | i | l | l | b | e | w | a | i | t | i | n | g | |||||||||
| line 5 | a | t | t | h | e | E | a | s | t | b | u | i | l | d | i | n | g | o | f | |||||
| line 6 | t | r | a | i | n | s | t | a | t | i | o | n | C | . | ||||||||||
| line 7 | I | w | i | l | l | a | s | k | H | a | n | k | , | Q | u | i | n | c | y | , | ||||
| line 8 | D | e | n | i | s | e | , | E | d | d | y | a | n | d | R | o | n | i | ||||||
| line 9 | t | o | j | o | i | n | u | s | t | h | e | r | e | ! | ||||||||||
| line 10 | B | e | s | t | R | e | g | a | r | d | s | , | ||||||||||||
| line 11 | K | Z | ||||||||||||||||||||||
| line 12 |
Then attempt to extract a complete message from the plaintext.
A partial example of a practical covert, spy – like message that can be taken from the plaintext would be:
time to launch drone BETA
Steps to Complete This Project
STEP 1 Open Eclipse or NetBeans
Open Eclipse or NetBeans and create a Java project with the following details.
For Project Name include: Steganography
For the Main Class include: Steganography
In your Code window, shown below, copy in the program code shown in Figure 1 below, in the appropriate places, except substitute your own name in place of Sammy Student.
PROJECT Steganography and Secret Messages – Using Arrays in Java
Figure 1 Source Code for the Steganography Program
| import javax.swing.JOptionPane; //Sammy Student, Programmer public class Steganography public static void main(String args[]) // the plaintext message String line1 = “Hello Stan and Marilyn!”; String line2 = “Let us meet for lunch”; String line3 = “at noon on Tuesday.”; String line4 = “We will be waiting”; String line5 = “at the East building of”; String line6 = “train station C.”; String line7 = “I will ask Hank, Quincy,”; String line8 = “Denise, Eddy and Roni”; String line9 = “to join us there!”; String line10 = “Best Regards,”; String line11 = “KZ”; String message = “n”; // display the plaintext message message += “t” + line1 + “n”; message += “t” + line2 + “n”; message += “t” + line3 + “n”; message += “t” + line4 + “n”; message += “t” + line5 + “n”; message += “t” + line6 + “n”; message += “t” + line7 + “n”; message += “t” + line8 + “n”; message += “t” + line9 + “n”; message += “t” + line10 + “n”; message += “t” + line11 + “n”; JOptionPane.showMessageDialog(null, “Message: “ + message, “Plaintext Message”, JOptionPane.PLAIN_MESSAGE); // convert plaintext message to lower case line1 = line1.toLowerCase(); line2 = line2.toLowerCase(); line3 = line3.toLowerCase(); line4 = line4.toLowerCase(); line5 = line5.toLowerCase(); line6 = line6.toLowerCase(); line7 = line7.toLowerCase(); line8 = line8.toLowerCase(); line9 = line9.toLowerCase(); line10 = line10.toLowerCase(); line11 = line11.toLowerCase(); |
PROJECT Steganography and Secret Messages – Using Arrays in Java
Figure 1 Source Code for the Steganography Program ( continued )
| String plaintext = “n”; plaintext += “t” + line1 + “n”; plaintext += “t” + line2 + “n”; plaintext += “t” + line3 + “n”; plaintext += “t” + line4 + “n”; plaintext += “t” + line5 + “n”; plaintext += “t” + line6 + “n”; plaintext += “t” + line7 + “n”; plaintext += “t” + line8 + “n”; plaintext += “t” + line9 + “n”; plaintext += “t” + line10 + “n”; plaintext += “t” + line11 + “n”; JOptionPane.showMessageDialog(null, “Message (lower case): “ + plaintext, “Lower Case”, JOptionPane.PLAIN_MESSAGE); // define line messages field size with 20 indices int[] num = 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20; // define the key variable and message object int key = 0; StringBuilder s = new StringBuilder(); // build the secret message s.append(“n”); // new line key = num[7]; // t s.append(line1.substring(key, key + 1)); key = num[18]; // i s.append(line1.substring(key, key + 1)); key = num[7]; // m s.append(line2.substring(key, key + 1)); key = num[8]; // e s.append(line2.substring(key, key + 1)); s.append(” “); // space key = num[1]; // t s.append(line3.substring(key, key + 1)); key = num[5]; // o s.append(line3.substring(key, key + 1)); s.append(” “); // space |
PROJECT Steganography and Secret Messages – Using Arrays in Java
Figure 1 Source Code for the Steganography Program ( continued )
| key = num[5]; // l s.append(line4.substring(key, key + 1)); key = num[12]; // a s.append(line4.substring(key, key + 1)); key = num[13]; // u s.append(line5.substring(key, key + 1)); key = num[18]; // n s.append(line5.substring(key, key + 1)); key = num[14]; // c s.append(line6.substring(key, key + 1)); key = num[11]; // h s.append(line7.substring(key, key + 1)); s.append(“n”); // new line key = num[15]; // d s.append(line6.substring(key, key + 1)); key = num[15]; // r s.append(line6.substring(key, key + 1)); key = num[15]; // o s.append(line6.substring(key, key + 1)); key = num[15]; // n s.append(line6.substring(key, key + 1)); key = num[15]; // e s.append(line6.substring(key, key + 1)); s.append(” “); key = num[15]; // B s.append(line6.substring(key, key + 1)); key = num[15]; // E s.append(line6.substring(key, key + 1)); key = num[15]; // T s.append(line6.substring(key, key + 1)); key = num[15]; // A s.append(line6.substring(key, key + 1)); s.append(“n”); // new line System.out.println(“a steganography secret “ + s); JOptionPane.showMessageDialog(null, “Secret Message: “ + s, “Decoded”, JOptionPane.PLAIN_MESSAGE); |
PROJECT Steganography and Secret Messages – Using Arrays in Java
STEP 2 Build, Compile and Run the Program
From the menu select [ Run ] and click [ Run Project ] to run your app.
STEP 3 Test the Program
Once you have successfully compiled your program, review the output that appears in the message boxes that follow in Figure 2 .
The message boxes show the plaintext message in sentence case, the plaintext message in lower case and a semi – decoded message, with part of the secret message replaced with periods ( . ) .
time to launch
. . . . . . . . .
Review the decoding pattern in the starter code and modify the appropriate statements that such that your program will display the message below, without the periods ( . ) .
time to launch
drone BETA
Also, supplement your program code such that the lengths of the plaintext message and the decoded messages are displayed, such as in the messages boxes that follow.
Extra Credit: For extra credit, try to create a different secret agent type message from the existing plaintext message or by using your own plaintext message
PROJECT Steganography and Secret Messages – Using Arrays in Java
Figure 2 Initial Test Run
View less »
May 07 2018 06:29 PM
1 Approved Answer
Madhurima B answered on October 17, 2019
5 Ratings, (9 Votes)
package com.java;
import javax.swing.JOptionPane;
//MADHURIMA BANERJEE, Programmer
public class Steganography
public static void main(String[] args)
// TODO Auto-generated method stub
// the plaintext message
String line1 = Hello Stan and Marilyn!;
String line2 = Let us meet for lunch;
String line3 = at noon on Tuesday.;
String line4 = We will be waiting;
String line5 = at the East building of;
String line6 = train station C.;
String line7 = I will ask Hank, Quincy,;
String line8 = Denise, Eddy and Roni;
String line9 = to join us there!;
String line10 = Best Regards,;
String line11 = KZ;
String message = n;
// display the plaintext message
message += t + line1 + n;
message += t + line2 + n;
message += t + line3 + n;
message += t + line4 + n;
message += t + line5 + n;
message += t + line6 + n;
message += t + line7 + n;
message += t + line8 + n;
message += t + line9 + n;
message += t + line10 + n;
message += t + line11 + n;
JOptionPane.showMessageDialog(null, Message: + message,
Plaintext Message, JOptionPane.PLAIN_MESSAGE);
// convert plaintext message to lower case
line1 = line1.toLowerCase();
line2 = line2.toLowerCase();
line3 = line3.toLowerCase();
line4 = line4.toLowerCase(
The post Steganography is related to cryptography appeared first on My Assignment Online.