Going home

This commit is contained in:
Rumperuu 2018-08-16 22:17:16 +01:00
parent 77508479b4
commit 89533a54b1
9 changed files with 256 additions and 151 deletions

17
static/js/vote_audit.js Normal file
View file

@ -0,0 +1,17 @@
$('#begin-test').click(function() {
var ballot = JSON.parse(sjcl.decrypt($('#SK').val(), $('#ballot').text()));
var votes = ballot['encryptedVotes'][0]['fragments'];
$('#ballot-content').text(JSON.stringify(votes));
var option = 0;
votes.forEach(function(cT) {
option++;
var encoding = "";
for (var i = 0; i < cT['C1'].length; i++) {
cipherText = "("+cT['C1']+","+cT['C2']+")";
var m = cT['C2'][i] / Math.pow(cT['C1'][i], cT['r'][i]);
encoding += (m) ? "1" : "0";
}
$('#ballot-result').text($('#ballot-result').text() + "\n\nOption "+option+": "+encoding);
})
});