コード例 #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()
コード例 #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())