Added HashFunction trait and centralized some hash related testing code