viff

changeset 1031:85aad12606fb

New common input method for runtimes. The idea is that all runtimes should provide a method called "input". High-level code should call this method to provide input to the ideal functionality implemented by the runtime.
author Martin Geisler <mg@daimi.au.dk>
date Sun, 30 Nov 2008 17:31:02 +0100
parents b4f94a0d9a76
children 62fca9b7b777
files viff/paillier.py viff/passive.py
diffstat 2 files changed, 14 insertions(+), 0 deletions(-) [+]
line diff
     1.1 --- a/viff/paillier.py	Fri Nov 28 10:20:55 2008 +0100
     1.2 +++ b/viff/paillier.py	Sun Nov 30 17:31:02 2008 +0100
     1.3 @@ -83,6 +83,13 @@
     1.4          share = field(prf(tuple(self.program_counter)))
     1.5          return Share(self, field, share)
     1.6  
     1.7 +    def input(self, inputters, field, number=None):
     1.8 +        """Input *number* to the computation.
     1.9 +
    1.10 +        The input is shared using the :meth:`share` method.
    1.11 +        """
    1.12 +        return self.share(inputters, field, number)
    1.13 +
    1.14      @increment_pc
    1.15      def share(self, inputters, field, number=None):
    1.16          """Share *number* additively."""
     2.1 --- a/viff/passive.py	Fri Nov 28 10:20:55 2008 +0100
     2.2 +++ b/viff/passive.py	Sun Nov 30 17:31:02 2008 +0100
     2.3 @@ -379,6 +379,13 @@
     2.4          # Use r_lsb to flip b as needed.
     2.5          return (b_p, b ^ r_lsb)
     2.6  
     2.7 +    def input(self, inputters, field, number=None, threshold=None):
     2.8 +        """Input *number* to the computation.
     2.9 +
    2.10 +        The input is shared using the :meth:`shamir_share` method.
    2.11 +        """
    2.12 +        return self.shamir_share(inputters, field, number, threshold)
    2.13 +
    2.14      @increment_pc
    2.15      def shamir_share(self, inputters, field, number=None, threshold=None):
    2.16          """Secret share *number* over *field* using Shamir's method.