viff
changeset 1536:4e36cad23bc1
Added doctest for shamir.recombine().
| author | Thomas P Jakobsen <tpj@cs.au.dk> |
|---|---|
| date | Wed Aug 11 11:04:19 2010 +0200 (18 months ago) |
| parents | b4451e4ac76d |
| children | 9c938858c46b |
| files | viff/shamir.py |
line diff
1.1 --- a/viff/shamir.py Tue Aug 10 16:03:54 2010 +0200 1.2 +++ b/viff/shamir.py Wed Aug 11 11:04:19 2010 +0200 1.3 @@ -96,6 +96,15 @@ 1.4 1.5 Shares is a list of *threshold* + 1 ``(player id, share)`` pairs. 1.6 Recombination is done in the optional point *x_recomb*. 1.7 + 1.8 + >>> from field import GF 1.9 + >>> Zp = GF(19) 1.10 + >>> shares = [(Zp(i), 7 * Zp(i) + 3) for i in range(1, 4)] 1.11 + >>> print shares 1.12 + [({1}, {10}), ({2}, {17}), ({3}, {5})] 1.13 + >>> del(shares[1]) 1.14 + >>> recombine(shares) 1.15 + {3} 1.16 """ 1.17 xs, ys = zip(*shares) 1.18 key = xs + (x_recomb, )
