Fixed bad asymptotic behavior of hash function