I want to apply pc1 in my matlab code and answer required is in binary form but i am getting decimal number. Can some one help me in this.
a=0;b=17;n=313;A=[[36 6]; [117 3] ;[198 310] ;[68 86]];k=size(A,1); temp=A(4,:) A11=multell(A(4,:),2,a,b,n);PC1=[57,49,41,33,25,17,9,1,58,50,42,34,26,18,10,2,59,51,43,35,27,19,11,3,60,52,44,36,63,55,47,39,31,23,15,7,62,54,46,38,30,22,14,6,61,53,45,37,29,21,13,5,28,20,12,4]; %parity
PC2=[14,17,11,24,1,5,3,28,15,6,21,10,23,19,12,4,26,8,16,7,27,20,13,2,41,52,31,37,47,55,30,40,51,45,33,48,44,49,39,56,34,53,46,42,50,36,29,32]; %key comp
A(5,:)=addell(A11,A(1,:),a,b,n); A(6,:)=addell(A(5,:),A(2,:),a,b,n); A(7,:)=addell(A(6,:),A(3,:),a,b,n); A(8,:)=addell(A(7,:),A(4,:),a,b,n); % k=k+4;
% end
B=[A(5,:); A(6,:); A(7,:); A(8,:)]; B1=dec2bin(B) key1=reshape(B1,1,64) Key1=PC1(key1) Key1 = Columns 1 through 13 37 37 29 37 37 29 29 29 37 37 29 29 29 Columns 14 through 26 37 37 37 37 37 37 29 37 37 37 29 29 29 Columns 27 through 39 37 29 37 29 29 29 29 37 37 29 29 29 29 Columns 40 through 52 37 37 37 37 37 29 29 29 29 29 37 29 37 Columns 53 through 64 29 37 37 29 29 29 29 29 29 37 37 29
Best Answer