Info

Diese Frage ist geschlossen. Öffnen Sie sie erneut, um sie zu bearbeiten oder zu beantworten.

explaination of the code

1 Ansicht (letzte 30 Tage)
sonam s
sonam s am 25 Dez. 2013
Geschlossen: MATLAB Answer Bot am 20 Aug. 2021
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

Antworten (1)

Walter Roberson
Walter Roberson am 25 Dez. 2013
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