Example circuits
Warning
Some of these example circuits are untested and may be incorrect.
circuits
¶
This package contains example circuits and tools for generating them.
aes
¶
This module implements a high-level AES encryption circuit for a constant key.
cardio
¶
This module implements the cardio circuit that is often used in benchmarking compilers, see: https://arxiv.org/abs/2101.07078.
construct_cardio_risk_circuit(gf)
¶
Returns the cardio circuit from https://arxiv.org/abs/2101.07078.
construct_cardio_elevated_risk_circuit(gf)
¶
Returns a variant of the cardio circuit that returns a Boolean indicating whether any risk factor returned true.
test_cardio_p101()
¶
median
¶
mimc
¶
MIMC is an MPC-friendly cipher: https://eprint.iacr.org/2016/492.
sorting
¶
This module contains sorting circuits and comparators.
gf = GF(13)
module-attribute
¶
circuit = gen_naive_sort_circuit(range(2), gf)
module-attribute
¶
cswp(lhs, rhs)
¶
Conditionally swap inputs lhs
and rhs
such that lhs <= rhs
.
Returns:
-
Tuple[Node, Node]
–A tuple representing (lower, higher)
gen_naive_sort_circuit(inputs, gf)
¶
Returns a naive sorting circuit for the given sequence of inputs
.
veto_voting
¶
The veto voting circuit is the inverse of a consensus vote between a number of participants.
The circuit is essentially a large OR operation, returning 1 if any participant vetoes (by submitting a 1). This represents a vote that anyone can veto.