Exemplo n.º 1
0
    def start_test_server(self, player_count):
        # choose circuit for the party that we test on
        c = BooleanCircuitReader()
        c.init_parsed_circuit("single_and.txt")
        circuit = c.get_circuit()

        # read config parameters
        test_setup = TestSetupLocalProcess(host='127.0.0.1',
                                           port='5001',
                                           id='1',
                                           player_count=player_count)

        # create shares memory (a list) between test tread and server tread for getting the result of the computaiton.
        multiprocessing_manager = Manager()
        self.result_arr = multiprocessing_manager.list()

        # choose strategies and start the server
        s = Server(setup=test_setup)
        client = Client()
        sharingStrategy = BooleanSharingStrategy()
        evaluationStrategy = BooleanEvaluationStrategy(client)
        config.ceps_speed = Ceps_Speed(circuit, sharingStrategy,
                                       evaluationStrategy)

        config.ceps = Ceps(Client().create_circuit(0), ShareByWireId())

        # start the server in a thread
        self.process = Process(target=s.start, args=[self.result_arr])
        self.process.start()
Exemplo n.º 2
0
 def boolean_circuit_setup(self):
     # choose circuit for the party that we test on
     circuit = ArithmeticCircuits().add_1_mult_2_3()
     # choose strategies
     sharingStrategy = BooleanSharingStrategy()
     evaluationStrategy = BooleanEvaluationStrategy(Client())
     config.ceps_speed = Ceps_Speed(circuit, sharingStrategy,
                                    evaluationStrategy)
     config.ceps = Ceps(Client().create_circuit(0), ShareByWireId())
Exemplo n.º 3
0
 def setup(self):
     player_count, my_player_id, players, all = self.create_player_dict()
     config.players = players
     config.host = "0.0.0.0"
     config.port = "80"
     config.id = my_player_id
     config.player_count = player_count
     config.all_players = all
     circuit = ArithmeticCircuits().add_1_mult_2_3()
     config.ceps_speed = Ceps_Speed(
         circuit=circuit,
         sharingStrategy=BooleanLayerSharingStrategy(),
         evaluationStrategy=BooleanLayerEvaluationStrategy(Client()))
     config.ceps = Ceps(circuit=Client().create_circuit(0),
                        sharingStrategy=ShareByWirePlayerId())
Exemplo n.º 4
0
 def setup(self):
     host, port, id, _ = self.get_host_info()
     player_count, players, all = self.create_player_dict(id)
     config.players = players
     config.host = host
     config.port = port
     config.id = id
     config.player_count = int(player_count)
     config.all_players = all
     circuit = ArithmeticCircuits().add_1_mult_2_3()
     config.ceps_speed = Ceps_Speed(
         circuit=circuit,
         sharingStrategy=BooleanLayerSharingStrategyByPlayerId(),
         evaluationStrategy=BooleanLayerEvaluationStrategy(Client()))
     config.ceps = Ceps(circuit=Client().create_circuit(0),
                        sharingStrategy=ShareWire())