async def test_degree_reduction_share(galois_field, test_runner):
    n, t = 7, 2
    pp_elements = PreProcessedElements()
    x_expected = galois_field.random().value
    sid_x_2t = pp_elements.generate_share(n, 2 * t, x_expected)

    async def _prog(context):
        sh_x_2t = context.preproc.get_share(context, sid_x_2t, 2 * t)
        x_actual = await (await DoubleSharingMultiply.reduce_degree_share(
            context, sh_x_2t)).open()
        assert x_expected == x_actual

    await run_test_program(_prog, test_runner, n, t)
Exemplo n.º 2
0
async def test_get_share():
    n, t = 4, 1
    x = 41
    pp_elements = PreProcessedElements()
    sid = pp_elements.generate_share(n, t, x)

    async def _prog(ctx):
        x_sh = ctx.preproc.get_share(ctx, sid)
        assert await x_sh.open() == x

    program_runner = TaskProgramRunner(n, t)
    program_runner.add(_prog)
    await program_runner.join()