This smart ballot tracker confirms that {{ voter.py_name }} cast a vote in the election {{ election.py_name }} at {{ vote.cast_at }}.
+Ballot fingerprint: {{ eosjs.eos.core.hashing.__all__.SHA256().update_obj(vote.ballot).hash_as_b64(true) }}
+diff --git a/eos/core/hashing/__init__.py b/eos/core/hashing/__init__.py index ea378ab..b7b47ce 100644 --- a/eos/core/hashing/__init__.py +++ b/eos/core/hashing/__init__.py @@ -1,5 +1,5 @@ # Eos - Verifiable elections -# Copyright © 2017 RunasSudo (Yingtong Li) +# Copyright © 2017-18 RunasSudo (Yingtong Li) # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by @@ -79,11 +79,14 @@ class SHA256: self.update_text(EosObject.to_json(EosObject.serialise_and_wrap(value, None, SerialiseOptions(for_hash=False)))) return self - def hash_as_b64(self): + def hash_as_b64(self, short=False): if is_python: - return base64.b64encode(self.impl.digest()).decode('utf-8') + b64 = base64.b64encode(self.impl.digest()).decode('utf-8') else: - return self.impl.getHash('B64') + b64 = self.impl.getHash('B64') + if short: + return b64[:8] + return b64 def hash_as_hex(self): if is_python: diff --git a/eosweb/core/static/nunjucks/booth/audit.html b/eosweb/core/static/nunjucks/booth/audit.html index 979b012..228cbb4 100644 --- a/eosweb/core/static/nunjucks/booth/audit.html +++ b/eosweb/core/static/nunjucks/booth/audit.html @@ -2,7 +2,7 @@ {# Eos - Verifiable elections - Copyright © 2017 RunasSudo (Yingtong Li) + Copyright © 2017-18 RunasSudo (Yingtong Li) This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by @@ -25,7 +25,7 @@
Your vote has not yet been cast. Please follow the instructions to continue.
-The following is your ballot with fingerprint {{ eosjs.eos.core.hashing.__all__.SHA256().update_obj(ballot).hash_as_b64() }}, decrypted and ready for auditing.
+The following is your ballot with fingerprint {{ eosjs.eos.core.hashing.__all__.SHA256().update_obj(ballot).hash_as_b64(true) }}, decrypted and ready for auditing.
Your vote has not yet been cast. If you have not already done so, please make a note of your ballot fingerprint, {{ eosjs.eos.core.hashing.__all__.SHA256().update_obj(ballot).hash_as_b64() }}.
+Your vote has not yet been cast. If you have not already done so, please make a note of your ballot fingerprint, {{ eosjs.eos.core.hashing.__all__.SHA256().update_obj(ballot).hash_as_b64(true) }}.
-If you have not already done so, please make a note of your ballot fingerprint, {{ eosjs.eos.core.hashing.__all__.SHA256().update_obj(ballot).hash_as_b64() }}. Please retain a copy of your ballot fingerprint – you can use it to verify that your vote has been counted correctly. You may print this page as a receipt if you wish.
+If you have not already done so, please make a note of your ballot fingerprint, {{ eosjs.eos.core.hashing.__all__.SHA256().update_obj(ballot).hash_as_b64(true) }}. Please retain a copy of your ballot fingerprint – you can use it to verify that your vote has been counted correctly. You may print this page as a receipt if you wish.
To continue, copy and paste the ballot below and provide it to the election administrator.
diff --git a/eosweb/core/static/nunjucks/booth/complete.html b/eosweb/core/static/nunjucks/booth/complete.html index 6450212..47637cb 100644 --- a/eosweb/core/static/nunjucks/booth/complete.html +++ b/eosweb/core/static/nunjucks/booth/complete.html @@ -2,7 +2,7 @@ {# Eos - Verifiable elections - Copyright © 2017 RunasSudo (Yingtong Li) + Copyright © 2017-18 RunasSudo (Yingtong Li) This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by @@ -21,10 +21,13 @@ {% block content %}Your vote has been successfully cast. The following is your ‘smart ballot tracker’. Please retain a copy of your smart ballot tracker – you can use it to verify that your vote has been counted correctly. You may print this page as a receipt if you wish.
-