add hash function to hash.c