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
271d892e
Commit
271d892e
authored
Apr 22, 2013
by
Stephane Glondu
Browse files
Start compatibility layer
parent
e8c55296
Changes
5
Hide whitespace changes
Inline
Side-by-side
api.odocl
View file @
271d892e
Serializable_t
Crypto_sigs
Crypto
ElGamal
Serializable_t
Serializable_compat_t
Serializable_compat
src/lib.mllib
View file @
271d892e
StdExtra
Core_datatypes_j
Serializable_t
Serializable_j
Serializable_compat_t
Serializable_compat_j
Serializable_compat
Common
Crypto
ElGamal
src/serializable_compat.atd
View file @
271d892e
<doc text="Serializable datatypes (compatibility layer)">
(** {1 Core types} *)
type number <ocaml predef from="Core_datatypes"> = abstract
...
...
@@ -72,7 +74,7 @@ type 'a election = {
(** {1 Ballots} *)
type 'a choice = {
type 'a choice
<ocaml predef from="Serializable" t="ciphertext">
= {
alpha : 'a;
beta : 'a;
}
...
...
src/serializable_compat.ml
0 → 100644
View file @
271d892e
open
Serializable_compat_t
let
of_question
q
=
let
{
q_answers
;
q_min
;
q_max
;
q_question
;
_
}
=
q
in
let
q_max
=
match
q_max
with
|
Some
i
->
i
|
None
->
Array
.
length
q_answers
in
let
open
Serializable_t
in
{
q_answers
;
q_min
;
q_max
;
q_question
}
let
of_election
e
=
let
{
e_description
;
e_name
;
e_public_key
;
e_questions
;
e_uuid
;
e_short_name
;
_
}
=
e
in
let
e_public_key
=
e_public_key
.
y
in
let
e_questions
=
Array
.
map
of_question
e_questions
in
let
open
Serializable_t
in
{
e_description
;
e_name
;
e_public_key
;
e_questions
;
e_uuid
;
e_short_name
}
let
of_proof
p
=
let
{
dp_challenge
;
dp_response
;
_
}
=
p
in
let
open
Serializable_t
in
{
challenge
=
dp_challenge
;
response
=
dp_response
}
let
of_proofs
ps
=
Array
.
map
of_proof
ps
let
of_answer
a
=
let
{
choices
;
individual_proofs
;
overall_proof
}
=
a
in
let
individual_proofs
=
Array
.
map
of_proofs
individual_proofs
in
let
overall_proof
=
of_proofs
overall_proof
in
let
open
Serializable_t
in
{
choices
;
individual_proofs
;
overall_proof
}
let
of_ballot
b
=
let
{
answers
;
election_hash
;
election_uuid
}
=
b
in
let
answers
=
Array
.
map
of_answer
answers
in
let
open
Serializable_t
in
{
answers
;
election_hash
;
election_uuid
}
src/serializable_compat.mli
0 → 100644
View file @
271d892e
(** Compatibility layer with the Helios reference implementation *)
open
Serializable_compat_t
val
of_election
:
'
a
election
->
'
a
Serializable_t
.
election
val
of_ballot
:
'
a
ballot
->
'
a
Serializable_t
.
ballot
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