This library is a programmatic interface in python to generate a circuit for the bigger and more useful SHEEP library.
The library has a few data types :
To create a circuit, the basic class to inherit is mini_mod
in
mathsheep.interactions
. To add more components, you can use
self.add(component)
inside the create
function as shown below.:
class oneb_adder(mini_mod):
def __init__(self, name, inputs, outputs, nb=None,
randomize_temps=1, carry=True):
mini_mod.__init__(self, name, inputs, outputs)
self.create(...)
def create(self, ...):
self.add(..)
Two types of components can be added.
Assignments (from matSHEEP.interactions
)
- mono_assign
- alias
- negate
- bi_assign
- xor
- and
- or
- constand
- tri_assign
- mux
Other mini_mods
There are a few predefined mini_mods. They can be found in
matSHEEP.reusable_modules
[cin x y]
input = (x, y)
input = (c,p)
matSHEEP.functions
matSHEEP.nn_layer
matSHEEP.vector_ops
cond
vector, a
plaintext tuple ass_types
containing only alias
and
negate
as values and an encrypted bit vector input
. It
outputs an encrypted bit vector where the ith position has
the ass_types[cond[idx]]
operation applied on
input[idx]
.You can also visualize the circuits you create. test.sheep
is a
circuit file.:
import sys
import matSHEEP.create_graph as cg
complete_node = cg.get_circuit_graph('./test.sheep')
ng = cg.networkx_graph(complete_node)
ng.draw()
And you can get
gFor more high level operations and results using layers of Neural Networks visit this markdown