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.
assumptions:
- 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:
Digest::SHA256.hexdigest(Digest::SHA256.hexdigest("12345678|1980")+"10|11|33")
in the db it would looks like:
64d2dc73485ca4d26b6dfcd517849e9654c6b8f2b7ef386dc2055fcbec2f034b,"10|11|33"
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).