From 5a85abbe50fbbebe364dbb9064505d18891680ba Mon Sep 17 00:00:00 2001 From: Findeton Date: Sat, 3 Jun 2017 16:45:24 +0200 Subject: [PATCH 1/8] add desborda3 --- .../accordion-option-directive/accordion-option-directive.js | 4 ++++ avBooth/booth-directive/booth-directive.js | 5 +++++ avBooth/review-ballot-directive/review-ballot-directive.js | 4 ++++ crypto/answer-encoder-service.js | 2 +- locales/ca.json | 2 +- locales/en.json | 2 +- locales/es.json | 2 +- locales/gl.json | 2 +- 8 files changed, 18 insertions(+), 5 deletions(-) diff --git a/avBooth/accordion-option-directive/accordion-option-directive.js b/avBooth/accordion-option-directive/accordion-option-directive.js index 4507e307..d70c0680 100644 --- a/avBooth/accordion-option-directive/accordion-option-directive.js +++ b/avBooth/accordion-option-directive/accordion-option-directive.js @@ -107,6 +107,10 @@ angular.module('avBooth') { return; }, + "desborda3": function() + { + return Math.max(1, Math.floor(scope.question.num_winners * 1.3) - scope.option.selected); + }, "desborda2": function() { return Math.max(1, Math.floor(scope.question.num_winners * 1.3) - scope.option.selected); diff --git a/avBooth/booth-directive/booth-directive.js b/avBooth/booth-directive/booth-directive.js index 15df624d..f999aec0 100644 --- a/avBooth/booth-directive/booth-directive.js +++ b/avBooth/booth-directive/booth-directive.js @@ -124,6 +124,11 @@ angular.module('avBooth') sorted: true, ordered: true }, + "desborda3": { + state: stateEnum.multiQuestion, + sorted: true, + ordered: true + }, "desborda2": { state: stateEnum.multiQuestion, sorted: true, diff --git a/avBooth/review-ballot-directive/review-ballot-directive.js b/avBooth/review-ballot-directive/review-ballot-directive.js index 9c8bcb65..bf2dbee1 100644 --- a/avBooth/review-ballot-directive/review-ballot-directive.js +++ b/avBooth/review-ballot-directive/review-ballot-directive.js @@ -59,6 +59,10 @@ angular.module('avBooth') { return; }, + "desborda3": function() + { + return Math.max(1, Math.floor(question.num_winners * 1.3) - answer.selected); + }, "desborda2": function() { return Math.max(1, Math.floor(question.num_winners * 1.3) - answer.selected); diff --git a/crypto/answer-encoder-service.js b/crypto/answer-encoder-service.js index cb19744e..1649b95b 100644 --- a/crypto/answer-encoder-service.js +++ b/crypto/answer-encoder-service.js @@ -50,7 +50,7 @@ angular.module('avCrypto') return function (requestedCodec, numAvailableOptions) { var multi = { - validCodecs: ["plurality-at-large", "borda-nauru", "borda", "desborda2", "desborda"], + validCodecs: ["plurality-at-large", "borda-nauru", "borda", "desborda3", "desborda2", "desborda"], numAvailableOptions: numAvailableOptions, /** diff --git a/locales/ca.json b/locales/ca.json index b85ca39b..ef88c8ad 100644 --- a/locales/ca.json +++ b/locales/ca.json @@ -22,7 +22,7 @@ "poweredBy": "Funciona amb __name__", "shareLink": "¡Tuitgeu aquesta votació!", "votingSystem": "Sistema de votació", - "votings": {"plurality-at-large": "Plurality at large", "borda-nauru": "Nauru's Borda Count or Borda Dowdall (1/n)", "borda": "Borda Count (traditional)", "pairwise-beta": "Pairwise (beta-distribution)", "desborda2": "DesBorda2", "desborda": "DesBorda"} + "votings": {"plurality-at-large": "Plurality at large", "borda-nauru": "Nauru's Borda Count or Borda Dowdall (1/n)", "borda": "Borda Count (traditional)", "pairwise-beta": "Pairwise (beta-distribution)", "desborda3": "DesBorda3", "desborda2": "DesBorda2", "desborda": "DesBorda"} }, "avBooth": { "legal": { diff --git a/locales/en.json b/locales/en.json index 737d7fb6..a54d3bf0 100644 --- a/locales/en.json +++ b/locales/en.json @@ -24,7 +24,7 @@ "poweredBy": "Powered by __name__", "shareLink": "¡Tweet this election!", "votingSystem": "Voting System", - "votings": {"plurality-at-large": "Plurality at large", "borda-nauru": "Nauru's Borda Count or Borda Dowdall (1/n)", "borda": "Borda Count (traditional)", "pairwise-beta": "Pairwise (beta-distribution)", "desborda2": "DesBorda2", "desborda": "DesBorda"} + "votings": {"plurality-at-large": "Plurality at large", "borda-nauru": "Nauru's Borda Count or Borda Dowdall (1/n)", "borda": "Borda Count (traditional)", "pairwise-beta": "Pairwise (beta-distribution)", "desborda3": "DesBorda3", "desborda2": "DesBorda2", "desborda": "DesBorda"} }, "avBooth": { "legal": { diff --git a/locales/es.json b/locales/es.json index 21eefc1d..32e3bdb8 100644 --- a/locales/es.json +++ b/locales/es.json @@ -24,7 +24,7 @@ "poweredBy": "Funciona con __name__", "shareLink": "¡Twittea esta votación!", "votingSystem": "Sistema de Voto", - "votings": {"plurality-at-large": "Voto en bloque o Escrutinio Mayoritario Plurinominal", "borda-nauru": "Borda de Nauru o Borda Dowdall (1/n)", "borda": "Borda Count (tradicional)", "pairwise-beta": "Comparación de pares (distribución beta)", "desborda2": "DesBorda2", "desborda": "DesBorda"} + "votings": {"plurality-at-large": "Voto en bloque o Escrutinio Mayoritario Plurinominal", "borda-nauru": "Borda de Nauru o Borda Dowdall (1/n)", "borda": "Borda Count (tradicional)", "pairwise-beta": "Comparación de pares (distribución beta)", "desborda3": "DesBorda3", "desborda2": "DesBorda2", "desborda": "DesBorda"} }, "avBooth": { "legal": { diff --git a/locales/gl.json b/locales/gl.json index 65d61c49..44676169 100644 --- a/locales/gl.json +++ b/locales/gl.json @@ -22,7 +22,7 @@ "poweredBy": "Funciona amb __name__", "shareLink": "Comparte en Twitter que xa votaches nas primarias de En Marea", "votingSystem": "Voting System", - "votings": {"plurality-at-large": "Plurality at large", "borda-nauru": "Nauru's Borda Count or Borda Dowdall (1/n)", "borda": "Borda Count (traditional)", "pairwise-beta": "Pairwise (beta-distribution)", "desborda2": "DesBorda2", "desborda": "DesBorda"} + "votings": {"plurality-at-large": "Plurality at large", "borda-nauru": "Nauru's Borda Count or Borda Dowdall (1/n)", "borda": "Borda Count (traditional)", "pairwise-beta": "Pairwise (beta-distribution)", "desborda3": "DesBorda3", "desborda2": "DesBorda2", "desborda": "DesBorda"} }, "avBooth": { "legal": { From ed3dfb0c761803b8970d4685fbe9e0459d6f5fb9 Mon Sep 17 00:00:00 2001 From: Findeton Date: Tue, 5 Sep 2017 14:05:04 +0200 Subject: [PATCH 2/8] set grunt-merge-json to 0.9.5 because last version gives problems with chalk (https://github.com/eirslett/frontend-maven-plugin/issues/629) --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 0ecdd8a3..77b18e08 100644 --- a/package.json +++ b/package.json @@ -18,7 +18,7 @@ "grunt-contrib-watch": "~0.6", "grunt-dom-munger": "~3.4", "grunt-karma": "~0.8.3", - "grunt-merge-json": "^0.9.5", + "grunt-merge-json": "0.9.5", "grunt-ng-annotate": "^0.9.2", "grunt-protractor-runner": "^1.1.4", "karma": "~0.12.6", From dbd96fe8de5727e50dc9ea3c2827c5fbeaec9175 Mon Sep 17 00:00:00 2001 From: Findeton Date: Wed, 6 Sep 2017 13:43:15 +0200 Subject: [PATCH 3/8] change version to go v4 --- Gruntfile.js | 28 ++++++++++++++-------------- bower.json | 2 +- index.html | 6 +++--- package.json | 2 +- 4 files changed, 19 insertions(+), 19 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index effb7c3d..884dbc97 100755 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -19,7 +19,7 @@ 'use strict'; var pkg = require('./package.json'); -var AV_CONFIG_VERSION = '103111.3'; +var AV_CONFIG_VERSION = '103111.4'; //Using exclusion patterns slows down Grunt significantly //instead of creating a set of patterns like '**/*.js' and '!**/node_modules/**' @@ -204,13 +204,13 @@ module.exports = function (grunt) { remove: ['script[data-remove!="false"]','link[data-remove!="false"]'], append: [ {selector:'body',html:'<%= variables.booth_html_body_include %>'}, - {selector:'body',html:''}, + {selector:'body',html:''}, {selector:'body',html:''}, - {selector:'body',html:''}, - {selector:'body',html:''}, - {selector:'body',html:''}, - {selector:'body',html:''}, - {selector:'body',html:''}, + {selector:'body',html:''}, + {selector:'body',html:''}, + {selector:'body',html:''}, + {selector:'body',html:''}, + {selector:'body',html:''}, {selector:'head',html:''} ] }, @@ -243,9 +243,9 @@ module.exports = function (grunt) { ], 'temp/lib.js': ['<%= dom_munger.data.libjs %>'], 'temp/app.js': ['<%= dom_munger.data.appjs %>','<%= ngtemplates.main.dest %>'], - 'dist/avConfig-v103111.3.js': ['avConfig.js'], - 'dist/avThemes-v103111.3.js': ['bower_components/avCommon/dist/avThemes-v103111.3.js'], - 'dist/avPlugins-v103111.3.js': ['plugins/**/*.js'] + 'dist/avConfig-v103111.4.js': ['avConfig.js'], + 'dist/avThemes-v103111.4.js': ['bower_components/avCommon/dist/avThemes-v103111.4.js'], + 'dist/avPlugins-v103111.4.js': ['plugins/**/*.js'] } } }, @@ -277,10 +277,10 @@ module.exports = function (grunt) { beautify: true }, files: { - 'dist/app-v103111.3.min.js': 'temp/app.js', - 'dist/lib-v103111.3.min.js': 'temp/lib.js', - 'dist/libnocompat-v103111.3.min.js': 'temp/libnocompat.js', - 'dist/libcompat-v103111.3.min.js': 'temp/libcompat.js', + 'dist/app-v103111.4.min.js': 'temp/app.js', + 'dist/lib-v103111.4.min.js': 'temp/lib.js', + 'dist/libnocompat-v103111.4.min.js': 'temp/libnocompat.js', + 'dist/libcompat-v103111.4.min.js': 'temp/libcompat.js', 'dist/avWidgets.min.js': 'avWidgets.js', "dist/locales/moment/en.js": "bower_components/moment/lang/en-gb.js", diff --git a/bower.json b/bower.json index c0d99a0e..adf72e7d 100755 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "agoraGuiBooth", - "version" : "103111.3", + "version" : "103111.4", "main": "index.html", "ignore": [ "**/.*", diff --git a/index.html b/index.html index aca2dad9..f5d57d18 100755 --- a/index.html +++ b/index.html @@ -15,8 +15,8 @@ - - + + @@ -34,7 +34,7 @@ - + diff --git a/package.json b/package.json index 77b18e08..97de0930 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "agora-gui-booth", - "version" : "103111.3.0", + "version" : "103111.4.0", "devDependencies": { "grunt": "~0.4", "grunt-angular-templates": "~0.5", From c888a4a09ab1681f7f14b656bce1a7f1f404bfa5 Mon Sep 17 00:00:00 2001 From: Eduardo Robles Elvira Date: Fri, 8 Sep 2017 13:00:13 +0200 Subject: [PATCH 4/8] fix issue regarding ballot encoding checking that was causing some perfectly valid ballots not to be accepted (false negatives) --- crypto/encrypt-answer-service.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/crypto/encrypt-answer-service.js b/crypto/encrypt-answer-service.js index a443d24b..e62945d1 100644 --- a/crypto/encrypt-answer-service.js +++ b/crypto/encrypt-answer-service.js @@ -54,10 +54,17 @@ angular.module('avCrypto') // checking that encoding a number to a member of the group and then // decoding it returns the same number. This will usually detect if - // a number too big to encode in the group + // a number too big to encode in the group. + // + // Because the number coming from the group will never have a zero to + // the left but the origin plain_answer might, we strip the zeros to + // the left of plain_answer. We could convert them to BigInts both + // and compare but seems overkill, and we cannot convert them to ints + // because the numbers might be bigger than the max-safe-int in + // javascript, so that's why are we still comparing them as strings. var plainAnswerDecoded = plaintext.getPlaintext(); if (!!error_func && - (plainAnswerDecoded.toJSONObject()+"" !== plain_answer+"")) + (plainAnswerDecoded.toJSONObject()+"" !== plain_answer.replace(/^0+/, "")+"")) { error_func("errorEncoding", "error while encoding the number to a member of the group"); } From 82a69a09a13cf7a5a92e6479f16ecdb58a07f4ff Mon Sep 17 00:00:00 2001 From: Eduardo Robles Elvira Date: Fri, 8 Sep 2017 13:41:30 +0200 Subject: [PATCH 5/8] config version is v3 --- Gruntfile.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gruntfile.js b/Gruntfile.js index 884dbc97..6d15728f 100755 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -19,7 +19,7 @@ 'use strict'; var pkg = require('./package.json'); -var AV_CONFIG_VERSION = '103111.4'; +var AV_CONFIG_VERSION = '103111.3'; //Using exclusion patterns slows down Grunt significantly //instead of creating a set of patterns like '**/*.js' and '!**/node_modules/**' From e103585fed04fe99d550d4f3dc35f26a01ad7683 Mon Sep 17 00:00:00 2001 From: Findeton Date: Fri, 8 Sep 2017 17:02:53 +0200 Subject: [PATCH 6/8] set version to go v4 --- Gruntfile.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gruntfile.js b/Gruntfile.js index 6d15728f..884dbc97 100755 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -19,7 +19,7 @@ 'use strict'; var pkg = require('./package.json'); -var AV_CONFIG_VERSION = '103111.3'; +var AV_CONFIG_VERSION = '103111.4'; //Using exclusion patterns slows down Grunt significantly //instead of creating a set of patterns like '**/*.js' and '!**/node_modules/**' From 646b707b29072a38de0fe3bc79f442b36eafb196 Mon Sep 17 00:00:00 2001 From: Eduardo Robles Elvira Date: Fri, 15 Sep 2017 12:58:02 +0200 Subject: [PATCH 7/8] adding some extra comments for increased readability --- vendor/crypto/elgamal.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/vendor/crypto/elgamal.js b/vendor/crypto/elgamal.js index 93792ee6..cfcd8355 100644 --- a/vendor/crypto/elgamal.js +++ b/vendor/crypto/elgamal.js @@ -344,9 +344,12 @@ ElGamal.Plaintext = Class.extend({ this.pk = pk; + // encode to m * legendre(m|p) if (encode_m) { // need to encode the message given that p = 2q+1 var y = m.add(BigInt.ONE); + + // euler criterion to determine quadratic residuosity var test = y.modPow(pk.q, pk.p); if (test.equals(BigInt.ONE)) { this.m = y; @@ -593,4 +596,4 @@ ElGamal.fiatshamir_dlog_challenge_generator = function(commitment) { // return new BigInt(hex_sha256(commitment.toJSONObject()), 16); return new BigInt(hex_sha256(commitment.toString()), 16); }; -/* jshint ignore:end */ \ No newline at end of file +/* jshint ignore:end */ From 3bf0ea9fcc745a62037099b03b40dbed352996d7 Mon Sep 17 00:00:00 2001 From: Findeton Date: Mon, 18 Sep 2017 15:41:38 +0200 Subject: [PATCH 8/8] go v5 --- Gruntfile.js | 28 ++++++++++++++-------------- bower.json | 2 +- index.html | 6 +++--- package.json | 2 +- 4 files changed, 19 insertions(+), 19 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index 884dbc97..1eed0de3 100755 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -19,7 +19,7 @@ 'use strict'; var pkg = require('./package.json'); -var AV_CONFIG_VERSION = '103111.4'; +var AV_CONFIG_VERSION = '103111.5'; //Using exclusion patterns slows down Grunt significantly //instead of creating a set of patterns like '**/*.js' and '!**/node_modules/**' @@ -204,13 +204,13 @@ module.exports = function (grunt) { remove: ['script[data-remove!="false"]','link[data-remove!="false"]'], append: [ {selector:'body',html:'<%= variables.booth_html_body_include %>'}, - {selector:'body',html:''}, + {selector:'body',html:''}, {selector:'body',html:''}, - {selector:'body',html:''}, - {selector:'body',html:''}, - {selector:'body',html:''}, - {selector:'body',html:''}, - {selector:'body',html:''}, + {selector:'body',html:''}, + {selector:'body',html:''}, + {selector:'body',html:''}, + {selector:'body',html:''}, + {selector:'body',html:''}, {selector:'head',html:''} ] }, @@ -243,9 +243,9 @@ module.exports = function (grunt) { ], 'temp/lib.js': ['<%= dom_munger.data.libjs %>'], 'temp/app.js': ['<%= dom_munger.data.appjs %>','<%= ngtemplates.main.dest %>'], - 'dist/avConfig-v103111.4.js': ['avConfig.js'], - 'dist/avThemes-v103111.4.js': ['bower_components/avCommon/dist/avThemes-v103111.4.js'], - 'dist/avPlugins-v103111.4.js': ['plugins/**/*.js'] + 'dist/avConfig-v103111.5.js': ['avConfig.js'], + 'dist/avThemes-v103111.5.js': ['bower_components/avCommon/dist/avThemes-v103111.5.js'], + 'dist/avPlugins-v103111.5.js': ['plugins/**/*.js'] } } }, @@ -277,10 +277,10 @@ module.exports = function (grunt) { beautify: true }, files: { - 'dist/app-v103111.4.min.js': 'temp/app.js', - 'dist/lib-v103111.4.min.js': 'temp/lib.js', - 'dist/libnocompat-v103111.4.min.js': 'temp/libnocompat.js', - 'dist/libcompat-v103111.4.min.js': 'temp/libcompat.js', + 'dist/app-v103111.5.min.js': 'temp/app.js', + 'dist/lib-v103111.5.min.js': 'temp/lib.js', + 'dist/libnocompat-v103111.5.min.js': 'temp/libnocompat.js', + 'dist/libcompat-v103111.5.min.js': 'temp/libcompat.js', 'dist/avWidgets.min.js': 'avWidgets.js', "dist/locales/moment/en.js": "bower_components/moment/lang/en-gb.js", diff --git a/bower.json b/bower.json index adf72e7d..89763eb5 100755 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "agoraGuiBooth", - "version" : "103111.4", + "version" : "103111.5", "main": "index.html", "ignore": [ "**/.*", diff --git a/index.html b/index.html index f5d57d18..27f8a878 100755 --- a/index.html +++ b/index.html @@ -15,8 +15,8 @@ - - + + @@ -34,7 +34,7 @@ - + diff --git a/package.json b/package.json index 97de0930..aa468de4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "agora-gui-booth", - "version" : "103111.4.0", + "version" : "103111.5.0", "devDependencies": { "grunt": "~0.4", "grunt-angular-templates": "~0.5",