Sunteți pe pagina 1din 6

The first step in Steganoraphy is that to embedded

STEGANALYSIS OF LSB INSERTION METHOD IN UNCOMMPRESSED


and hiding information is to pass both the secret
IMAGES USINGmessage
MATLAB and the cover message into the encoder,
Mohit Kr. Srivastava Sharad Kr. Gupta Sushil Kushwaha Brishket S. Tripathi
Asst. Prof. Asst. Prof. Asst. Prof. Lecturer
Ph:Xsddddd
9935428632 Ph: 9839164608 Ph: 9335891362 Ph: 9236119790
mohit1003@yahoo.co.in sharad_mpec@rediffmail.com kushwahasushil@rediffmail.com brisheket@gmail.com
Department of Electronics Engineering , MPEC, Kothi Mandhana, Kanpur

ABSTRACT
In this paper we have explained a steganalytic tool The first step is steganography is that to embed
to detect the presence of hidden message in LSB and hiding information is to pass both the secret
steganography. It is process of hiding secret message and the cover message in to the encoder,
information in a cover image. Here we have used inside the encoder, one or several protocols will
LSB insertion method using discrete algorithms. be implemented to embed the secret information
Steganographic programs use the Least into the cover message.
Significant Bit (LSB) embedding as the method of
choice for message hiding 24-bit, 8-bit color
Secret text message
images and grayscale images. It is commonly of 1000 character
understood that changes to the LSB of color
cannot be detected due to noise that is always
presents in digital images. In this paper, we
describe a new very accurate and reliable method Encoder
that can detect LSB. Embedding in randomly
scattered pixels in both 24-bit color images and 8- Cover image Stego Object
bit grayscale or color images.

