##Using char as array index##
Using char as array index
Be careful when you use a char
as an array index. A char
is signed, so it can take on negative values. When you do something like this:
value1 = b2h[given_password_hex[i * 2]];
you could be reading from b2h[-128]
. It would be better to use unsigned char
instead, or to use casts to unsigned char
in the appropriate places.