Image Steganography Report

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 22

Image

Steganography
2018
PROJECT REPORT

NOVEMBER 30

Digital Signal Processing


Authored by: Parth V. Deep P. Divakar T.

1
Table of Contents
Introduction ................................................................................................................... 3
Rise of Data ................................................................................................................ 3
Definition ................................................................................................................... 4
Advantage of using Steganography over Cryptography ................................................. 5
Types of Steganography ................................................................................................. 6
Steganography works have been carried out on different transmission media like
images, video, text, or audio. ......................................................................................... 6
Text Steganography ....................................................................................................... 6
Steganography techniques............................................................................................. 9
How LSB technique works? ...................................................................................... 11
Code
Algorithm

2
Introduction
Rise of Data

Today the world is witnessing a data explosion like never before. The amount of data
we produce every day is truly mind-boggling. The Forbes article “How Much Data Do
We Create Every Day?” states that there are about 2.5 quintillion bytes of data created
each day at our current pace, but that pace is only accelerating with the growth of the
Internet of Things (IoT). Over the last two years alone 90 percent of the data in the
world was generated. This is worth re-reading!

Data. In essence, the modern computing world revolves around this word. But just
what is so intriguing about it?

“With the fast pace advancement in technology and


use of data for continuous innovation it has become
our topmost priority to secure data”

Figure 1 Data Volume Expansion

The protection of data is the primary concern of the sender and it is really important
that we encrypt our message in a secret way that only the receiver is able to
understand.
3
What is Steganography?
Definition
Steganography is the process of hiding a secret message within a larger one in such a
way that someone cannot know the presence or contents of the hidden message.

The purpose of Steganography is to maintain secret communication between two


parties. Steganography is practiced by those wishing to convey a secret message or
code. While there are many legitimate uses for steganography, malware developers
have also been found to use steganography to obscure the transmission of malicious
code.
Purpose: Steganography can be used to conceal almost any type of digital content,
including text, image, video or audio content; the data to be hidden can be hidden
inside almost any other type of digital content. The content to be concealed through
steganography -- called hidden text -- is often encrypted before being incorporated
into the innocuous-seeming cover text file or data stream. If not encrypted, the hidden
text is commonly processed in some way in order to increase the difficulty of detecting
the secret content.

Figure 2.The same image viewed by white, blue, green and


red lights reveals different hidden numbers

Forms of steganography have been used for centuries and include almost any
technique for hiding a secret message in an otherwise harmless container. For
example, using invisible ink to hide secret messages in otherwise inoffensive messages;
hiding documents recorded on microdot -- which can be as small as 1 millimeter in
diameter -- on or inside legitimate-seeming correspondence; and even by using
multiplayer gaming environments to share information.

4
Advantage of using Steganography
over Cryptography
Up to now, cryptography has always had its ultimate role in protecting the secrecy
between the sender and the intended receiver.

However, nowadays steganography techniques are used increasingly besides


cryptography to add more protective layers to the hidden data. The advantage of using
steganography over cryptography alone is that the intended secret message does not
attract attention to itself as an object of scrutiny. Plainly visible encrypted messages, no
matter how unbreakable they are, arouse interest and may in themselves be
incriminating in countries in which encryption is illegal.

Cryptography changes the information to ciphertext which cannot be understood


without a decryption key. So, if someone were to intercept this encrypted message,
they could easily see that some form of encryption had been applied. On the other
hand, steganography does not change the format of the information but it conceals
the existence of the message.

5
Types of Steganography
Steganography works have been carried out on different transmission media like
images, video, text, or audio.

Text Steganography

Text Steganography is hiding information inside the text files. It involves things like
changing the format of existing text, changing words within a text, generating random
character sequences or using context-free grammars to generate readable texts.
Various techniques used to hide the data in the text are:

• Format Based Method


• Random and Statistical Generation
• Linguistic Method

Image Steganography

Hiding the data by taking the cover object as the image is known as image
steganography. In digital steganography, images are widely used cover source because
there are a huge number of bits present in the digital representation of an image. There
are a lot of ways to hide information inside an image. Common approaches include:

• Least Significant Bit Insertion


• Masking and Filtering
• Redundant Pattern Encoding
• Encrypt and Scatter
• Coding and Cosine Transformation

In audio steganography, the secret message is embedded into an audio signal which
alters the binary sequence of the corresponding audio file. Hiding secret messages in
digital sound is a much more difficult process when compared to others, such as Image
Steganography. Different methods of audio steganography include:

• Least Significant Bit Encoding


• Parity Encoding
• Phase Coding
• Spread Spectrum

6
This method hides the data in WAV, AU, and even MP3 sound files.

Video Steganography

