LSB transform for image encryption

1 visualización (últimos 30 días)
javad danesh
javad danesh el 21 de En. de 2023
Respondida: Image Analyst el 22 de En. de 2023
I want to use LSB transform to encode the message in the image. The length of the bit string is less than the size of the image. I wrote a code, but when the length of the message is less, I don't know how to do the encryption. Thank you for your guidance
clc;
clear;
close all;
img=imread('cameraman.tif');
[m,n]=size(img);
message=randi([0 1],m,n);
em=img;
for i=1:m
for j=1:n
pix=dec2bin(img(i,j),8);
if (message(i,j)==0);
pix(8)='0';
else
pix(8)='1';
end
em(i,j)=bin2dec(pix);
end
end

Respuestas (2)

Walter Roberson
Walter Roberson el 21 de En. de 2023
For legal reasons we cannot discuss encryption here.
If you have two arrays and information is being transferred from a shorter array to a larger array, you have a few choices:
  • you could just stop transferring and leave the larger array to be whatever is appropriate
  • you could prefix size information into what is being transferred, so that the destination first retrieves the site and then knows how many locations to look at
  • you could pad with a constant
  • you could ensure that the data being transferred never includes a particular pattern, and then put the pattern at the place the data stops -- an "end of message" marker

Image Analyst
Image Analyst el 22 de En. de 2023

Community Treasure Hunt

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

Start Hunting!

Translated by