Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
belenios
belenios
Commits
c3bc14ec
Commit
c3bc14ec
authored
Jun 23, 2013
by
Stephane Glondu
Browse files
More convenient challenge computation in signature
parent
9a629ca7
Changes
1
Hide whitespace changes
Inline
Side-by-side
media/booth/js/jscrypto/heliosc-booth.js
View file @
c3bc14ec
...
...
@@ -73,9 +73,10 @@ HELIOS.EncryptedVote.prototype.doSignature = function(cred) {
var
pk
=
this
.
election
.
public_key
;
var
w
=
Random
.
getRandomInteger
(
pk
.
q
);
var
commitment
=
pk
.
g
.
modPow
(
w
,
pk
.
p
);
var
challenge
=
(
new
BigInt
(
hex_sha1
(
_
(
this
.
encrypted_answers
).
map
(
function
(
ea
)
{
var
prefix
=
"
sig|
"
+
commitment
.
toJSONObject
()
+
"
|
"
;
var
challenge
=
(
new
BigInt
(
hex_sha1
(
prefix
+
_
(
this
.
encrypted_answers
).
map
(
function
(
ea
)
{
return
ElGamal
.
stringify_choices
(
ea
.
choices
);
}).
join
(
"
;
"
)
+
"
:
"
+
commitment
.
toJSONObject
(
)),
16
)).
mod
(
pk
.
q
);
}).
join
(
"
,
"
)),
16
)).
mod
(
pk
.
q
);
// we do (q-x*challenge)+w instead of directly w-x*challenge,
// in case mod doesn't support negative numbers as expected
var
response
=
pk
.
q
.
subtract
(
cred
.
x
.
multiply
(
challenge
).
mod
(
pk
.
q
));
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment