Giter Site home page Giter Site logo

election-system's Introduction

Intro

This is a simple static website that can be hosted to conduct small scale election within closed groups. This system provides two features:

  • voters would know that their vote was counted in the right place
  • voting would be anonymous

How it works?

This relies on asymmetric encryption. Let’s first look at the process from user’s perspective without any implementation details.

  1. A host conducts the election
    1. he first generates a key
    2. and enters the list of candidates
    3. then share a link to the voting page to the voters
  2. Voters open the voting page
    1. then generate a random keyword
    2. select one of the candidates

    3 finally generate a token that is then sent to the host

  3. host enters all the tokens from the voters and finally votes are aggregated.

The result shows the voters keywords alongside the candidate. So, an individual voter knows that his vote is counted at the right place. And since an individual’s keyword is known to only him, noone else knows who voted whom.

Now lets look at the technical aspects corresponding to each step above:

  1. Host conducting the election should screenshare his page all the time, so that he cannot look at the internal variables and private key.
    1. Host first generates a pair of private key and public key. Private key is stored in memory (and is hidden), while the public key is shared to everyone.
    2. The public link has the public key and the candidate list stored in its url in json encoded form.
  2. Voters open the public link. So, the voter’s page knows the public key and the candidate list
    1. random keyword of three words is generated from a bag of ~1000 words implying very low collision possibilities in case of small elections
    2. token is generated by encrypting a json string containing the keyword, selected candidate name and a 16 characters long randomly generated password which is not shown to anyone. So, each time the token is generated it is random. Using a randomly generated password is necessary because otherwise anyone with the public link can generate tokens for each combination of keyword (which is known at the end of election) and candidate. And then match the resulting token with the token shared by the user to the host.
  3. all tokens are checked for validness and if any invalid token is found it is highlighted, and the results are not shown until all tokens are valid. the final list of tokens is shuffled to prevent any correlation with the order of entry of tokens with the final result list.

Things to take care by voters

  • verify that the url of host is https://bpanthi977.github.io/election/
  • check all the intructions and notes on the webpage
    • make sure the keys are freshly generated at the start of election
    • make sure all students have submitted the token
    • make sure that the host doesn’t go offline or disconnects and reconnected during the whole process.
  • copy and paste the token correctly

Library used for Cryptography

jsbn library by Tom Wu is used. This library provides RSA encryption algorithm for js.

JS files of the library were downloaded from following urls:

election-system's People

Contributors

bpanthi977 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.