query to hash