TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Ask HN: How do I anonymize a user's IP Address?

6 pointsby thisismyhnuserabout 9 years ago
For instance, take the IP address of "215.54.387.9"...if I simply use "215.54.387" and leave out the last "9" is that enough so that the IP address cannot be traced back to the user? My understanding is that a government entity, etc needs to match the HTTP referer in combination w/ the full IP address to track down the user's information, or am I wrong? Also, how would I deal with IPV6 addresses?

4 comments

greenyodaabout 9 years ago
<i>&quot;I simply use &#x27;215.54.387&#x27; and leave out the last &#x27;9&#x27; is that enough so that the IP address cannot be traced back to the user?&quot;</i><p>A single company could easily own all 256 IP addresses in 215.54.87.*. (Larger companies can own even larger blocks of IP addresses.) So just dropping the last number doesn&#x27;t offer much anonymity. For example, once somebody traced the address down to XYZ Company, that company might be able to give them a log of all outgoing traffic tied to specific employees&#x27; machines. Even an ISP might be able to link a partial IP address to a specific user if they can search their logs for a specific date&#x2F;time&#x2F;destination.<p>(Note: &#x27;387&#x27; could never be a component of an IPv4 address, since each component is 8 bits, or 0-255.)
Raed667about 9 years ago
Do you NEED this information in your DB? Can you live without it? If so, just don&#x27;t store the IP addresses.
评论 #11513317 未加载
detaroabout 9 years ago
a) please do not delete &amp; repost, it&#x27;s against HNs rules<p>b) You can&#x27;t maintain a 1:1 mapping and anonymity, if I know your algorithm it&#x27;s trivial to try all IP addresses and get a mapping to do a reverse look up. You need to throw away data to make it ambiguous, e.g. in probabilistic data structures like bloom filters.<p>I don&#x27;t know what a snooper would want with the HTTP referrer information.
评论 #11512337 未加载
sajidabout 9 years ago
You can use HMAC:<p><a href="https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Hash-based_message_authentication_code" rel="nofollow">https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Hash-based_message_authenticat...</a>