viff

changeset 1135:c47c7f119808

Use finish() only to print benchmark results.
author Marcel Keller <mkeller@cs.au.dk>
date Tue, 17 Feb 2009 10:55:15 +0100
parents 56d259ed2a3d
children 72b7a0717627
files viff/aes.py
diffstat 1 files changed, 9 insertions(+), 9 deletions(-) [+]
line diff
     1.1 --- a/viff/aes.py	Mon Feb 16 19:32:31 2009 +0100
     1.2 +++ b/viff/aes.py	Tue Feb 17 10:55:15 2009 +0100
     1.3 @@ -21,6 +21,7 @@
     1.4  
     1.5  
     1.6  import time
     1.7 +import operator
     1.8  
     1.9  from viff.field import GF256
    1.10  from viff.runtime import Share
    1.11 @@ -350,21 +351,20 @@
    1.12  
    1.13              get_last(state).addCallback(progress, self.rounds, time.time())
    1.14  
    1.15 -            get_trigger(state).addCallback(finish, state)
    1.16 +            if (benchmark):
    1.17 +                get_trigger(state).addCallback(finish, state)
    1.18 +
    1.19 +            # connect to final result
    1.20 +            for a, b in zip(reduce(operator.add, zip(*state)), result):
    1.21 +                a.addCallback(b.callback)
    1.22  
    1.23              prep_progress(self.rounds, start_round)
    1.24  
    1.25              return _
    1.26  
    1.27          def finish(_, state):
    1.28 -            actual_result = [byte for word in zip(*state) for byte in word]
    1.29 -
    1.30 -            for a, b in zip(actual_result, result):
    1.31 -                a.addCallback(b.callback)
    1.32 -
    1.33 -            if (benchmark):
    1.34 -                print "Total preparation time: %f" % preparation
    1.35 -                print "Total communication time: %f" % communication
    1.36 +            print "Total preparation time: %f" % preparation
    1.37 +            print "Total communication time: %f" % communication
    1.38  
    1.39              return _
    1.40