Search code examples
webip-addresshashprivacy

How can I store an IP address for comparison without revealing it?


To fight vote fraud, I need to store IP addresses in my database but I want to make them anonymous. The only information that I need is if two addresses are the same ... I think.

  • To prevent voting manipulation in a public web site, is it enough to compare IP addresses for equality?

  • For transparency/verification purposes, I'd like to allow users to download the voting data. Therefore, I have to hash the IP addresses in a suitable way. Which hash method do you suggest and why?


Solution

  • Comparing public IPs wont be enough. You will let only one vote from few countries and from corporates, which have one external IPs.

    Best way to do it is use multiple methods to detect the fake votes.

    • If users are logged in vote is tied to login,
    • if not set a browser cookie.
    • Do not allow votes from same IP + same-cookie at very fast rate.
    • Put a captcha if votes are coming at very fast rate from same IP.

    For anonymizing the IP just make keyed hash of IP.