Skip to content

Commit

Permalink
docs: updated documentation on ballot encoding
Browse files Browse the repository at this point in the history
  • Loading branch information
PascalinDe committed Jun 25, 2024
1 parent c122b11 commit e0003ec
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions docs/ballot_encoding.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ The answers to questions are encoded in the following way, with one question per
TYPE = "select"|"text"|"rank"
SEP = ":"
ID = 3 bytes, encoded in base64
ID = 8 bytes UUID encoded in base64 = 12 bytes
ANSWERS = <answer>[","<answer>]*
ANSWER = <select_answer>|<text_answer>|<rank_answer>
SELECT_ANSWER = "0"|"1"
Expand All @@ -39,11 +39,11 @@ For the following questions :
A possible encoding of an answer would be (by string concatenation):

```
"select:3fb2:0,0,0,1,0\n" +
"select:base64(D0Da4H6o):0,0,0,1,0\n" +
"rank:19c7:0,1,2\n" +
"rank:base64(19c7cd13):0,1,2\n" +
"text:cd13:base64("Noémien"),base64("Pierluca")\n"
"text:base64(wSfBs25a):base64("Noémien"),base64("Pierluca")\n"
```

## Size of the ballot
Expand All @@ -53,15 +53,15 @@ voting process, it is important that all encrypted ballots have the same size. T
the form has an attribute called "BallotSize" which is the size
that all ballots should have before they're encrypted. Smaller ballots should therefore be
padded in order to reach this size. To denote the end of the ballot and the start of the padding,
we use an empty line (\n\n). For a ballot size of 117, our ballot from the previous example
we use an empty line (\n\n). For a ballot size of 144, our ballot from the previous example
would then become:

```
"select:3fb2:0,0,0,1,0\n" +
"select:base64(D0Da4H6o):0,0,0,1,0\n" +
"rank:19c7:0,1,2\n" +
"rank:base64(19c7cd13):0,1,2\n" +
"text:cd13:base64("Noémien"),base64("Pierluca")\n\n" +
"text:base64(wSfBs25a):base64("Noémien"),base64("Pierluca")\n\n" +
"ndtTx5uxmvnllH1T7NgLORuUWbN"
```
Expand All @@ -70,4 +70,4 @@ would then become:

The encoded ballot must then be divided into chunks of 29 or less bytes since the maximum size supported by the kyber library for the encryption is of 29 bytes.

For the previous example we would then have 5 chunks, the first 4 would contain 29 bytes, while the last chunk would contain a single byte.
For the previous example we would then have 5 chunks, the first 4 would contain 29 bytes, while the last chunk would contain 28 bytes.

0 comments on commit e0003ec

Please sign in to comment.