viff

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 diff
     1.1 --- a/viff/paillier.py	Tue Jul 15 23:11:44 2008 +0200
     1.2 +++ b/viff/paillier.py	Sun Jun 29 13:59:30 2008 +0200
     1.3 @@ -66,6 +66,15 @@
     1.4              self.peer = player
     1.5  
     1.6      @increment_pc
     1.7 +    def prss_share_random(self, field):
     1.8 +        """Generate a share of a uniformly random element."""
     1.9 +        prfs = self.players[self.id].prfs(field.modulus)
    1.10 +        # There can only be one PRF in the dictionary.
    1.11 +        prf = prfs.values()[0]
    1.12 +        share = field(prf(tuple(self.program_counter)))
    1.13 +        return Share(self, field, share)
    1.14 +
    1.15 +    @increment_pc
    1.16      def share(self, inputters, field, number=None):
    1.17          """Share *number* additively."""
    1.18          assert number is None or self.id in inputters