http://hg.viff.dk/viff/rev/6b80efc3bfc5
changeset: 1139:6b80efc3bfc5
user:      Marcel Keller <[email protected]>
date:      Wed Feb 18 20:13:57 2009 +0100
summary:   Encrypting several blocks in parallel possible in AES example 
application.

diffstat:

1 file changed, 9 insertions(+), 2 deletions(-)
apps/aes.py |   11 +++++++++--

diffs (28 lines):

diff -r cecc7b3c6eb0 -r 6b80efc3bfc5 apps/aes.py
--- a/apps/aes.py       Wed Feb 18 14:32:24 2009 +0100
+++ b/apps/aes.py       Wed Feb 18 20:13:57 2009 +0100
@@ -48,6 +48,9 @@
 parser.set_defaults(exponentiation=1)
 parser.add_option("-o", "--at-once", action="store_true",help="Prepare "
                   "the whole computation at once instead of round-wise.")
+parser.add_option("-c", "--count", action="store", type="int",
+                  help="Number of blocks to encrypt. Defaults to 1.")
+parser.set_defaults(count=1)
 
 # Add standard VIFF options.
 Runtime.add_options(parser)
@@ -64,8 +67,12 @@
     print "Started at %f." % start
 
     aes = AES(rt, 192, use_exponentiation=options.exponentiation)
-    ciphertext = aes.encrypt("a" * 16, key, True, 
-                             prepare_at_once=options.at_once)
+
+    ciphertext = []
+
+    for i in range(options.count):
+        ciphertext += aes.encrypt("a" * 16, key, True, 
+                                  prepare_at_once=options.at_once)
 
     opened_ciphertext = [rt.open(c) for c in ciphertext]
 
_______________________________________________
viff-commits mailing list
[email protected]
http://lists.viff.dk/listinfo.cgi/viff-commits-viff.dk

Reply via email to