I'm developing an application to run elections. A voting system. I would like to give the ability to the voters to check later if their vote were correct computed/casted.


  • each user has its own and unique voter id (64 bytes id)
  • we have the birthyear of an user (i.e 1977, 1982, etc)
  • the user must vote in N candidates (each candidate is represented by a number. candidate_1, candidate_2, candidate_N stands for numbers like 10,33,N)
  • in an election you must vote in N candidates, where N is >= 2.
  • votes are inserted in random order (they are not sequential)

As soon as the user has voted in his N candidates, it will be stored in a DB in the following format:

  • sha256(sha256(voter_id | birthyear) | candidate_1 | candidate_2 | candidate_n)
  • the chosen candidates (a list of candidate_1, candidate_2, candidate_N)

for example

the user 12345678, borned in 1980, in a 3 candidates election voted in the candidates 10,11,33.

we would compute his signature hash as:


in the db it would looks like:


The hash signature would be printed after his votes were casted. So he could then:

a) compute it locally and see if its matches

b) via an user gui, entering his voter_id, birthyear, candidate_1, candidate_2, candidate_n, calculate his hash and look up the DB and see if his votes were rightly computed.

Important: its not the same as Approach towards anonymous e-voting. I'm not trying to provide anonymity, but a way to the user validate if his votes were casted right.

the questions are:

a) Is that a good approach to garantee the integrity of the casted votes? is that enough?

b) why wouldnt it be enough to garantee anonymity? please assume that the votes are shuffled and inserted in random order.

c) is the birthyear an strong enough salt oder would be better the whole birthday dd-mm-yyyyy to increase the numbers of possibilites? I cannot let it up to the user decide, otherwise it would introduce a complexity/time in the human interaction with the system (think about which string, ask for help and etc).

  • 1
    $\begingroup$ Questions: Are votes public knowledge? Strictly speaking, are votes anonymous or not (must they contain user info)? How would a user verify their vote? If a user claims their vote was not properly casted, then what? $\endgroup$
    – Daniel
    Commented Dec 9, 2014 at 22:42
  • $\begingroup$ @DanielHenneberger they are anonymous. An attacker shouldnt be able to map vote -> voter. The user should have a way to after the casted voted are computed, look up his votes and see if they were casted right (online, a form will ask his voter id, birthyear and the voted candidates). however if the votes were casted wrong, there is nothing that the user can do about it. $\endgroup$
    – VP.
    Commented Dec 10, 2014 at 8:53
  • $\begingroup$ This scheme is not strong enough to guarantee anonymity. A user could brute force the hash because the data it has a low amount of entropy. That being said, hashing twice provides no additional security and should be removed, as well as adding a salt. Assigning a random number whose bits are equal to the number of bits in the hash in conjunction with all the fields in the voting record would provide anonymity for the hash but does not guarantee that the voting machine wasn't tampered with. $\endgroup$
    – Daniel
    Commented Dec 12, 2014 at 16:53
  • $\begingroup$ @DanielHenneberger not true at all. you should be careful when concatenating multiple strings, before hashing. The approach h(h(x)||y) is a valid one. $\endgroup$
    – VP.
    Commented Dec 13, 2014 at 11:28

2 Answers 2


It can guarantee the integrity, because you can not fake another voting with the same hash. However, this only shows the ballot is casted correctly, but does not prove the ballot is correctly counted. And as you said, it can not provide anonymity, such as buying vote and coercion.

  • $\begingroup$ sure it could even help in the coercion. Buying vote happens anyway, however AFAICS it provides a way to validate to the buyer, that you actually voted in the candidate that you were paid for. $\endgroup$
    – VP.
    Commented Dec 9, 2014 at 14:05

Just to say you have tons of literature about that.

If you need an entry point check out some papers here for instance:


Read the introductions and the related work and follow the links to find the big seminal papers in the domain.

Oh also, just a remark: it seems that you are looking for anonymity. if not, juts store cleartext in the DB, right ?

  • $\begingroup$ Well, the anonymity afaics, i'm getting via the hash + votes being inserted in random order than being shuffled. maybe attacking the hash with rainbow tables would be possible? $\endgroup$
    – VP.
    Commented Dec 9, 2014 at 20:46
  • $\begingroup$ i updated my question with more information. the hash protects the integrity of your vote. $\endgroup$
    – VP.
    Commented Dec 9, 2014 at 20:50
  • 1
    $\begingroup$ Ok, you answered my remark by answering @DanielHenneberger's comment. $\endgroup$ Commented Dec 10, 2014 at 12:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.