NIS Micro Project - 1
NIS Micro Project - 1
Micro - Project
On
Text Steganography
Submitted
By:
Laxman Nagnath Gunge 243214
Parina Shailesh Hedavkar 243215
Arya Mangesh Jadhav 243216
Bhumika Mukesh Jadhav 243217
For
Network and Information Security
(NIS 22620)
Faculty Name:
Mr. Deepak Kulkarni
Index
Sr No. Topic
1 Abstract
2 Introduction
7 Basic Concepts
9 Coding Implementation
11 Concept of Stegoanalysis
12 Real-world Applications
14 Conclusion
15 References
Abstract
Steganography is the art of hiding information within other less
conspicuous information to prevent eavesdropping by way of hiding its
existence in the first place. Image-based steganography is the most common
form, but text-based steganography can also be used. Text-based
steganography can be generally classified as format-based, linguistic, and
random/statistical generation. In general, random and statistically generated
methods create a cover text but do not necessarily make semantic sense; that
is, the subject matter of each sentence has little or no relation to the next
sentence. Linguistic steganography can use natural language processing to hide
information, but again, it is still subject to analysis, particularly if the basis for
the cover text is an existing document. Here, we examine the leading methods
of text-based steganography. We evaluate a variety of steganographic
techniques, including open space encoding, synonym replacement, UK/US
English translation algorithm, and Wayner’s Mimic Functions using five
benchmarks which compare speed, capacity, complexity, compromisability, and
size. We find that the best methods to hide information should not use a single
scheme, but a hybrid of many schemes. To further hide information, text
should be compressed, encrypted, and then hidden in a cover document.
Introduction
Encryption of messages is now common (Gupta et al., 2016). Popular
applications include messaging, email, and website queries. Whilst we feel
pretty secure in the knowledge that encryption takes place, the very existence
of the encryption can alert network peers, rogue routers, and so forth to the
presence of hidden information. Steganography is the art of hiding information
inside a carrier such as an image, a sound file, or network packets. The field of
steganography has had much research, especially with image-based
steganography, but less research has taken place with text-based
steganography. Beyond email and watermarking, steganography has not
become mainstream, yet the purpose of steganography is not to secure
information as encryption but to hide its very existence in the first place. The
origins of steganography were first coined by Trithemius, who coined
‘steganographia’, which means ‘concealed writing’ (Bennett, 2004). Today,
steganography has been extended to include not only text but also
images and any other object. For example, text can be embedded in images,
video or other objects and vice versa with enough data to hide information in
steganography can fall into five categories: images, video, audio, text
(Bhattacharyya et al., 2010) and other objects such as executables which does
not fit into the four original categories that Bhattacharyya described.
What is Text Steganography?
Text Steganography is defined as a type of steganography which involves
caching dispatches or secret information within a textbook document or other
textual data. In this system, we try to hide secret data with the help of each
letter of the word. It is challenging to describe, especially when the variations
or changes made are subtle.
Invisible Ink:
• People have used invisible ink for centuries! They'd write messages with
substances like lemon juice or milk, which are invisible when dry. The
message would only appear when the paper was heated.
• This was used a lot in spy stories, and also in real life.
Microdots:
• During World War II, spies used tiny photographs called microdots to
hide messages. They could shrink a whole page of text down to the size
of a period, then hide it in a seemingly normal letter.
Null Ciphers:
• These are messages where the hidden text is within a larger body of text.
For example, as mentioned previously, taking the first letter of each word
in a normal-looking sentence to spell out a hidden message.
Tattooed Heads:
• In ancient Greece, a guy named Histiaeus shaved the head of his most
trusted servant, tattooed a secret message on his scalp, and then waited
for the hair to grow back. Once the hair was long enough, he sent the
servant to deliver the hidden message. This is a very interesting example
of hiding messages in plain sight.
Musical Steganography:
• Composers have even used music to hide messages! By subtly changing
the notes or rhythms, they could encode secret information. This is a
very complex form of steganography, but it shows how creative people
can be.
Pigeon Post:
• During wars, carrier pigeons were used to deliver messages. These birds
could carry tiny messages attached to their legs, and because they were
fast and reliable, they were hard to intercept. This is not strictly text
steganography, but it's a great example of hiding information during
transport.
Semagrams:
• This is a form of steganography that involves hiding messages in images
or other visual media. For example, patterns in a carpet, or the way
objects are arranged in a painting, could all hold a secret message.
The "Baconian Cipher":
• Developed by Francis Bacon, this method hides messages within a
seemingly normal text by using different fonts or styles of letters. For
example, using two different fonts to represent 0 and 1, and then using
those binary codes to represent letters.
Grille Ciphers:
• These involved using a cardboard template with holes cut in it. The
template was placed over a seemingly ordinary piece of text, and the
letters visible through the holes would form the hidden message. This
method required both the sender and receiver to have the same
template.
Morse Code in Knitting:
• During wartime, spies would sometimes knit messages into clothing
using Morse code. By varying the knit and purl patterns, they could
transmit secret information.
Hidden Messages in Art:
• Throughout history, artists have been known to hide secret symbols and
messages in their paintings. These could be religious symbols, political
messages, or even personal secrets.
Advantages of Text Steganography
Concealment:
• The biggest advantage is that it hides the very existence of a message. If
nobody knows a message is there, it's much harder to find! It's like
hiding a treasure in a book, instead of putting it in a treasure chest.
Discreet Communication:
• It allows people to share information without raising suspicion. Imagine
sending a message hidden in a regular email or document. It looks
completely normal!
Watermarking:
• Think of it like a secret signature. You can hide copyright information
inside a text file, so if someone tries to steal it, you can prove it's yours.
Bypassing Censorship:
• In places where information is controlled, people can use steganography
to sneak messages past censors. It's like hiding a note in a school
lunchbox to get around the teacher.
Increased Security (in some cases):
• Combined with cryptography, it can make messages even safer. First, you
scramble the message (cryptography), then you hide it (steganography).
It's like having a double lock on your door.
Simplicity:
• Some text steganography methods are very easy to use, even without
fancy computers. You can hide messages using just pen and paper!
Basic Concepts
Cover Text:
• Imagine you want to hide a little note for your friend. The "cover text" is
like the normal-looking letter or document you put your secret note
inside. It's the text that everyone else sees, and it looks completely
ordinary. For example, it could be a story, an email, or even a list of
groceries. It's just the text that's used to hide the secret message.
Secret Message:
• This is the actual information you want to keep hidden. It's the note
you're trying to sneak to your friend without anyone else knowing. It
could be anything: a word, a sentence, a number, or even a whole
paragraph. It's the information you're trying to hide within the cover
text.
Redundancy in Text:
• Think of "redundancy" as the extra, unnecessary parts of text that we
don't need. It's like having extra space in your backpack. For example:
o Extra spaces between words or at the end of lines.
o Slight variations in font or formatting.
o Words that could be replaced with synonyms without changing
the meaning.
• These extra bits are what we use to hide our secret message. It's like
using the space in your backpack to hide your secret note.
Payload:
• The "payload" is the actual size of the secret message that you can hide
inside the cover text. It is like, how much information you can put into
the cover text.
• For example, if you have a lot of extra spaces in your cover text, you can
hide a bigger secret message (a larger payload). If you only have a few
extra spaces, you can only hide a small message.
• It's like how much candy you can fit into your pocket. A bigger pocket
means a bigger payload of candy!
Methods of Text Steganography
1. Format-Based Methods: Hiding Messages in the Way Text Looks
Imagine you're trying to hide a note in a book. Instead of writing on the pages,
you could change how the pages look, right? That's what format-based
steganography does!
Extra Spaces:
• Imagine you want to hide a binary message (a message made of 0s and
1s). You could use one space to represent a "0" and two spaces to
represent a "1." So, if your secret message is "101," you'd add two
spaces, then one space, then two spaces into your cover text.
• This is simple, but it's also easy to spot if someone is looking closely.
Changing Line Spacing/Font Sizes:
• Computers can be very precise. They can change the height of lines by
tiny amounts that humans can't easily see. You could use these tiny
changes to represent bits of your secret message.
• Similarly, you could make some letters slightly bolder or slightly larger,
and use those changes to hide information.
Invisible Characters:
• Zero-width spaces are like tiny, invisible "spaces" that don't take up any
visible room. You can place them between letters or words, and they
won't change how the text looks.
• These characters can be used in combination to create a binary code
that, when decoded, reveals the hidden message.
2. Linguistic Methods: Hiding Messages in the Words Themselves
This is like using a secret language that only you and your friend understand.
Word Shifting:
• Think of it like using a thesaurus to find words with similar meanings. You
and your friend could agree on a system where certain synonyms
represent certain letters or numbers.
• For example, if you wanted to hide the word "code," you could use the
following. "Program, message, password, encrypt." Each of those words
could represent a letter.
Using Abbreviations or Acronyms:
• You could create a secret list of abbreviations and their meanings. For
example, "ASAP" might mean "attack at sunrise," and "FYI" might mean
"find the key."
• This works well if you have a limited number of secret messages you
want to send.
Creating a "Code" with Specific Words/Phrases:
• This method is very similar to using a code book. You and a friend decide
that certain words or phrases have hidden meanings.
• For example, you could say that every time the word "blue" is used, it
means to move the location of the secret meeting.
3. Statistical Methods: Hiding Messages in the Patterns of Text
Python Code:
def encode_message(cover_text, secret_message):
"""Hides a secret message in extra spaces at the end of lines."""
binary_message = ''.join(format(ord(char), '08b') for char in secret_message)
#Converts message to binary
encoded_text = ""
binary_index = 0
return encoded_text
def decode_message(encoded_text):
"""Extracts the secret message from extra spaces."""
binary_message = ""
for line in encoded_text.splitlines():
if line.endswith(" "):
binary_message += "1"
elif line.endswith(" "):
binary_message += "0"
decoded_message = ""
for i in range(0, len(binary_message), 8):
byte = binary_message[i:i+8]
if len(byte) == 8:
decoded_message += chr(int(byte, 2))
return decoded_message
# Example Usage:
cover_text = """This is a normal text.
It has nothing special.
Just a plain document.
"""
secret_message = "Hi!"
decoded_result = decode_message(encoded_result)
print("\nDecoded Message:")
print(decoded_result)
Explanation:
1. encode_message(cover_text, secret_message):
o This function takes the regular text (cover_text) and the secret
message you want to hide.
o binary_message = ''.join(format(ord(char), '08b') for char in
secret_message): This line converts the secret message into binary
(0s and 1s).
o It goes through each line of the cover text.
o If there are still binary digits to hide, it adds one or two spaces to
the end of the line, depending on whether the binary digit is "0"
or "1."
o It returns the modified cover text with the hidden message.
2. decode_message(encoded_text):
o This function takes the encoded text (the text with the hidden
message).
o It goes through each line and checks if it ends with one or two
spaces.
o It builds a binary string based on the number of spaces.
o Then, it converts the binary string back into the original secret
message.
o It returns the extracted secret message.
3. Example Usage:
o We create a sample cover_text and a secret_message.
o We call encode_message to hide the secret message in the cover
text.
o We print the encoded text.
o We call decode_message to get the secret message back.
o We print the decoded message.
How it Works:
• The secret message is turned into a series of 0s and 1s.
• The extra spaces at the end of each line act like a secret code,
representing those 0s and 1s.
• The decoding function reads those extra spaces and turns them back
into the original message.
OUTPUT:
References
https://www.geeksforgeeks.org/what-is-steganography/
https://www.researchgate.net/figure/Three-basic-categories-of-text-
steganography-Format-based-methods-used-physical-text_fig5_290009959
https://www.researchgate.net/publication/356056598_A_Review_on_Text_Ste
ganography_Techniques
https://www.irjmets.com/
https://iarjset.com/papers/social-and-ethical-implications-of-steganography-a-
case-study-
approach/#:~:text=The%20main%20ethical%20issue%20is,by%20trying%20to
%20communicate%20undetected.