BrianGladman/AES — pull request #2 by Rupan (2014-09-03 06:54:10+00:00)
Title: Fix Python2 bindings

Some of the module changes broke the Python 2 support. I've restored that functionality and started work on Python 3 support. The way it will probably work in Python 3 is something like this:
```
#!/usr/bin/python3

import brg
from os import urandom

# bytearray is a mutable sequence of integers in the range 0 <= x < 256
# https://docs.python.org/3.1/library/functions.html#bytearray
data = bytearray('AB' * 32 + 'ZY' * 32, 'utf8')

# os.urandom returns a 'bytes' object
# bytes is an immutable version of bytearray
random_iv = urandom(16)
random_key = urandom(16)

# In python3, the constructor fails with a traceback
# There is some issue with the format string when parsing arguments
# https://docs.python.org/3.1/c-api/arg.html
aes_ecb = brg.aes(key=random_key, mode='ecb')
aes_cbc = brg.aes(key=random_key, mode='cbc', iv=random_iv)
```