Can somebody help me with this please. I'm stuck due to my limited knowledge on Matlab.

1 visualización (últimos 30 días)
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 comentario
Gareth Thomas
Gareth Thomas el 22 de Mzo. de 2014
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.

Iniciar sesión para comentar.

Respuestas (2)

Gareth Thomas
Gareth Thomas el 22 de Mzo. de 2014
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.
  1 comentario
Vidya
Vidya el 22 de Mzo. de 2014
Thank you for replying. Yes I did that before and I can't seem to find a solution for that, if there are any to begin with.
I need them both to be of the same size. Is there any way to achieve that?

Iniciar sesión para comentar.


Gareth Thomas
Gareth Thomas el 23 de Mzo. de 2014
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.

Categorías

Más información sobre Just for fun en Help Center y File Exchange.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by