I need to create two independent hash functions to implement a bloom filter in java.
These two hash functions h_1(x) and h_2(x) will be used to simulate additional hash functions when needed.
I understand how to create a basic hash function like this:
hash function h(x) = x mod M, where M represent the hash table size and is a prime number.
Given a string x containing characters c_i : x <--> c_1, c_2, ... , c_n, x = c_1.c_2.c_3...c_n (. for concatenation)
Each character will be converted to ASCII code E{0, .. ,127} then multiply by a different constant for each characters here 128^n-1 to 128^0.
This way string containing the same characters in different order won't hash to same value.
x = c_1*128^n-1 + c_2*128^n-2 + ... + c_n*128^0
How can I create a second hash function that is independent of this one?
Would changing the constants be sufficient?
How can I verify that they are indeed independent?