/rev/c15bc2925969
changeset: 1198:c15bc2925969
user:      Marcel Keller <[email protected]>
date:      Fri Jul 03 10:48:59 2009 +0200
summary:   Added possibility to specify key length by a parameter.

diffstat:

 apps/aes.py |  7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diffs (31 lines):

diff -r b1ee0d5e116f -r c15bc2925969 apps/aes.py
--- a/apps/aes.py       Wed May 27 16:12:42 2009 +0200
+++ b/apps/aes.py       Fri Jul 03 10:48:59 2009 +0200
@@ -35,6 +35,9 @@
 
 
 parser = OptionParser(usage="Usage: %prog [options] config_file")
+parser.add_option("-K", "--keylength", action="store", type="int",
+                  help="Key length: 128, 192, or 256. Defaults to 128.")
+parser.set_defaults(keylength=128)
 parser.add_option("-e", "--exponentiation", action="store", type="int",
                   metavar="variant",
                   help="Use exponentiation to invert bytes. "
@@ -67,7 +70,7 @@
     start = time.time()
     print "Started at %f." % start
 
-    aes = AES(rt, 192, use_exponentiation=options.exponentiation)
+    aes = AES(rt, options.keylength, use_exponentiation=options.exponentiation)
 
     ciphertext = []
 
@@ -88,7 +91,7 @@
 def share_key(rt):
     key =  []
 
-    for i in range(24):
+    for i in range(options.keylength / 8):
         inputter = i % 3 + 1
         if (inputter == id):
             key.append(rt.input([inputter], GF256, ord("b")))
_______________________________________________
viff-commits mailing list
[email protected]
http://lists.viff.dk/listinfo.cgi/viff-commits-viff.dk

Reply via email to