Instantly share code, notes, and snippets.

David Ruescasruescasd

• Sort options
Created Sep 15, 2017
View gist:5a4f473979d75a61173b9bfb266e0a49
 // 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);
Created Sep 11, 2017
View election2.pl
 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],
Created Sep 6, 2017
View election1
 # 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]
Created Sep 5, 2017
View weighted.hrep.latte
 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
Last active Aug 24, 2017
View ElectoralMethods.scala
 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)
Created Jan 27, 2017
View gist:f22a8b0c6ffc559213b97abcff861d8c
 /* * * 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.
Created Jan 27, 2017
View gist:b8b38f25f07cfdf7c1a4ef8a1b16b5b8
 play.ws.ssl { trustManager = { stores = [ { type = "PEM", path = "server.crt" } ] } keyManager = { stores = [ { type="PKCS12", path="client.p12", password="client" } ]
Created Jan 27, 2017
View gist:b49e869548d1f7c8731797d37702bce6
 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
Created Oct 15, 2016
View E.scala
 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})" }
Last active Oct 10, 2016
View bb_orchestrator_machine
 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)
You can’t perform that action at this time.