move hash function earlier to fix implicit declaration warning