Info

此问题已关闭。 请重新打开它进行编辑或回答。

explaination of the code

2 次查看(过去 30 天)
sonam s
sonam s 2013-12-25
关闭: MATLAB Answer Bot 2021-8-20
pattern=['00110011';
'00110101';
'00110110';
'00111001';
'00111010';
'01010011';
'01010101';
'01010110';
'01011001';
'01011010';
'01011100';
'01100011';
'01100101';
'01100110';
'01101001';
'01101010';
'01101100';
'10010011';
'10010101';
'10010110';
'10011100';
'10100011';
'10100101';
'10100110';
'10101001';
'10101010';
'10101100';
'11000011';
'11000101';
'11000110';
'11001001';
'11001010';
'11001100']
chars={'a','b','c','d','e','f','g','h','i','j','l','m','o','p','q','r','s','t','u','w','x','y','z','0','2','3','4','5','6','7','8','9'};
pv=input('enter password');
[fname path]=uigetfile('*.jpg','enter an image to be encrypted');
fname=[path,fname];
im=imread(fname);
imshow(im);
title('actual image');
[x y z]=size(im);
for(i=1:length(pv))
a=pv(1);
a=find(chars==a);
a=pattern{a,1};
num(1)=bin2dec(a);
end
sir ,in the above code, pv is the text password and for each character a specific pattern of binary value is assigned and that binary value should be converted in to decimal value. num is the variable. i am doubtful at the step a=pattern{a,1}; please explain kindly

回答(1 个)

Walter Roberson
Walter Roberson 2013-12-25
The code is wrong because it uses pv(1) and num(1) instead of pv(i) and num(i) . The "find" is okay.

此问题已关闭。

Community Treasure Hunt

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

Start Hunting!

Translated by