# Path: aespython/aes_tables.py



from .aes_tables import sbox,i_sbox,galI,galNI
#!/usr/bin/env python
"""
AES Block Cipher.

Performs single block cipher decipher operations on a 16 element list of integers.
These integers represent 8 bit bytes in a 128 bit block.
The result of cipher or decipher operations is the transformed 16 element list of integers.

Algorithm per NIST FIPS-197 http://csrc.nist.gov/publications/fips/fips197/fips-197.pdf

Copyright (c) 2010, Adam Newman http://www.caller9.com/
Licensed under the MIT license http://www.opensource.org/licenses/mit-license.php
"""
__all__ = "AESCipher",

class AESCipher:
    __slots__ = "_Nr", "_Nrr", "_f16","_l16"
    def __init__(self,expanded_key):
        self._Nr=[expanded_key[i:i+16] for i in range(16,len(expanded_key)-16,16)]
        self._Nrr=self._Nr[::-1]
        self._f16=expanded_key[:16]
        self._l16=expanded_key[-16:]

# Path: aespython/aes_tables.py



# Path: aespython/aes_cipher.py
from .aes_tables import sbox,i_sbox,galI,galNI

#!/usr/bin/env python
"""
AES Block Cipher.

Performs single block cipher decipher operations on a 16 element list of integers.
These integers represent 8 bit bytes in a 128 bit block.
The result of cipher or decipher operations is the transformed 16 element list of integers.

Algorithm per NIST FIPS-197 http://csrc.nist.gov/publications/fips/fips197/fips-197.pdf

Copyright (c) 2010, Adam Newman http://www.caller9.com/
Licensed under the MIT license http://www.opensource.org/licenses/mit-license.php
"""
__all__ = "AESCipher",

class AESCipher:
    __slots__ = "_Nr", "_Nrr", "_f16","_l16"
    def __init__(self,expanded_key):
        self._Nr=[expanded_key[i:i+16] for i in range(16,len(expanded_key)-16,16)]
        self._Nrr=self._Nr[::-1]
        self._f16=expanded_key[:16]
        self._l16=expanded_key[-16:]

    def cipher_block(z,s0,s=sbox,g0=galNI[0],g1=galNI[1]):