how to slove this problem?
2 views (last 30 days)
Show older comments
sir ,I write a code but the final ans E contain two different matrix array size that is the combination of both E2 and k2 .I cannot convert into a single binary matrix. The binary sequence is converted into 24 integers in which each one is produced by 8 binary bits.please execute the code and if you find any different idea please inform me as soon as possible.
if true
clc;
clear all;
close all;
img = imread('cameraman.tif');
c=img';
d=c(:);
[W,L]=size(img);
k=randi(192,1,192);
syms k1 t
for i=1:4
k1=k(((48*i)-47):(48*i));
a1 = symsum(k1*(2^(t-(48*i)+47)),t,((48*i)-47),(48*i));
a=a1/(2^48);
end
for x=1:2
r(x)=mod(prod(a*(2^48)+a(x)),0.4)+3.6;
C(x)=mod(prod(a*(2^48)+a(x+2)),1);
end
C1=C(1);
C2=C(2);
for y=1:[W,L]
if y==1
C(y)=C(x);
else
if y~=1&&C(y-1)<0.5
C(y)=0.5*(r(x)*C(y-1));
else
if y~=1&&C(y-1)>=0.5
C(y)=0.5*(r(x)*(1-(C(y-1))));
end
end
end
end
for y=1:[W,L]
if y==1
E1(y)=d(y);
else
E1(y)=mod(d(y)+floor(C(y)*(10^13))+d(y-1),256);
end
end
for y=1:[W,L]
if y==[W,L]
E2(y)=E1(y);
else
E2(y)=mod(E1(y)+floor(C(y)*(10^13))+E1(y+1),256);
end
end
E2=E2';
Q=sum(E2');
Q=sym2poly(Q);
for j=1:192
q=dec2bin(Q,j);
kb=dec2bin(k,j);
end
kb = kb(randi(size(kb,1)),:);
k2=xor(q,kb);
E=[1,(W*L)+24];
E={k2,E2}
%E=bin2dec(char('0'+reshape(bits, 8, 24).'))
end
0 Comments
Answers (0)
See Also
Categories
Find more on Number Theory in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!