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 wrap: on
line diff
--- a/doc/implementation.txt	Tue Apr 22 12:58:29 2008 +0200
+++ b/doc/implementation.txt	Tue Apr 22 13:33:39 2008 +0200
@@ -9,3 +9,4 @@
    field
    shamir
    matrix
+   prss
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/doc/prss.txt	Tue Apr 22 13:33:39 2008 +0200
@@ -0,0 +1,12 @@
+
+PRSS Module
+===========
+
+.. automodule:: viff.prss
+
+   .. autoclass:: PRF
+      :members: __call__
+
+   .. autofunction:: prss
+
+   .. autofunction:: generate_subsets
--- a/viff/prss.py	Tue Apr 22 12:58:29 2008 +0200
+++ b/viff/prss.py	Tue Apr 22 13:33:39 2008 +0200
@@ -19,27 +19,32 @@
 
 u"""Methods for pseudo-random secret sharing.
 
-Normal Shamir sharing (see the L{shamir} module) requires secure
-channels between the players for distributing shares. With
+Normal Shamir sharing (see the :mod`viff.shamir` module) requires
+secure channels between the players for distributing shares. With
 pseudo-random secret sharing one can share a secret using a single
 broadcast instead.
 
 PRSS relies on each player having access to a set of previously
 distributed pseudo-random functions (PRFs) --- or rather the seeds for
 such functions. In VIFF, such seeds are generated by the
-L{config.generate_configs} function and the L{config.Player.prfs} and
-L{config.Player.dealer_prfs} methods give access to the PRFs.
+:func:`generate_configs <viff.config.generate_configs>` function and
+the :meth:`Player.prfs <viff.config.Player.prfs>` and
+:meth:`Player.dealer_prfs <config.Player.dealer_prfs>` methods give
+access to the PRFs.
 
-In this module the function L{prss} is used to calculate shares for a
-pseudo-random number. The L{generate_subsets} is a general utility
-method for generating subsets of a specific size.
+In this module the function :func:`prss` is used to calculate shares
+for a pseudo-random number. The :func:`generate_subsets` function is a
+general utility for generating subsets of a specific size.
 
 The code is based on the paper "Share Conversion, Pseudorandom
 Secret-Sharing and Applications to Secure Computation" by Ronald
 Cramer, Ivan Damgård, and Yuval Ishai in Proc. of TCC 2005, LNCS 3378.
-U{Download <http://www.cs.technion.ac.il/~yuvali/pubs/CDI05.ps>}.
+`Download <http://www.cs.technion.ac.il/~yuvali/pubs/CDI05.ps>`__.
 """
 
+__docformat__ = "restructuredtext"
+
+
 import sha
 from math import ceil
 from struct import pack
@@ -53,8 +58,9 @@
 def prss(n, j, field, prfs, key):
     """Return a pseudo-random secret share for a random number.
 
-    The share is for player j based on the pseudo-random functions
-    given. The key is used when evaluating the PRFs.
+    The share is for player *j* based on the pseudo-random functions
+    given in *prfs* (a mapping from subsets of players to :class:`PRF`
+    instances). The *key* is used when evaluating the PRFs.
 
     An example with (n,t) = (3,1) and a modulus of 31:
 
@@ -71,12 +77,7 @@
     {18}
 
     We see that the sharing is consistent because each subset of two
-    players will recombine their shares to {29}.
-
-    @param n: number of players.
-    @param j: id of dealing player.
-    @param field: field to use.
-    @param prfs: mapping from subsets of players to L{PRF} instances.
+    players will recombine their shares to ``{29}``.
     """
     result = 0
     all = frozenset(range(1, n+1))