Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Helios Server
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
TO
Helios Server
Commits
49673382
Commit
49673382
authored
13 years ago
by
Ben Adida
Browse files
Options
Downloads
Patches
Plain Diff
reenabled dummy bigint in case where browser is not doing the crypto
parent
9a125083
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
heliosbooth/js/jscrypto/bigint.dummy.js
+16
-60
16 additions, 60 deletions
heliosbooth/js/jscrypto/bigint.dummy.js
heliosbooth/vote.html
+6
-8
6 additions, 8 deletions
heliosbooth/vote.html
with
22 additions
and
68 deletions
heliosbooth/js/jscrypto/bigint.dummy.js
+
16
−
60
View file @
49673382
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
// A wrapper for java.math.BigInteger with some appropriate extra functions for JSON and
// A wrapper for java.math.BigInteger with some appropriate extra functions for JSON and
// generally being a nice JavaScript object.
// generally being a nice JavaScript object.
BigInt
=
Class
.
extend
({
BigInt
Dummy
=
Class
.
extend
({
init
:
function
(
value
,
radix
)
{
init
:
function
(
value
,
radix
)
{
if
(
radix
!=
10
)
if
(
radix
!=
10
)
throw
"
in dummy, only radix=10, here radix=
"
+
radix
;
throw
"
in dummy, only radix=10, here radix=
"
+
radix
;
...
@@ -59,71 +59,27 @@ BigInt = Class.extend({
...
@@ -59,71 +59,27 @@ BigInt = Class.extend({
});
});
BigInt
.
ready_p
=
false
;
BigInt
Dummy
.
use_applet
=
false
;
BigInt
.
use_applet
=
false
;
BigIntDummy
.
is_dummy
=
true
;
BigIntDummy
.
in_browser
=
false
;
BigInt
.
is_dummy
=
true
;
BigIntDummy
.
fromJSONObject
=
function
(
s
)
{
return
new
BigIntDummy
(
s
,
10
);
BigInt
.
fromJSONObject
=
function
(
s
)
{
return
new
BigInt
(
s
,
10
);
};
};
BigInt
.
fromInt
=
function
(
i
)
{
BigInt
Dummy
.
fromInt
=
function
(
i
)
{
return
BigInt
.
fromJSONObject
(
""
+
i
);
return
BigInt
Dummy
.
fromJSONObject
(
""
+
i
);
};
};
// Set up the pointer to the applet if necessary, and some
BigIntDummy
.
ZERO
=
new
BigIntDummy
(
"
0
"
,
10
);
// basic Big Ints that everyone needs (0, 1, 2, and 42)
BigIntDummy
.
ONE
=
new
BigIntDummy
(
"
1
"
,
10
);
BigInt
.
_setup
=
function
()
{
BigIntDummy
.
TWO
=
new
BigIntDummy
(
"
2
"
,
10
);
try
{
BigIntDummy
.
FORTY_TWO
=
new
BigIntDummy
(
"
42
"
,
10
);
BigInt
.
ZERO
=
new
BigInt
(
"
0
"
,
10
);
BigInt
.
ONE
=
new
BigInt
(
"
1
"
,
10
);
BigInt
.
TWO
=
new
BigInt
(
"
2
"
,
10
);
BigInt
.
FORTY_TWO
=
new
BigInt
(
"
42
"
,
10
);
BigInt
.
ready_p
=
true
;
}
catch
(
e
)
{
// not ready
// count how many times we've tried
if
(
this
.
num_invocations
==
null
)
this
.
num_invocations
=
0
;
this
.
num_invocations
+=
1
;
if
(
this
.
num_invocations
>
5
)
{
if
(
BigInt
.
setup_interval
)
window
.
clearInterval
(
BigInt
.
setup_interval
);
if
(
BigInt
.
setup_fail
)
{
BigInt
.
setup_fail
();
}
else
{
alert
(
'
bigint failed!
'
);
}
}
return
;
}
if
(
BigInt
.
setup_interval
)
window
.
clearInterval
(
BigInt
.
setup_interval
);
if
(
BigInt
.
setup_callback
)
BigIntDummy
.
ready_p
=
true
;
BigInt
.
setup_callback
();
};
BigInt
.
setup
=
function
(
callback
,
fail_callback
)
{
BigIntDummy
.
setup
=
function
(
callback
,
fail_callback
)
{
if
(
callback
)
console
.
log
(
"
using dummy bigint
"
);
BigInt
.
setup_callback
=
callback
;
callback
();
if
(
fail_callback
)
BigInt
.
setup_fail
=
fail_callback
;
BigInt
.
setup_interval
=
window
.
setInterval
(
"
BigInt._setup()
"
,
1000
);
}
}
// .onload instead of .ready, as I don't think the applet is ready until onload.
// FIXME: something wrong here in the first load
$
(
document
).
ready
(
function
()
{
BigInt
.
use_applet
=
false
;
});
This diff is collapsed.
Click to expand it.
heliosbooth/vote.html
+
6
−
8
View file @
49673382
...
@@ -5,6 +5,8 @@
...
@@ -5,6 +5,8 @@
<title>
Helios Voting Booth
</title>
<title>
Helios Voting Booth
</title>
<link
rel=
"stylesheet"
type=
"text/css"
href=
"css/booth.css"
/>
<link
rel=
"stylesheet"
type=
"text/css"
href=
"css/booth.css"
/>
<link
rel=
"stylesheet"
type=
"text/css"
href=
"css/forms.css"
/>
<link
rel=
"stylesheet"
type=
"text/css"
href=
"css/forms.css"
/>
<script
language=
"javascript"
src=
"js/jscrypto/class.js"
></script>
<script
language=
"javascript"
src=
"js/jscrypto/bigint.dummy.js"
></script>
<script
language=
"javascript"
src=
"js/jscrypto/jsbn.js"
></script>
<script
language=
"javascript"
src=
"js/jscrypto/jsbn.js"
></script>
<script
language=
"javascript"
src=
"js/jscrypto/jsbn2.js"
></script>
<script
language=
"javascript"
src=
"js/jscrypto/jsbn2.js"
></script>
<script
language=
"javascript"
src=
"js/jscrypto/sjcl.js"
></script>
<script
language=
"javascript"
src=
"js/jscrypto/sjcl.js"
></script>
...
@@ -364,14 +366,6 @@ BOOTH.nojava = function() {
...
@@ -364,14 +366,6 @@ BOOTH.nojava = function() {
// because navigator.javaEnabled() still returns true.
// because navigator.javaEnabled() still returns true.
// $('#election_div').hide();
// $('#election_div').hide();
// $('#error_div').show();
// $('#error_div').show();
/* var script = document.createElement('script');
script.type = 'text/javascript';
script.src = JSCRYPTO_HOME + '/bigint.dummy.js';
document.getElementsByTagName('head')[0].appendChild(script);
// FIXME: this is a bit unfortunate, can we have a trigger
// for loading this new script?
setTimeout("BigInt.setup(BOOTH.so_lets_go)", 2000); */
USE_SJCL
=
true
;
USE_SJCL
=
true
;
sjcl
.
random
.
startCollectors
();
sjcl
.
random
.
startCollectors
();
BigInt
.
setup
(
BOOTH
.
so_lets_go
);
BigInt
.
setup
(
BOOTH
.
so_lets_go
);
...
@@ -390,6 +384,10 @@ $(document).ready(function() {
...
@@ -390,6 +384,10 @@ $(document).ready(function() {
// we do in the browser only if it's asynchronous
// we do in the browser only if it's asynchronous
BigInt
.
in_browser
=
!
BOOTH
.
synchronous
;
BigInt
.
in_browser
=
!
BOOTH
.
synchronous
;
// set up dummy bigint for fast parsing and serialization
if
(
!
BigInt
.
in_browser
)
BigInt
=
BigIntDummy
;
BigInt
.
setup
(
BOOTH
.
so_lets_go
,
BOOTH
.
nojava
);
BigInt
.
setup
(
BOOTH
.
so_lets_go
,
BOOTH
.
nojava
);
});
});
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment