changeset 1394:86d966f49a8a

Orlandi: Moved exponentiation out of loop.
author Janus Dam Nielsen <janus.nielsen@alexandra.dk>
date Thu, 12 Nov 2009 10:43:59 +0100
parents 36c8915d718a
children 3ede8d56ae64
files viff/orlandi.py
diffstat 1 files changed, 2 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/viff/orlandi.py	Thu Nov 12 10:43:57 2009 +0100
+++ b/viff/orlandi.py	Thu Nov 12 10:43:59 2009 +0100
@@ -1132,10 +1132,11 @@
 
                 # 3) the gammaij he received is equal to the gammaij
                 # he now computes based on the values he reveives
+                modulus_3 = field.modulus**3
                 for j in xrange(len(ais)):
                     dij = dijs[j]
                     # 5) ... and dij < p^3.
-                    if dij >= (field.modulus**3):
+                    if dij >= (modulus_3):
                         raise OrlandiException("Inconsistent random value dij %i from player %i" % (dij, j + 1))
                     # gamma_ij = alpha_i^b_j Enc_ek_i(1;1)^d_ij
                     gammaij = tripple(alphas[self.id - 1], bis[j][0].value,