Correcting the function that generates the hash