viff

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 diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/doc/aes.txt	Fri Jan 30 12:33:30 2009 +0100
     1.3 @@ -0,0 +1,6 @@
     1.4 +
     1.5 +AES Module
     1.6 +==========
     1.7 +
     1.8 +.. automodule:: viff.aes
     1.9 +   :members:
     2.1 --- a/doc/implementation.txt	Thu Jan 29 16:19:49 2009 +0100
     2.2 +++ b/doc/implementation.txt	Fri Jan 30 12:33:30 2009 +0100
     2.3 @@ -18,3 +18,4 @@
     2.4     comparison
     2.5     prss
     2.6     config
     2.7 +   aes
     3.1 --- a/viff/aes.py	Thu Jan 29 16:19:49 2009 +0100
     3.2 +++ b/viff/aes.py	Fri Jan 30 12:33:30 2009 +0100
     3.3 @@ -58,6 +58,18 @@
     3.4  
     3.5  
     3.6  class AES:
     3.7 +    """AES instantiation:
     3.8 +
     3.9 +    >>> aes = AES(runtime, 192)
    3.10 +    >>> cleartext = [Share(runtime, GF256, GF256(0)) for i in range(128/8)]
    3.11 +    >>> key = [runtime.prss_share_random(GF256) for i in range(192/8)]
    3.12 +    >>> ciphertext = aes.encrypt("abcdefghijklmnop", key)
    3.13 +    >>> ciphertext = aes.encrypt(cleartext, "keykeykeykeykeykeykeykey")
    3.14 +    >>> ciphertext = aes.encrypt(cleartext, key)
    3.15 +
    3.16 +    In every case *ciphertext* will be a list of shares over GF256.
    3.17 +    """
    3.18 +
    3.19      def __init__(self, runtime, key_size, block_size=128, 
    3.20                   use_exponentiation=False):
    3.21          """Initialize Rijndael.
    3.22 @@ -158,7 +170,7 @@
    3.23                                      [bits[j] * 2**j for j in range(len(bits))])
    3.24  
    3.25      def shift_row(self, state):
    3.26 -        """AES ShiftRow.
    3.27 +        """Rijndael ShiftRow.
    3.28  
    3.29          State should be a list of 4 rows."""
    3.30