How can i log Requests to get unique visitors of my webpage but without saving his ip?
Hashing?
How can i log Requests to get unique visitors of my webpage but without saving his ip?
Hashing?
Yep, hashing would do. Just take an md5() of the user's IP and use that as a key to your datastructure (which can be a database, some file, or whatever you prefer).
A database table mapping md5(IP_ADDRESS) to a number should do the trick.
Yes, if you hash the IP address with MD5 or SHA1 you'll get the same hash for a given IP, but without the ability to easily reverse it.
However, if you did want to reverse it, and knew the salt (if any was used) you have a head start in attempting to reverse it as you know the plaint text is a dotted quad. You could even narrow the search space to particular country IP blocks too.
If this is a concern, instead of a 128 bit hash like MD5, use a 32 bit hash so that the hash space is the same size as the IP address space. To do this, you could simply truncate an MD5 hash. You'll certainly get collisions, but attempting to reverse is less likely to give you much to go on.