I have a Java Function which use Byte Array, C doesn't have this kind of data Type, How can i write that function in C.
I'm not good in C, Its a Little Confusing for me, I have byte hash1 and byte hash2.
It give me distance in int in java, Why do i need byte in Char in Java. I know the question title looks duplicate but, there is no clear explanation.
Java Code:
public static int distance(byte[] hash1, byte[] hash2) {
int distance = 0;
for (int i = 0; i < hash1.length && i < hash2.length; i++)
{
distance += ((hash2[i] & 0xFF) - (hash1[i] & 0xFF))*((hash2[i] & 0xFF) - (hash1[i] & 0xFF));
}
return distance;
}