viff

changeset 1139:6b80efc3bfc5

Encrypting several blocks in parallel possible in AES example application.
author Marcel Keller <mkeller@cs.au.dk>
date Wed, 18 Feb 2009 20:13:57 +0100
parents cecc7b3c6eb0
children cbdcba8630c5
files apps/aes.py
diffstat 1 files changed, 9 insertions(+), 2 deletions(-) [+]
line diff
     1.1 --- a/apps/aes.py	Wed Feb 18 14:32:24 2009 +0100
     1.2 +++ b/apps/aes.py	Wed Feb 18 20:13:57 2009 +0100
     1.3 @@ -48,6 +48,9 @@
     1.4  parser.set_defaults(exponentiation=1)
     1.5  parser.add_option("-o", "--at-once", action="store_true",help="Prepare "
     1.6                    "the whole computation at once instead of round-wise.")
     1.7 +parser.add_option("-c", "--count", action="store", type="int",
     1.8 +                  help="Number of blocks to encrypt. Defaults to 1.")
     1.9 +parser.set_defaults(count=1)
    1.10  
    1.11  # Add standard VIFF options.
    1.12  Runtime.add_options(parser)
    1.13 @@ -64,8 +67,12 @@
    1.14      print "Started at %f." % start
    1.15  
    1.16      aes = AES(rt, 192, use_exponentiation=options.exponentiation)
    1.17 -    ciphertext = aes.encrypt("a" * 16, key, True, 
    1.18 -                             prepare_at_once=options.at_once)
    1.19 +
    1.20 +    ciphertext = []
    1.21 +
    1.22 +    for i in range(options.count):
    1.23 +        ciphertext += aes.encrypt("a" * 16, key, True, 
    1.24 +                                  prepare_at_once=options.at_once)
    1.25  
    1.26      opened_ciphertext = [rt.open(c) for c in ciphertext]
    1.27