Can somebody help me with this please. I'm stuck due to my limited knowledge on Matlab.
1 回表示 (過去 30 日間)
古いコメントを表示
Below is part of my code for an authentication system using Biometrics. I get the error message below when it comes to gi, the rest works. Please someone enlighten me Error using bitxor Inputs must have the same size.
PWi = input('Enter your password:' , 's');
IDi= input('Enter your identity :' ,'s');
Ki = input('Enter a random number of your choice : ');
Bi = imread('input.bmp');
Bi_double = double(Bi);
BiKi = bitxor(Bi_double,Ki);
fi = SHA(BiKi) % One way hash function on fi
%SHA 256 output --> fi = 6EEEE0B2284786DD416033159C3AE53E315CAE0FE7A95AB39160ED7CD7E5A685
fi_db = double(fi);
PWi_double = double(PWi)
IDiPWi = strcat(num2str(IDi),num2str(PWi));
IDiPWi_double = double(IDiPWi);
gi = bitxor(IDiPWi_double,fi_db) %this part is not working
% Error using bitxor
% Inputs must have the same size.
ji = bitxor(IDiPWi_double,Ki)
1 件のコメント
Gareth Thomas
2014 年 3 月 22 日
if you type:
size(IDiPWi_double) size(fi_db)
You will notice that the sizes do not match and the function needs them to be the same.
Hope this helps.
回答 (2 件)
Gareth Thomas
2014 年 3 月 22 日
if you type:
size(IDiPWi_double)
size(fi_db)
You will notice that the sizes do not match and the function needs them to be the same.
Hope this helps.
Gareth Thomas
2014 年 3 月 23 日
Hi Vidya,
You can do a couple of things:
- force the inputs to be a particular size so that they add up to 256.
- given the strcat command, add characters until you get what you want. this probably plays a role in your algorithm
If you choose for the later, you could calculate how far off the sequence is and add a known letter with:
repmat('A',1,256-size(IDiPWi_double,2))
Or just add a random letter.
0 件のコメント
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!