This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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; | |
} else { | |
this.m = y.negate().mod(pk.p); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use application 'polytope'; | |
my $inequalities = [ | |
[2, -1, 0, 0, 0], | |
[6, 0, -1, 0, 0], | |
[6, 0, 0, -1, 0], | |
[10, 0, 0, 0, -1], | |
[0, 1, 0, 0, 0], | |
[0, 0, 1, 0, 0], | |
[0, 0, 0, 1, 0], |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# election two categories of voters: | |
# 20 voters with weight 1, 2 voters with weight 10 | |
# 10x + y = 20 | |
# x <= 2, y <= 20 | |
# three solution points: (2, 0), (1, 10), (0, 20) | |
# particular solution (origin): | |
# [0 20] | |
# basis | |
# [1 -10] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 5 | |
94 -17 -8 -4 -2 | |
# 96 -17 -10 -4 -2 | |
2 -1 0 0 0 | |
6 0 -1 0 0 | |
6 0 0 -1 0 | |
10 0 0 0 -1 | |
# m(v, c, r) | |
# linearity 2 1 2 | |
# Ar |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import scala.collection.SortedSet | |
trait Method { | |
// options to choose from | |
type Option | |
// a choice made on the ballot | |
type Choice | |
// a completed ballot | |
type Ballot | |
// the voting rule (algorithm) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* | |
* Copyright (c) 1994, 2004, Oracle and/or its affiliates. All rights reserved. | |
* | |
* Redistribution and use in source and binary forms, with or | |
* without modification, are permitted provided that the following | |
* conditions are met: | |
* | |
* -Redistribution of source code must retain the above copyright | |
* notice, this list of conditions and the following disclaimer. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
play.ws.ssl { | |
trustManager = { | |
stores = [ | |
{ type = "PEM", path = "server.crt" } | |
] | |
} | |
keyManager = { | |
stores = [ | |
{ type="PKCS12", path="client.p12", password="client" } | |
] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.File | |
import akka.actor.ActorSystem | |
import akka.stream.ActorMaterializer | |
import play.api.libs.ws.WSClient | |
import play.api.libs.ws.WSConfigParser | |
import scala.concurrent.Future | |
import scala.util.{Success, Failure} | |
import play.api.{Environment, Mode} | |
import play.api.Configuration |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
object E extends App { | |
println(E(args(0).toInt, 1)) | |
def E(vars: Int, minVar: Int) : String = { | |
if(vars == 1) { | |
"T" | |
} | |
else if(vars == 2) { | |
s"!(a$minVar && a${minVar + 1})" | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
machine bb_orchestrator_machine sees bb_orchestrator_context | |
variables config config_signatures shares shares_signatures public_key public_key_signatures | |
vote_started votes mixes mixes_signatures decryptions decryptions_signatures | |
plaintext plaintext_signatures process_end | |
invariants | |
@inv0 config ∈ BOOL @inv1 config_signatures ∈ ℙ(1 ‥ privacy_level) | |
@inv2 shares ∈ ℙ(1 ‥ privacy_level) @inv3 shares_signatures ∈ ℙ(1 ‥ privacy_level) | |
@inv4 public_key ∈ BOOL @inv5 public_key_signatures ∈ ℙ(1 ‥ privacy_level) |