Retrieving the original LSBs in LSB steganography

3 views (last 30 days)
I am working on a project where I need to divide an image file into smaller parts (no. of parts is user input). Let's say, 2 parts. I am encrypting and sending these to the receiver end. I have hidden the information '2' in the LSB of the two encrypted files so the receiver end knows how many files to expect for decryption.
My question is, is it possible to retrieve the original least significant bits after I extract the hidden data ('2' in this case)? I have been able to send the secret data, extract the data; but can't get the original bits back in totality and hence the decryption is not giving the correct result.
For example: I need to send '2' which is 00000010. Suppose the first 8 pixel values of one of the images being sent are [22 1 255 16 30 179 10 19]. After I change the LSB of these pixels they become [22 0 254 16 30 178 11 18]. I have been able to extract the data with the following code:
number=zeros(1,8);
filename=uigetfile('*.*','Select first encrypted image file');
f1=imread(filename);
for i=1:8
number(1,i)=bitget(f1(1,i),1);
end
str=num2str(number);
str(isspace(str)) = '' ; % remove the spaces in the string
N=bin2dec(str); % no. of files sent
Is there any way to retrieve the original LSBs?

Accepted Answer

James Tursa
James Tursa on 9 Jun 2017
If you overwrite the original data with something else, and you have nothing else in the image that can be used to reconstruct that data, then no you cannot recover it. You would have to use a different method of encoding your "hidden" info into the file that didn't destroy the original info.

More Answers (0)

Categories

Find more on Read, Write, and Modify Image in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!