Search code examples
phpprivacyvoting-systemanonymity

How to support anonymity on a website?


I'm making a website (using PHP, JavaScript and MySQL) with a voting system which allows people to vote anonymously but just only once.

It means that my system have to know who voted (because I have to check if the user already voted or not)but I didn't want to store the user name or the user's IP address in the database (ruin the anonymity). I don't know how to get started, I need some guidelines; what should I look for?


Solution

  • Your worst problem is how to make sure your users only vote once, but that's not the point of the question: you are asking how to ensure anonimity

    That is rather easy: treat the whatever you use for single-voting as a password, and hash it. So lets say for argument's sake you are using the IP. I'm aware of the problems with that, but lets assume this is your choice.

    • User votes
    • You hash the IP and save it.
    • You can even go as far as saving it in a different location. No need to even save what hash voted which option.
    • User votes again -> IP-hash is allready in database.
    • To not give away if someone has already voted, don't reply " you have already voted ", but just don't save the vote. This way there is no way to even know if there was a vote from this machine

    Mind you, this is about anonimity, not about how to ensure single-voting.