viff

changeset 1219:8a5eb6550111

Constants used in communication is refactored to a new file.
author Janus Dam Nielsen <janus.nielsen@alexandra.dk>
date Tue, 06 Oct 2009 10:04:36 +0200
parents c43b0e520aba
children 5a815629d825
files viff/active.py viff/constants.py viff/paillier.py viff/runtime.py viff/test/test_runtime.py
diffstat 5 files changed, 32 insertions(+), 10 deletions(-) [+]
line diff
     1.1 --- a/viff/active.py	Tue Oct 06 10:04:20 2009 +0200
     1.2 +++ b/viff/active.py	Tue Oct 06 10:04:36 2009 +0200
     1.3 @@ -28,7 +28,7 @@
     1.4  from viff.matrix import Matrix, hyper
     1.5  from viff.passive import PassiveRuntime
     1.6  from viff.runtime import Share, preprocess, gather_shares
     1.7 -from viff.runtime import ECHO, READY, SEND
     1.8 +from viff.constants import ECHO, READY, SEND
     1.9  
    1.10  
    1.11  class BrachaBroadcastMixin:
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/viff/constants.py	Tue Oct 06 10:04:36 2009 +0200
     2.3 @@ -0,0 +1,27 @@
     2.4 +# -*- coding: utf-8 -*-
     2.5 +#
     2.6 +# Copyright 2009 VIFF Development Team.
     2.7 +#
     2.8 +# This file is part of VIFF, the Virtual Ideal Functionality Framework.
     2.9 +#
    2.10 +# VIFF is free software: you can redistribute it and/or modify it
    2.11 +# under the terms of the GNU Lesser General Public License (LGPL) as
    2.12 +# published by the Free Software Foundation, either version 3 of the
    2.13 +# License, or (at your option) any later version.
    2.14 +#
    2.15 +# VIFF is distributed in the hope that it will be useful, but WITHOUT
    2.16 +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
    2.17 +# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
    2.18 +# Public License for more details.
    2.19 +#
    2.20 +# You should have received a copy of the GNU Lesser General Public
    2.21 +# License along with VIFF. If not, see <http://www.gnu.org/licenses/>.
    2.22 +
    2.23 +__docformat__ = "restructuredtext"
    2.24 +
    2.25 +# Constants used for communication.
    2.26 +SHARE    = 0
    2.27 +ECHO     = 1
    2.28 +READY    = 2
    2.29 +SEND     = 3
    2.30 +PAILLIER = 4
     3.1 --- a/viff/paillier.py	Tue Oct 06 10:04:20 2009 +0200
     3.2 +++ b/viff/paillier.py	Tue Oct 06 10:04:36 2009 +0200
     3.3 @@ -28,7 +28,7 @@
     3.4  import gmpy
     3.5  
     3.6  from viff.runtime import Runtime, Share, gather_shares
     3.7 -from viff.runtime import PAILLIER
     3.8 +from viff.constants import PAILLIER
     3.9  from viff.util import rand, find_random_prime
    3.10  
    3.11  def L(u, n):
     4.1 --- a/viff/runtime.py	Tue Oct 06 10:04:20 2009 +0200
     4.2 +++ b/viff/runtime.py	Tue Oct 06 10:04:36 2009 +0200
     4.3 @@ -41,6 +41,7 @@
     4.4  
     4.5  from viff.field import GF256, FieldElement
     4.6  from viff.util import wrapper, rand, deep_wait, track_memory_usage, begin, end
     4.7 +from viff.constants import SHARE
     4.8  import viff.reactor
     4.9  
    4.10  from twisted.internet import reactor
    4.11 @@ -51,13 +52,6 @@
    4.12  from twisted.internet.protocol import ReconnectingClientFactory, ServerFactory
    4.13  from twisted.protocols.basic import Int16StringReceiver
    4.14  
    4.15 -# Constants used by ShareExchanger.
    4.16 -SHARE    = 0
    4.17 -ECHO     = 1
    4.18 -READY    = 2
    4.19 -SEND     = 3
    4.20 -PAILLIER = 4
    4.21 -
    4.22  
    4.23  class Share(Deferred):
    4.24      """A shared number.
     5.1 --- a/viff/test/test_runtime.py	Tue Oct 06 10:04:20 2009 +0200
     5.2 +++ b/viff/test/test_runtime.py	Tue Oct 06 10:04:36 2009 +0200
     5.3 @@ -30,7 +30,8 @@
     5.4  from twisted.internet.defer import gatherResults, Deferred, DeferredList
     5.5  
     5.6  from viff.field import GF256
     5.7 -from viff.runtime import Share, SHARE
     5.8 +from viff.runtime import Share
     5.9 +from viff.constants import SHARE
    5.10  from viff.comparison import Toft05Runtime
    5.11  from viff.test.util import RuntimeTestCase, BinaryOperatorTestCase, protocol
    5.12