How to apply pc1 in matlab and get answer in 56 bit keys
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
sadiqa ilyas
il 28 Lug 2019
Commentato: sadiqa ilyas
il 31 Lug 2019
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
1 Commento
Walter Roberson
il 28 Lug 2019
This appears to relate to https://www.mathworks.com/matlabcentral/answers/472880-can-i-fit-a-loop-in-my-code and addell appears to be addition on elliptic curve.
Risposta accettata
Walter Roberson
il 28 Lug 2019
The result of dec2bin() is '0' and '1' not 0 and 1. '0' is char(48) and '1' is char(49), so when you use the '0' and '1' as indices in PC1(key1) you are indexing at locations 48 and 49.
I doubt that you should be applying parity check on one bit at a time. You should probably be taking a smaller number of bits in a group, computing a decimal equivalent, and using that to look up an entry in the parity check matrix.
2 Commenti
Walter Roberson
il 28 Lug 2019
Note that we cannot assist you with encryption theory for legal reasons.
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Logical in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!