フィルターのクリア

LSB transform for image encryption

2 ビュー (過去 30 日間)
javad danesh
javad danesh 2023 年 1 月 21 日
回答済み: Image Analyst 2023 年 1 月 22 日
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

回答 (2 件)

Walter Roberson
Walter Roberson 2023 年 1 月 21 日
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 2023 年 1 月 22 日

Community Treasure Hunt

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

Start Hunting!

Translated by