viff

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 diff
     1.1 --- a/viff/aes.py	Fri Oct 16 23:55:06 2009 +0200
     1.2 +++ b/viff/aes.py	Sat Oct 17 00:27:15 2009 +0200
     1.3 @@ -39,8 +39,7 @@
     1.4      if use_lin_comb:
     1.5          r = share.runtime.lin_comb([2 ** i for i in range(8)], r_bits)
     1.6      else:
     1.7 -        r = reduce(lambda x,y: x + y,
     1.8 -                   [r_bits[i] * 2 ** i for i in range(8)])
     1.9 +        r = sum([r_bits[i] * 2 ** i for i in range(8)])
    1.10  
    1.11      c = share.runtime.open(share + r)
    1.12      c_bits = [Share(share.runtime, GF256) for i in range(8)]
    1.13 @@ -256,8 +255,7 @@
    1.14                      # caution: order is lsb first
    1.15                      vector = AES.A * Matrix(zip(bits))
    1.16                      bits = zip(*vector.rows)[0]
    1.17 -                    row[i] = reduce(lambda x,y: x + y,
    1.18 -                                    [bits[j] * 2**j for j in range(len(bits))])
    1.19 +                    row[i] = sum([bits[j] * 2**j for j in range(len(bits))])
    1.20  
    1.21      def shift_row(self, state):
    1.22          """Rijndael ShiftRow.