In Video Steganography you can hide kind of data into digital video format. The
advantage of this type is a large amount of data can be hidden inside and the fact that it
is a moving stream of images and sounds. You can think of this as the combination of
Image Steganography and Audio Steganography. Two main classes of Video
Steganography include:

• Embedding data in uncompressed raw video and compressing it later


• Embedding data directly into the compressed data stream

Network Steganography (Protocol Steganography)

It is the technique of embedding information within network control protocols used in


data transmission such TCP, UDP, ICMP etc. You can use steganography in some covert
channels that you can find in the OSI model. For Example, you can hide information in
the header of a TCP/IP packet in some fields that are either optional.
In today’s digitalized world, various software tools are available for Steganography. In
the remainder of this Steganography Tutorial, we will explore some of the popular
steganographic tools and their capabilities.

Figure 3 Types of Steganography

7
As seen in the above image, both the original image file(X) and secret message
(M) that needs to be hidden are fed into a steganographic encoder as input.
Steganographic Encoder function, f(X,M,K) embeds the secret message into a
cover image file by using techniques like least significant bit encoding. The
resulting stego image looks very similar to your cover image file, with no visible
changes. This completes encoding. To retrieve the secret message, stego object is
fed into Steganographic Decoder.

8
Steganography techniques
In modern digital steganography, data is first encrypted or obfuscated in some other
way and then inserted, using a special algorithm, into data that is part of a particular
file format such as a JPEG image, audio or video file. The secret message can be
embedded into ordinary data files in many different ways. One technique is to hide
data in bits that represent the same color pixels repeated in a row in an image file. By
applying the encrypted data to this redundant data in some inconspicuous way, the
result will be an image file that appears identical to the original image but that has
"noise" patterns of regular, unencrypted data.

The practice of adding a watermark -- a trademark or other identifying data


hidden in multimedia or other content files -- is one common use of steganography.
Watermarking is a technique often used by online publishers to identify the source of
media files that have been found being shared without permission.

Figure 4. Image Steganography

While there are many different uses of steganography, including embedding sensitive
information into file types, one of the most common techniques is to embed a text file
into an image file. When this is done, anyone viewing the image file should not be able
to see a difference between the original image file and the encrypted file; this is
accomplished by storing the message with less significant bites in the data file. This
process can be completed manually or with the use of a steganography tool.

9
‘Least Significant Bit’ Steganography
We can describe a digital image as a finite set of digital values, called pixels. Pixels are
the smallest individual element of an image, holding values that represent the
brightness of a given color at any specific point. So we can think of an image as a
matrix (or a two-dimensional array) of pixels which contains a fixed number of rows
and columns.

Least Significant Bit (LSB) is a technique in which the last bit of each pixel is modified
and replaced with the secret message’s data bit.

From the above image it is clear that, if we change MSB it will have a larger impact on
the final value but if we change the LSB the impact on the final value is minimal, thus
we use least significant bit steganography.

10
How LSB technique works?

Each pixel contains three values which are Red, Green, Blue, these values
range from 0 to 255, in other words, they are 8-bit values. [4] Let’s take an
example of how this technique works, suppose you want to hide the
message “hi” into a 4x4 image which has the following pixel values:

[(225, 12, 99), (155, 2, 50), (99, 51, 15), (15, 55, 22),(155, 61, 87), (63, 30,
17), (1, 55, 19), (99, 81, 66),(219, 77, 91), (69, 39, 50), (18, 200, 33), (25, 54,
190)]

Using the ASCII Table, we can convert the secret message into decimal
values and then into binary: 0110100 0110101.Now, we iterate over the
pixel values one by one, after converting them to binary, we replace each
least significant bit with that message bits sequentially (e.g 225 is 11100001,
we replace the last bit, the bit in the right (1) with the first data bit (0) and so
on).This will only modify the pixel values by +1 or -1 which is not noticeable
at all. The resulting pixel values after performing LSBS is as shown below:

[(224, 13, 99),(154, 3, 50),(98, 50, 15),(15, 54, 23),(154, 61, 87),(63, 30,
17),(1, 55, 19),(99, 81, 66),(219, 77, 91),(69, 39, 50),(18, 200, 33),(25, 54,
190)]

11
Steganography software

Steganography software is used to perform a variety of functions in order to hide


data, including encoding the data in order to prepare it to be hidden inside another
file, keeping track of which bits of the cover text file contain hidden data, encrypting
the data to be hidden and extracting hidden data by its intended recipient.

Figure 5 Matlab Image Processing

There are proprietary as well as open source and other free-to-use programs available
for doing steganography. OpenStego is an open source steganography program; other
programs can be characterized by the types of data that can be hidden as well as what
types of files that data can be hidden inside. Some online steganography software
tools include Xiao Steganography, used to hide secret files in BMP images or WAV files;
Image Steganography, a Javascript tool that hides images inside other image files; and
Crypture, a command line tool that is used to perform steganography.

