Is there a way to find a collision for a given hash function without brute forcing? The particular hash function I'm talking about is the one used by Python (simplified version given below). It returns a 64-bit value in my case, so I'd guess on average I need to try 2^32 values to get a collision. But given that we know the function is there a way to predict two values for which h(x1) == h(x2)?
static long string_hash(PyStringObject *a) {
len = Py_SIZE(a); //len is length of string
p = (unsigned char *) a->ob_sval; //p is the string to hash
x = *p << 7;
while (--len >= 0)
x = (1000003*x) ^ *p++;
x ^= Py_SIZE(a);
return x;
}