# Re: [viff-devel] [PATCH 03 of 12] Implementation of the open command

```Janus Dam Nielsen <janus.niel...@alexandra.dk> writes:

> +    @increment_pc
> +    def open(self, share, receivers=None, threshold=None):
> +        """Share reconstruction.
> +
> +        Every parti broadcasts a share pair (x_{i}^{'}, rho_{x,i}^{'}).```
```
Typo: "parti" -> "party". Also, the prime (') should not be put as a
superscript in LaTeX.

> +
> +        The parties compute the sums x^{'}, rho_{x}^{'} and
> +        check Com_{ck}(x^{'},rho_{x}^{'} = C_{x}.
> +
> +        If yes, output x = x^{'}, else output x = _|_.

Heh, I though it was only in Haskell that they write the bottom symbol
like that... :-) You really mean "else return :const:`None`", right?

> +        """
> +        assert isinstance(share, Share)
> +        # all players receive result by default
> +        if receivers is None:
> +        assert threshold is None
> +        threshold = self.num_players - 1
> +
> +        def recombine_value(shares, Cx):
> +            x = share.field(0)
> +            rho1 = share.field(0)
> +            rho2 = share.field(0)

Due to automagic coercion you can actually initialize the values to 0.

> +            for xi, (rhoi1, rhoi2), c in shares:
> +                x += xi
> +                rho1 += rhoi1
> +                rho2 += rhoi2
> +                assert c is None, "A commitment is found."
> +            return self.check_commitment(x, (rho1, rho2), Cx)

--
Martin Geisler

VIFF (Virtual Ideal Functionality Framework) brings easy and efficient
SMPC (Secure Multiparty Computation) to Python. See: http://viff.dk/.
```

pgpP8XozoAFcu.pgp
Description: PGP signature

```_______________________________________________
viff-devel mailing list (http://viff.dk/)
viff-devel@viff.dk
http://lists.viff.dk/listinfo.cgi/viff-devel-viff.dk
```