viff

changeset 706:b78b8bd4c91a

Add viff.prss to the new documentation.
author Martin Geisler <mg@daimi.au.dk>
date Tue, 22 Apr 2008 13:33:39 +0200
parents d2fd45609a54
children a68d36c5cce5
files doc/implementation.txt doc/prss.txt viff/prss.py
diffstat 3 files changed, 30 insertions(+), 16 deletions(-) [+]
line diff
     1.1 --- a/doc/implementation.txt	Tue Apr 22 12:58:29 2008 +0200
     1.2 +++ b/doc/implementation.txt	Tue Apr 22 13:33:39 2008 +0200
     1.3 @@ -9,3 +9,4 @@
     1.4     field
     1.5     shamir
     1.6     matrix
     1.7 +   prss
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/doc/prss.txt	Tue Apr 22 13:33:39 2008 +0200
     2.3 @@ -0,0 +1,12 @@
     2.4 +
     2.5 +PRSS Module
     2.6 +===========
     2.7 +
     2.8 +.. automodule:: viff.prss
     2.9 +
    2.10 +   .. autoclass:: PRF
    2.11 +      :members: __call__
    2.12 +
    2.13 +   .. autofunction:: prss
    2.14 +
    2.15 +   .. autofunction:: generate_subsets
     3.1 --- a/viff/prss.py	Tue Apr 22 12:58:29 2008 +0200
     3.2 +++ b/viff/prss.py	Tue Apr 22 13:33:39 2008 +0200
     3.3 @@ -19,27 +19,32 @@
     3.4  
     3.5  u"""Methods for pseudo-random secret sharing.
     3.6  
     3.7 -Normal Shamir sharing (see the L{shamir} module) requires secure
     3.8 -channels between the players for distributing shares. With
     3.9 +Normal Shamir sharing (see the :mod`viff.shamir` module) requires
    3.10 +secure channels between the players for distributing shares. With
    3.11  pseudo-random secret sharing one can share a secret using a single
    3.12  broadcast instead.
    3.13  
    3.14  PRSS relies on each player having access to a set of previously
    3.15  distributed pseudo-random functions (PRFs) --- or rather the seeds for
    3.16  such functions. In VIFF, such seeds are generated by the
    3.17 -L{config.generate_configs} function and the L{config.Player.prfs} and
    3.18 -L{config.Player.dealer_prfs} methods give access to the PRFs.
    3.19 +:func:`generate_configs <viff.config.generate_configs>` function and
    3.20 +the :meth:`Player.prfs <viff.config.Player.prfs>` and
    3.21 +:meth:`Player.dealer_prfs <config.Player.dealer_prfs>` methods give
    3.22 +access to the PRFs.
    3.23  
    3.24 -In this module the function L{prss} is used to calculate shares for a
    3.25 -pseudo-random number. The L{generate_subsets} is a general utility
    3.26 -method for generating subsets of a specific size.
    3.27 +In this module the function :func:`prss` is used to calculate shares
    3.28 +for a pseudo-random number. The :func:`generate_subsets` function is a
    3.29 +general utility for generating subsets of a specific size.
    3.30  
    3.31  The code is based on the paper "Share Conversion, Pseudorandom
    3.32  Secret-Sharing and Applications to Secure Computation" by Ronald
    3.33  Cramer, Ivan Damgård, and Yuval Ishai in Proc. of TCC 2005, LNCS 3378.
    3.34 -U{Download <http://www.cs.technion.ac.il/~yuvali/pubs/CDI05.ps>}.
    3.35 +`Download <http://www.cs.technion.ac.il/~yuvali/pubs/CDI05.ps>`__.
    3.36  """
    3.37  
    3.38 +__docformat__ = "restructuredtext"
    3.39 +
    3.40 +
    3.41  import sha
    3.42  from math import ceil
    3.43  from struct import pack
    3.44 @@ -53,8 +58,9 @@
    3.45  def prss(n, j, field, prfs, key):
    3.46      """Return a pseudo-random secret share for a random number.
    3.47  
    3.48 -    The share is for player j based on the pseudo-random functions
    3.49 -    given. The key is used when evaluating the PRFs.
    3.50 +    The share is for player *j* based on the pseudo-random functions
    3.51 +    given in *prfs* (a mapping from subsets of players to :class:`PRF`
    3.52 +    instances). The *key* is used when evaluating the PRFs.
    3.53  
    3.54      An example with (n,t) = (3,1) and a modulus of 31:
    3.55  
    3.56 @@ -71,12 +77,7 @@
    3.57      {18}
    3.58  
    3.59      We see that the sharing is consistent because each subset of two
    3.60 -    players will recombine their shares to {29}.
    3.61 -
    3.62 -    @param n: number of players.
    3.63 -    @param j: id of dealing player.
    3.64 -    @param field: field to use.
    3.65 -    @param prfs: mapping from subsets of players to L{PRF} instances.
    3.66 +    players will recombine their shares to ``{29}``.
    3.67      """
    3.68      result = 0
    3.69      all = frozenset(range(1, n+1))