changeset 840:f7e987afbec3

Added prss_share_random method. This works by letting everybody pick a random number from their private PRF. This is used as their share -- the sum will be random and unknown to both parties.
author Martin Geisler <mg@daimi.au.dk>
date Sun, 29 Jun 2008 13:59:30 +0200
parents 45dfc10a1363
children 3f01e81fcc1a
files viff/paillier.py
diffstat 1 files changed, 9 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/viff/paillier.py	Tue Jul 15 23:11:44 2008 +0200
+++ b/viff/paillier.py	Sun Jun 29 13:59:30 2008 +0200
@@ -66,6 +66,15 @@
             self.peer = player
 
     @increment_pc
+    def prss_share_random(self, field):
+        """Generate a share of a uniformly random element."""
+        prfs = self.players[self.id].prfs(field.modulus)
+        # There can only be one PRF in the dictionary.
+        prf = prfs.values()[0]
+        share = field(prf(tuple(self.program_counter)))
+        return Share(self, field, share)
+
+    @increment_pc
     def share(self, inputters, field, number=None):
         """Share *number* additively."""
         assert number is None or self.id in inputters