-2

I have a list of items , for example ["Alice","Bob","Alice","John"] and I want to generate k hash functions such that :

h1("Alice") = val1

h2("Alice") = val2

...

hk("Alice") = val3

I tried using MD5 algorithm in Python2.X for hashing but it will give the same value for the same string.

1 Answers1

1

the purpose of a hash-function is to generate the same hash for the same input... . You can add a salt-value before hashing though:

string[] salt = {"salt1" , "salt2" , ...}

hash(k , s):
    return hash(s + salt[k])