Split off hash functions from util.h