changeset 1095:e5bb773fb1fe

Integrated and improved documentation of the AES module.
author Marcel Keller <mkeller@cs.au.dk>
date Fri, 30 Jan 2009 12:33:30 +0100
parents bdab6f30511a
children 072920ec7f69
files doc/aes.txt doc/implementation.txt viff/aes.py
diffstat 3 files changed, 20 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/doc/aes.txt	Fri Jan 30 12:33:30 2009 +0100
@@ -0,0 +1,6 @@
+
+AES Module
+==========
+
+.. automodule:: viff.aes
+   :members:
--- a/doc/implementation.txt	Thu Jan 29 16:19:49 2009 +0100
+++ b/doc/implementation.txt	Fri Jan 30 12:33:30 2009 +0100
@@ -18,3 +18,4 @@
    comparison
    prss
    config
+   aes
--- a/viff/aes.py	Thu Jan 29 16:19:49 2009 +0100
+++ b/viff/aes.py	Fri Jan 30 12:33:30 2009 +0100
@@ -58,6 +58,18 @@
 
 
 class AES:
+    """AES instantiation:
+
+    >>> aes = AES(runtime, 192)
+    >>> cleartext = [Share(runtime, GF256, GF256(0)) for i in range(128/8)]
+    >>> key = [runtime.prss_share_random(GF256) for i in range(192/8)]
+    >>> ciphertext = aes.encrypt("abcdefghijklmnop", key)
+    >>> ciphertext = aes.encrypt(cleartext, "keykeykeykeykeykeykeykey")
+    >>> ciphertext = aes.encrypt(cleartext, key)
+
+    In every case *ciphertext* will be a list of shares over GF256.
+    """
+
     def __init__(self, runtime, key_size, block_size=128, 
                  use_exponentiation=False):
         """Initialize Rijndael.
@@ -158,7 +170,7 @@
                                     [bits[j] * 2**j for j in range(len(bits))])
 
     def shift_row(self, state):
-        """AES ShiftRow.
+        """Rijndael ShiftRow.
 
         State should be a list of 4 rows."""