viff

changeset 1106:ab726c059750

More pyflakes "fixes".
author Martin Geisler <mg@daimi.au.dk>
date Fri, 20 Feb 2009 10:20:34 +0100
parents 1d5f01ddd720
children 88ac6ac5fe70 febb63e773e4
files apps/benchmark.py viff/test/test_util.py
diffstat 2 files changed, 11 insertions(+), 12 deletions(-) [+]
line diff
     1.1 --- a/apps/benchmark.py	Fri Feb 20 10:00:48 2009 +0100
     1.2 +++ b/apps/benchmark.py	Fri Feb 20 10:20:34 2009 +0100
     1.3 @@ -140,9 +140,11 @@
     1.4  
     1.5  if options.fake:
     1.6      print "Using fake field elements"
     1.7 -    GF = FakeGF
     1.8 +    Field = FakeGF
     1.9 +else:
    1.10 +    Field = GF
    1.11  
    1.12 -Zp = GF(find_prime(options.modulus))
    1.13 +Zp = Field(find_prime(options.modulus))
    1.14  print "Using field elements (%d bit modulus)" % log(Zp.modulus, 2)
    1.15  
    1.16  count = options.count
     2.1 --- a/viff/test/test_util.py	Fri Feb 20 10:00:48 2009 +0100
     2.2 +++ b/viff/test/test_util.py	Fri Feb 20 10:20:34 2009 +0100
     2.3 @@ -21,8 +21,7 @@
     2.4  
     2.5  from viff.util import deep_wait
     2.6  from viff.field import GF, GF256
     2.7 -import viff.shamir
     2.8 -import viff.prss
     2.9 +from viff import shamir, prss
    2.10  
    2.11  from twisted.trial.unittest import TestCase
    2.12  from twisted.internet.defer import Deferred
    2.13 @@ -36,7 +35,7 @@
    2.14  
    2.15      # Modules which will be reloaded with and without VIFF_FAKE set in
    2.16      # the environment.
    2.17 -    _modules = [viff.shamir, viff.prss]
    2.18 +    _modules = [shamir, prss]
    2.19  
    2.20      def setUp(self):
    2.21          self.field = GF(1031)
    2.22 @@ -51,29 +50,27 @@
    2.23              reload(module)
    2.24  
    2.25      def test_shamir_share(self):
    2.26 -        from viff.shamir import share
    2.27          secret = self.field(17)
    2.28 -        shares = share(secret, 1, 3)
    2.29 +        shares = shamir.share(secret, 1, 3)
    2.30          self.assertEquals(shares[0][1], secret)
    2.31          self.assertEquals(shares[1][1], secret)
    2.32          self.assertEquals(shares[2][1], secret)
    2.33  
    2.34      def test_shamir_recombine(self):
    2.35 -        from viff.shamir import recombine
    2.36          shares = [(1, 1), None, None]
    2.37 -        self.assertEquals(recombine(shares), 1)
    2.38 +        self.assertEquals(shamir.recombine(shares), 1)
    2.39  
    2.40      def test_prss(self):
    2.41 -        share = viff.prss.prss(None, None, self.field, None, None)
    2.42 +        share = prss.prss(None, None, self.field, None, None)
    2.43          self.assertEquals(share, self.field(7))
    2.44  
    2.45      def test_prss_lsb(self):
    2.46 -        (share, bit) = viff.prss.prss_lsb(None, None, self.field, None, None)
    2.47 +        (share, bit) = prss.prss_lsb(None, None, self.field, None, None)
    2.48          self.assertEquals(share, self.field(7))
    2.49          self.assertEquals(bit, GF256(1))
    2.50  
    2.51      def test_prss_zero(self):
    2.52 -        share = viff.prss.prss_zero(None, None, None, self.field, None, None)
    2.53 +        share = prss.prss_zero(None, None, None, self.field, None, None)
    2.54          self.assertEquals(share, self.field(0))
    2.55  
    2.56