Info

この質問は閉じられています。 編集または回答するには再度開いてください。

explaination of the code

1 回表示 (過去 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