viff

changeset 857:f89875736767

Added prss_share_zero method to the Runtime class.
author Martin Geisler <mg@daimi.au.dk>
date Wed, 30 Jul 2008 22:12:45 +0200
parents c2c1fcdd710c
children 2d2c641a2762
files viff/runtime.py
diffstat 1 files changed, 14 insertions(+), 1 deletions(-) [+]
line diff
     1.1 --- a/viff/runtime.py	Wed Jul 30 22:04:15 2008 +0200
     1.2 +++ b/viff/runtime.py	Wed Jul 30 22:12:45 2008 +0200
     1.3 @@ -40,7 +40,7 @@
     1.4  from collections import deque
     1.5  
     1.6  from viff import shamir
     1.7 -from viff.prss import prss, prss_lsb
     1.8 +from viff.prss import prss, prss_lsb, prss_zero
     1.9  from viff.field import GF256, FieldElement
    1.10  from viff.matrix import Matrix, hyper
    1.11  from viff.util import wrapper, rand
    1.12 @@ -923,6 +923,19 @@
    1.13          return result
    1.14  
    1.15      @increment_pc
    1.16 +    def prss_share_zero(self, field):
    1.17 +        """Generate shares of the zero element from the field given.
    1.18 +
    1.19 +        Communication cost: none.
    1.20 +        """
    1.21 +        # Key used for PRSS.
    1.22 +        prss_key = tuple(self.program_counter)
    1.23 +        prfs = self.players[self.id].prfs(field.modulus)
    1.24 +        zero_share = prss_zero(self.num_players, self.threshold, self.id,
    1.25 +                               field, prfs, prss_key)
    1.26 +        return Share(self, field, zero_share)
    1.27 +
    1.28 +    @increment_pc
    1.29      def prss_share_bit_double(self, field):
    1.30          """Share a random bit over *field* and GF256.
    1.31