update hash function