HOW TO XOR NEGETIVE DECIMAL NUMBER?
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
My original image size 256*256. I have performed transformation, then i divided the matrix into 4*4 block, then i performed decomposition on each block...output of decomposition was P ans S matrix...i shuffled the elements of p..but now i want to perform xor with s. but my problem is i need to xor a key with s matrix which contain negetive decimal number .. but it showing me error ..
for i=1:16
bi=xor(Dec2bin(smod(i)),Dec2bin(finalkey(i)));
s1(i)= Binary2Dec(bi);
end
2 commentaires
James Tursa
le 9 Août 2022
Modifié(e) : James Tursa
le 9 Août 2022
What are the variable types of smod and finalkey? Can you post a small subset of example data?
Réponses (1)
Walter Roberson
le 9 Août 2022
Modifié(e) : Walter Roberson
le 10 Août 2022
for i=1:16
S = dec2bin(typecast(double(smod(i)), 'uint8'), 8) - '0');
F = dec2bin(typecast(double(finalkey(i)), 'uint8'), 8) - '0'));
bi = xor(S, F);
s1(i) = typecast(uint8(bin2dec(char(bi + '0'))), 'double');
end
4 commentaires
Walter Roberson
le 10 Août 2022
I have no idea what your Dec2Bin function is.
dec2bin has accepted a second parameter for at least the last 5 years.
Voir également
Catégories
En savoir plus sur Elementary Math dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!