Converting MD5 result into an integer in C
My goal is to use the result of an MD5 result to index a hash table. I want to perform a Modulo operation on it to find the appropriate slot in the table. I have tried casting it as an unsigned long long type. When I printed the result, I got a different number every time for the same MD5 hash. The MD5 hash is initially an unsigned char *. Can someone tell me what I am doing wrong? Here is my function: int get_fp_slot(unsigned char * fingerprint, int size) { return (unsigned long long)fingerprint % size; } An MD5 hash is a 128 bit number. So for best performance you should probably keep all