x= {'d9' '31' '32' '25' 'f8' '84' '06' 'e5' 'a5' '59' '09' 'c5' 'af' 'f5' '26' '9a'};
y= {'fe' 'ff' 'e9' '92' '86' '65' '73' '1c' '6d' '6a' '8f' '94' '67' '30' '83' '08'};
X=hex2dec(x);
XX=dec2bin(X);
k=hex2dec(y);
u=aesinit(k);
w=aesencrypt(u,X);
U=dec2bin(w);
Xd = XX - '0';
Ud = U - '0';
Result = [Ud(:, 1:end-1), xor(Xd, Ud(:, end))]
The error in the above code is:
Error using xor
Matrix dimensions must agree.
Error in counter1 (line 35)
Result = [Ud(:, 1:end-1), xor(Xd, Ud(:, end))]
I would like to find the xor of the encrypted value U and plaintext X??
3 Comments
Direct link to this comment
https://www.mathworks.com/matlabcentral/answers/365764-how-to-solve-the-error-in-this-code#comment_502382
Direct link to this comment
https://www.mathworks.com/matlabcentral/answers/365764-how-to-solve-the-error-in-this-code#comment_502382
Direct link to this comment
https://www.mathworks.com/matlabcentral/answers/365764-how-to-solve-the-error-in-this-code#comment_502451
Direct link to this comment
https://www.mathworks.com/matlabcentral/answers/365764-how-to-solve-the-error-in-this-code#comment_502451
Direct link to this comment
https://www.mathworks.com/matlabcentral/answers/365764-how-to-solve-the-error-in-this-code#comment_502454
Direct link to this comment
https://www.mathworks.com/matlabcentral/answers/365764-how-to-solve-the-error-in-this-code#comment_502454
Sign in to comment.