viff

changeset 1085:29d85ec50160

Use lin_comb() in AES bit decomposition.
author Marcel Keller <mkeller@cs.au.dk>
date Tue, 20 Jan 2009 11:30:27 +0100
parents b4d9b373bbab
children e954b0a9c939
files viff/aes.py
diffstat 1 files changed, 7 insertions(+), 2 deletions(-) [+]
line diff
     1.1 --- a/viff/aes.py	Tue Jan 20 10:45:50 2009 +0100
     1.2 +++ b/viff/aes.py	Tue Jan 20 11:30:27 2009 +0100
     1.3 @@ -25,7 +25,7 @@
     1.4  from viff.matrix import Matrix
     1.5  
     1.6  
     1.7 -def bit_decompose(share):
     1.8 +def bit_decompose(share, use_lin_comb=True):
     1.9      """Bit decomposition for GF256 shares."""
    1.10  
    1.11      assert isinstance(share, Share) and share.field == GF256, \
    1.12 @@ -33,8 +33,13 @@
    1.13  
    1.14      r_bits = [share.runtime.prss_share_random(GF256, binary=True) \
    1.15                    for i in range(8)]
    1.16 -    r = reduce(lambda x,y: x + y, [r_bits[i] * 2 ** i for i in range(8)])
    1.17      
    1.18 +    if (use_lin_comb):
    1.19 +        r = share.runtime.lin_comb([2 ** i for i in range(8)], r_bits)
    1.20 +    else:
    1.21 +        r = reduce(lambda x,y: x + y, 
    1.22 +                   [r_bits[i] * 2 ** i for i in range(8)])
    1.23 +
    1.24      c = share.runtime.open(share + r)
    1.25      c_bits = [Share(share.runtime, GF256) for i in range(8)]
    1.26