12
Software Used – GNU Octave

GNU Octave is a high-level language, primarily intended for numerical computations. It


provides a convenient command line interface for solving linear and nonlinear
problems numerically, and for performing other numerical experiments using a
language that is mostly compatible with Matlab. It may also be used as a batch-
oriented language.

Octave has extensive tools for solving common numerical linear algebra problems,
finding the roots of nonlinear equations, integrating ordinary functions, manipulating
polynomials, and integrating ordinary differential and differential-algebraic equations.
It is easily extensible and customizable via user-defined functions written in Octave’s
own language, or using dynamically loaded modules written in C++, C, Fortran, or other
languages.

GNU Octave is also freely redistributable software. You may redistribute it and/or
modify it under the terms of the GNU General Public License (GPL) as published by the
Free Software Foundation.

13
Algorithm
Encoding

▪ The function imread()is used for importing an image and converting into a
matrix of three RGB planes.
▪ strcat() function is used to add a backslassh
▪ bitand() function is used mask all the bits and modify the last LSB of the
pixel.
▪ for loop for iteration through all pixels.
▪ Encoded Resultant is exported.

14
Decoding

▪ The function imread()is used for importing encoded image and converting
into a matrix of three RGB planes.
▪ while loop used as an infinite loop.
▪ bitand() function is used mask all the bits and access the last LSB of the
pixel.
▪ Bin2dec function used to convert 8-bit Binary to Decimal
▪ for loop for iteration through all pixels.
▪ Resultant is exported.

15
Code:
Following is the Octave code
pkg load communications
clc;
clear all;
close all;
decodedString="";
pix=1;
y=1;
img=imread("download-0.jpg");
imsize=size(img)
msg="HELLO FRIENDS"
msg=strcat(msg,"/")
msg_ascii=double(msg)
msg_ascii=int8(msg_ascii);
show=dec2bin(msg_ascii,8)
s=size(msg)
s=s(2)
disp('')
disp('////////////////********DECODING STARTS*******/////////////');
img_encrypt=img;
img_check=img;
for k=1:s
bin=dec2bin(msg_ascii(k),8);
for i= 1:8
bit=bin(i);
if bit=='1'
b=1;
else
b=0;
end
img_encrypt(pix,y,1)=bitand(img_encrypt(pix,y,1),254) + b;
img_check(pix,y,1)=0;
pix=pix+1;
if pix>imsize(1)
pix=1;
y=y+1;
end
end
disp('')
end
subplot(221)
imshow(img);
title("Original Image");
subplot(222)

16
imshow(img_encrypt);
title("Encoded image")

subplot(223)
imshow(img_check);
title("Encoded Image-To see the pixels used ")
imwrite(img_encrypt,"out.jpg");
%Decryption Part//////////////
c=1;
mask=uint8(001)
buffer="";
b=1;
rx=1;
formatSpec = '%s%s';
while 1

for r=1:8 %scanning 8 pixels

n=img_encrypt(rx,c,1);
n=bitand(n,mask);
if n==1

buffer = sprintf(formatSpec,buffer,"1");
%buffer=strcat(buffer,"1");
else
buffer = sprintf(formatSpec,buffer,"0");
%buffer=strcat(buffer,"0");
end

b=b+1;
rx=rx+1;
if rx>imsize(1)
rx=1;
c=c+1;
end
end
b=1;
ch=bin2dec(buffer)
ch=char(ch)
if ch=='/'
break;
break;
end
decodedString=sprintf(formatSpec,decodedString,ch)
buffer="";
end

decodedString

17
Working

• As we can observe that message is ‘HELLO FRIENDS’


• As we can see that each letter is converted to INTEGRAL ASCII values followed by
the binary conversion.
• Now the image starts encoding.

18
Blue Line

• Here we can see three images, the original image, the encoded image, and the
check image
• Original Image is the input image
• Encoded image is the image after the encoding process on the original
• Check image is to check whether how many pixels are consumed by the
message. This is shown by a blue line starting from the left of the Image. Longer
the Message more the number of blue lines can be seen.

Hence Encoding can be verified using check image.

19
Figure 6 Decoding the coded image

• As you can observe that the message is decoded letter by letter.


• This is an INFINITE LOOP and stops only when backslash (/) is found.
• Hence the message is decoded

20
Applications
Military Use

Protection of Intellectual
property(IP)

21
Conclusion
We can conclude that steganography is a very good way of watermarking images that
too with minimal computational method.
Matlab/Octave codes are pretty Memory Efficient and working perfectly. The Encoding
and Decoding Process is clear to the user.

22

You might also like