Keywords
Stegnography, Stegoimage, LSB insertion,
Computer and Network Security
Secret Text Decoder
1. INTRODUCTION
Steganography brings science to the art of hiding Fig.1: Steganography Process
information. The purpose of steganography is to
convey a message inside of a conduit of
misinterpretation such that the existence of the A key is needed in the embedding process. By
message is both hidden and difficult to recover using the key we can reduce the chance of third
when discovered. Basically the information hiding party attackers getting hold of the stego object and
process in a Steganoraphic system starts by decoding it to find out the secret information. In
identifying a cover medium’s redundant bits. The general the embedding process inserts a mark X,
embedding process creates a stego medium by in an object Y, a key K, usually produced by a
replacing these redundant bits with data from the random number generator is used in the
hidden message. The basic purpose to make embedding process and the resulting marked
communication unintelligible to those who do not object Y is generated by mapping
possess the right keys. XxYxK Y
Having passed through the encoder a stego object
will be produced. A stego object is the original
cover object with the secret information yi. In this way it is ensured that the bits of the
embedded inside. This object should look almost secret message are inserted into distinct LSBs.
identical to the cover object as otherwise a third
party attacker can see embedded information. 3. ANALAYSIS TO DETECT LSB
Having produced the stego object, It will be sent INSERTION
off via some communication channel. At the In a natural uncompressed image 24-bit BMP
receiving end the stego object is fed into the each pixel is represented by three colors (Red,
system the public or private key that can decode Green & Blue), each of the color is 8-bit wide.
the original key that is used inside the encoding The LSB of any color pixel of the typical scanned
process is also needed to detect the secret real image taken by any source contains least
information. information about the image and is most random
in nature. That is why the most appropriate and
2. LSB INSERTION TECHNIQUES acceptable technique for hiding information in an
In LSB insertion method, a random number uncompressed natural image is based on the
generator is used to randomly distribute and hide replacing the LSB of the color pixels by message
the bits of a secret message into the least bit. So that on an average only half of the LSBs
significant bit of the pixels within a cover image, are changed and it is assumed that, embedding
a common approach to achieve this is the random message in this way is not going to destroy the
interval method. The transmitting and receiving statistics of the original image. This assumption is
end share the stego key, the output is a random true if and only if the number unique colors in the
sequence K1………..Kn where n is the length of cover image is comparable to the total number of
message bits. pixels in that image.
The sequence is then used by the sender to In an uncompressed image the ratio of the number
generate the sequence of pixel indices yi where, of unique colors to the total number of pixels is
y1 = K1 approximately 1:6 so that after LSB embedding
yi = yi-1 + Ki, i >2. which is equivalent of introducing noise, the
Message bit, i would then be embedded into the randomness of the LSB pattern will increase. This
LSB of the pixel, yi thus, the order in which the increase in randomness is reflected in increased in
secret message bits are embedded would be number of closed color pairs which is utilized as
determined pseudo randomly. Since the receiver the detection tool. The close color pair (X) and
knows the seed k, he can reconstruct ki and unique color (Y) is defined as follows.
therefore the entire sequence of pixel indices yi. Two colors having individual components Red,
In the random insertion method the random Green & Blue are closed if the correlation factor
location of the pixels depends on a stego key, of all individual components of both colors are 1
whose size k should be in the range n < k < I. and both colors are unique if any one of the
Where n is the size of message and I is the size of individual components of both colors are 1.
cover image. For any uncompressed real image the ratio r gives
The method commences by searching for the first us an idea about the relative number of close color
prime number p that exceeds the key k, A pair with that of unique colors where,
primitive root a, is then obtained, which is a r = X/Y
number whose powers generate all the distinct It has been seen for an original image which does
integers from 1 to (p-1) in some permuted order. not have any encoded message the value of r is
Each power of this primitive root to generate greater incomparision with an image which has a
these integers is called the discrete algorithm. message already encoded in it. This happens has
This primitive root a, is then used to generate a set embedded message behaves as a random noise
of random and distinct numbers, yi = ai mod p, which increases the number of unique colors Y
where i is the bit index of the secret message. Bit i abruptly.
of the secret message then goes into LSB of pixel
4. ALGORITHM FOR SOFTWARE encoding any message upto 1000 character. Hence
DEVELOPMENT first job is to convert any message to message of
1000 character and then converting it into ASCII
Index.m code. Hence finally we have a matrix of 7x1000.
Now our job is to form a zero matrix of same
dimension as image and then provide that matrix
to crtmtrx module. This will return a matrix of
Encode.m same dimension whose 7000 element would be 1.
We will find index of these position and choose as
reference and modulated that position element of
picture matrix.
Crtmtrx.m Function success= Encode(msg,key,F,F1)
%ENCODE(msg,key)Encodes a text message
num2add = 1000-length(msg);
% Number of spaces to add to end of MSG.
Decode.m if num2add < 0, error('This message is too long to
encode.'), end
newmsg = [msg, repmat(' ',1,num2add)];
% 1000 chars always encoded.
Showerror.m msgmat = dec2bin(newmsg)-48;
% Each row is a bin. rep. of an ascii char.
pic1 = imread(fullfile(F,F1));
Fig.2 Flow chart for Steganalysis of LSB B = pic1(:,:,1); [piclngth pichght] = size(B);
insertion method % Choose the first page.
dim1 = piclngth-2; dim2 = pichght-3;
4.1 INDEX.M keyb = key(end:-1:1);
It maintains the graphical user interface of rows = cumsum(double(key));
program for making user friendly software columns = cumsum(double(keyb));
index.m is main file, which cause various other % Coord pairs for KEY (rows, columns)
module it is actually the simplest part you just A = zeros(dim1,dim2);
have to select any of GUI component such as push % This matrix will house the hiding points.
button, slider or any else and then double click on A = crtmtrx(A,rows,columns,dim1,dim2,key);
it a inspector dialog box will open in which there idx = find(A==1);
will be various option such as create function, edit % This same index will be used for pic matrix.
function and various other option click on create for vv = 1:1000
function block guide will automatically create a % This is the encoder.
function whenever you will press that button you for uu = 1:7
will jump to its callback. Now job of programmer if msgmat(vv, uu)==1;
is to edit this function according to its use. if rem(B(idx(uu+7*(vv-1))),2)==0
The handles structure contains the handles of all B(idx(uu+7*(vv-1))) = B(idx(uu+7*(vv-1)))+1;
GUI components. GUI automatically passes the end
handles structure to every callback as an input elseif rem(B(idx(uu+7*(vv-1))),2)==1
argument. B(idx(uu+7*(vv-1))) = B(idx(uu+7*(vv-1)))-1;
end
4.2 ENCODE.M end
This module is used for encoding purpose. It end
inputs a BMP image and message to be encoded newpic = pic1; newpic(:,:,1) = B;
and the key for protecting the code is provided by imwrite(newpic,sprintf('%sENC%s',F,F1))
calling of program. This code is prepared for success = 1;
4.3 CRTMTRX.M end
This module is not called by main program import java.io.*
(index.m) but by encoding and decoding module. import java.net.DatagramSocket
It uses a key for security purpose. A zero matrix import java.net.DatagramPacket
provided by encoding module and finally form a import java.net.InetAddress
if action == SEND
matrix which modulated form of zero matrix try
whose 7000 element are 1. These are those addr = InetAddress.getByName(host);
element we store the information in picture fp = fopen(filename,'r');
message. Finally this module is also called by data = fread(fp,'int8');
decoding module so that we can obtain those fclose(fp);
position where information is hidden and extract packet = DatagramPacket(data, length(data), addr,
that information easily. port);
function [varargout] = judp(actionStr,varargin) socket = DatagramSocket;
% Usage : socket.send(packet);
% mssg = judp('receive',21566); socket.close;
% judp('send',21566,'192.167.1.2','test.bmp') catch lasterr
SEND = 1; errorStr = sprintf('%s.m--Failed to send UDP
RECEIVE = 2; packet.\nJava error message
DEFAULT_LENGTH = 100000; follows:\n%s',mfilename,lasterr);
DEFAULT_TIMEOUT = 10000; try
if strcmpi(actionStr,'send') socket.close;
action = SEND; catch lasterr
if nargin ~= 4 errorStr = sprintf('%s.m--Failed to send UDP
error([mfilename '.m--SEND mode requires 4 input packet.\nJava error message
arguments.']); follows:\n%s',mfilename,lasterr);
end end
port = varargin{1}; error(errorStr);
host = varargin{2}; end
filename = varargin{3}; else
elseif strcmpi(actionStr,'receive') try
action = RECEIVE; socket = DatagramSocket(port);
if nargin ~= 2 socket.setSoTimeout(timeout);
error([mfilename '.m--RECEIVE mode requires 2 packet =
input arguments.']); DatagramPacket(zeros(1,packetLength,'int8'),packetLe
end ngth);
port = varargin{1}; socket.receive(packet);
packetLength = DEFAULT_LENGTH; socket.close;
timeout = DEFAULT_TIMEOUT; mssg = packet.getData;
else mssg = mssg(1:packet.getLength);
error([mfilename '.m--Unrecognised actionStr ''' inetAddress = packet.getAddress;
actionStr ''.']); sourceHost = char(inetAddress.getHostAddress);
end fp = fopen('C:\received.wav','w');
if ~isnumeric(port) || rem(port,1)~=0 || port < 1025 || fwrite(fp,mssg);
port > 65535 fclose(fp);
error([mfilename '.m--Port number must be an integer sprintf('%s','File Transfer Successful');
between 1025 and 65535.']); if nargout > 1
end varargout{2} = sourceHost;
if action == SEND end
if ~ischar(host) catch receiveError
error([mfilename '.m--Host name/IP must be a string % Determine whether error occurred because of a
(e.g., ''www.example.com'' or ''208.77.188.166''.).']); timeout.if
end ~isempty(strfind(receiveError.message,'java.net.Socke
tTimeoutException'))
errorStr = sprintf('%s.m--Failed to receive UDP 4.5 SHOWERROR.M
packet; connection timed out.\n',mfilename); This is a short module that is used to show a error.
else It returns a message box which contain error
errorStr = sprintf('%s.m--Failed to receive UDP message an icon representing error.
packet.\nJava error message function [y] = showError(message,icon)
follows:\n%s',mfilename,receiveError.message); y = msgbox(message,'Secured Steganography with
end File Transfer',icon);
try
socket.close;
5. CONCLUSION
catch lasterr
The work in this paper is successfully completed. As
sprintf('There is some error : %s',lasterr);
we consider many message of different length which
end
shows that the message length is inversely
error(errorStr);
proportional to the ratio (r ), as shown in following
end
figure.
end

4.4 DECODE.M
This module is called by main program (index.m).
It is provided by and encoded image exciting part
of this program is to we store encoded image on
same here our original image lies hence we just
have to supply the part as input is calls crtmtrx.m
which return a matrix that contain those position
where encoding is done and then we run same Message Length
nested loop as we used in encoding loop an finally Here we have a limitation also that this technique
we get back original matrix. does not work properly, when we consider a .jpg
function msg = Decode(key,F,F1) format of any cover image because such type of
% DECODE(key) Decodes the message hidden by compression technique is lossy technique. LSB
encode in pic, using key. insertion technique is working perfectly with
pic2 = imread([F F1]); Lossless compression techniques.
B = pic2(:,:,1); [piclngth pichght] = size(B);
% Choose the top page. 6. REFERENCES
dim1 = piclngth-2; dim2 = pichght-3; [1] J. Fridrich and M. Goljan, “Stegnalysis of LSB
keyb = key(end:-1:1); Embedding in color and Grayscale image”, in
rows = cumsum(double(key)); columns =
preparation for the special issue on security in
cumsum(double(keyb));
A = zeros(dim1,dim2); Magazine IEEE Multimedia.
% This matrix houses the hiding points. [2] R. J. Anderson and Petitcolas, F.A.P., “On the
A=crtmtrx(A,rows,columns,dim1,dim2,key); limits of steganography”, IEEE Journal of
idx = find(A==1); selected Areas in Communications.
msgmat = zeros(1000,7); [3] Curran, K. and Bailey, K. “An evaluation of
for vv = 1:1000 image based steganography method”.International
% This is the decoder. Journal of Digital Evidence, Fall2003.
for uu = 1:7 [4] Jakson, J.T.,Gregg, H., Gunsch, Claypoole,
if rem(B(idx(uu+7*(vv-1))),2)==1 R.L., and Lamont, G.B. “Blind Steganography
msgmat(vv,uu) = 1; detection using a computational immune system:
end
A Work in progress”. International Journal of
end
end DigitalEvidence.
msg = char(bin2dec(num2str(msgmat)))'; [5] Digital Image Processing using MATLAB by
Gonzale Woods.
[6] N. Provos and P. Honeyman,”Hide and seek:
An introduction to Steganography”.

S-ar putea să vă placă și