Professional Documents
Culture Documents
Image Steganography Report
Image Steganography Report
Image Steganography Report
Steganography
2018
PROJECT REPORT
NOVEMBER 30
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?
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.
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.
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:
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:
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:
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:
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.
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
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
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
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
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.
19
Figure 6 Decoding the coded image
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