On the other hand, as parent noticed, hashing IPs is not effective as it's possible to reverse it (the IP space is small).
What if you are using IPv6?