What is the best hash function for Rabin-Karp algorithm?
===

I'm looking for an efficient hash function for Rabin-Karp algorithm. Here is my actual code (C programming langage).

    static bool f2(char const *const s1, size_t const n1, 
    	           char const *const s2, size_t const n2)
    {
    	uintmax_t hsub = hash(s2, n2);
    	uintmax_t hs   = hash(s1, n1);
    	size_t   nmax = n2 - n1;
    
    	for (size_t i = 0; i < nmax; ++i) {
    		if (hs == hsub) {
    			if (strncmp(&s1[i], s2, i + n2 - 1) == 0)
    				return true;
    		}
    		hs = hash(&s1[i + 1], i + n2);
    	}
    	return false;
    }

I considered some Rabin-Karp C implementations, but there are differences between all the codes. So my question is : what are the characteristics that a Rabin-Karp hash function should have ?

Thanks. (Sorry about misspellings)