changeset 1301:c44e2e1a9279

aes: use built-in sum function
author Martin Geisler <mg@cs.au.dk>
date Sat, 17 Oct 2009 00:27:15 +0200
parents c03b8fbef478
children 7fd61e465bc6
files viff/aes.py
diffstat 1 files changed, 2 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/viff/aes.py	Fri Oct 16 23:55:06 2009 +0200
+++ b/viff/aes.py	Sat Oct 17 00:27:15 2009 +0200
@@ -39,8 +39,7 @@
     if use_lin_comb:
         r = share.runtime.lin_comb([2 ** i for i in range(8)], r_bits)
     else:
-        r = reduce(lambda x,y: x + y,
-                   [r_bits[i] * 2 ** i for i in range(8)])
+        r = sum([r_bits[i] * 2 ** i for i in range(8)])
 
     c = share.runtime.open(share + r)
     c_bits = [Share(share.runtime, GF256) for i in range(8)]
@@ -256,8 +255,7 @@
                     # caution: order is lsb first
                     vector = AES.A * Matrix(zip(bits))
                     bits = zip(*vector.rows)[0]
-                    row[i] = reduce(lambda x,y: x + y,
-                                    [bits[j] * 2**j for j in range(len(bits))])
+                    row[i] = sum([bits[j] * 2**j for j in range(len(bits))])
 
     def shift_row(self, state):
         """Rijndael ShiftRow.