The Helios Lib
This is Helios-Server (Helios is an end-to-end verifiable voting system.) as library,
This helios_lib version is completely independent of Django.
Install
>>> pip install helios_lib
Test
>>> pytest --fulltrace -s helios_lib/
Example
from helios_lib.models import HeliosElection, HeliosVoter
from helios_lib.config import ELGAMAL_PARAMS
# Create election
helios_election = HeliosElection()
# Add trustee
trustee_default = helios_election.generate_helios_trustee(ELGAMAL_PARAMS)
helios_election.trustees.append(trustee_default)
# Add questions
question = HeliosElection.create_question(answers_count=5, minimum=0, maximum=2, result_type='relative')
helios_election.questions = [question]
# Add voters
voters_count = 4
helios_election.voters = [HeliosVoter() for _ in range(voters_count)]
# Freeze the election
helios_election.freeze()
# Cast votes, Encrypt votes of voters on the helios_lib side
helios_election.voters[0].vote = helios_election.encrypt_ballot('[[0,4]]')
helios_election.voters[1].vote = helios_election.encrypt_ballot('[[0]]')
helios_election.voters[2].vote = helios_election.encrypt_ballot('[[1]]')
helios_election.voters[3].vote = helios_election.encrypt_ballot('[[1,4]]')
# Verify votes of voters
for v in helios_election.voters:
v.vote.verify(helios_election)
# Tally election
helios_election.num_cast_votes = 4
helios_election.compute_tally(helios_election.voters)
helios_trustee = helios_election.get_helios_trustee()
helios_election.helios_trustee_decrypt(helios_trustee)
helios_election.combine_decryptions()
# Result of election
assert helios_election.result == [[2, 2, 0, 0, 2]]
For more complex example refer to tests
Metadata
Release files for helios-lib 0.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| helios_lib-0.0.1.tar.gz | 46.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| helios_lib-0.0.1-py2-none-any.whl | Python 2 | none | any | Details |
Total release size: 102.7 kB
Release files / helios_lib-0.0.1.tar.gz
| Download URL | helios_lib-0.0.1.tar.gz |
|---|---|
| Size | 46.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
49ff561de69cc481c8a9e77c39dcf12a9a6e50c51168b8339786eba293053ab7
|
|
BLAKE2b-256 checksum How to use checksums |
29433e72e64f493ba411b24ddf65bd24b6a94a3a8335d5e7bb46d4829c032b06
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.12.1 pkginfo/1.4.2 requests/2.20.0 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/2.7.12
|
Release files / helios_lib-0.0.1-py2-none-any.whl
| Download URL | helios_lib-0.0.1-py2-none-any.whl |
|---|---|
| Size | 55.7 kB |
| Tags | Python 2 |
|
SHA-256 checksum How to use checksums |
cf76e601b896289f12d2dd26c7b888ea245d5287b125155d1db8b4a64df26514
|
|
BLAKE2b-256 checksum How to use checksums |
22609a388845667e9d62a228c6c71584aa49de365dec17d67e6918abca28758a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.12.1 pkginfo/1.4.2 requests/2.20.0 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/2.7.12
|