Skip to content

Instantly share code, notes, and snippets.

View ruescasd's full-sized avatar

David Ruescas ruescasd

  • Sequent
View GitHub Profile
[package]
name = "b3"
version = "0.1.0"
edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
rand = "0.7.3"
sha2 = "0.9.1"

Keybase proof

I hereby claim:

  • I am ruescasd on github.
  • I am czakalwe (https://keybase.io/czakalwe) on keybase.
  • I have a public key whose fingerprint is E2C2 47D4 54F9 DC7E 8AB1 2448 AE6A A7BC 726D A9FD

To claim this, I am signing this object:

// 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);
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],
# 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]
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
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)
/*
*
* 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.
play.ws.ssl {
trustManager = {
stores = [
{ type = "PEM", path = "server.crt" }
]
}
keyManager = {
stores = [
{ type="PKCS12", path="client.p12", password="client" }
]
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