# Path: aespython/aes_tables.py



from .aes_tables import sbox,rcon
    _n32=_n==32
    n0=new_key[-4]
    n1=new_key[-3]
    n2=new_key[-2]
    n3=new_key[-1]
    _n0=-_n
    _n1=1-_n
    _n2=2-_n
    _n3=3-_n
    _n=_expanded_key_length[_n]-_n
    nex=new_key.extend
    while 1:
        #Copy last 4 bytes of extended key, apply core, increment rcon_iter,
        #core Append the list of elements 1-3 and list comprised of element 0 (circular rotate left)
        #core For each element of this new list, put the result of sbox into output array.
        #xor with 4 bytes n bytes from end of extended key
        #First byte of output array is XORed with rcon(iter)
        nx=n0,n1,n2,n3=(sbox[n1]^rcon[rcon_iter]^new_key[_n0],
            sbox[n2]^new_key[_n1],
            sbox[n3]^new_key[_n2],
            sbox[n0]^new_key[_n3])
        nex(nx)
        rcon_iter += 1

        #Run three passes of 4 byte expansion using copy of 4 byte tail of extended key
        #which is then xor'd with 4 bytes n bytes from end of extended key
        nx=n0,n1,n2,n3=(n0^new_key[_n0],
            n1^new_key[_n1],
            n2^new_key[_n2],
            n3^new_key[_n3])

# Path: aespython/aes_tables.py



# Path: aespython/key_expander.py
from .aes_tables import sbox,rcon

    _n32=_n==32
    n0=new_key[-4]
    n1=new_key[-3]
    n2=new_key[-2]
    n3=new_key[-1]
    _n0=-_n
    _n1=1-_n
    _n2=2-_n
    _n3=3-_n
    _n=_expanded_key_length[_n]-_n
    nex=new_key.extend
    while 1:
        #Copy last 4 bytes of extended key, apply core, increment rcon_iter,
        #core Append the list of elements 1-3 and list comprised of element 0 (circular rotate left)
        #core For each element of this new list, put the result of sbox into output array.
        #xor with 4 bytes n bytes from end of extended key
        #First byte of output array is XORed with rcon(iter)
        nx=n0,n1,n2,n3=(sbox[n1]^rcon[rcon_iter]^new_key[_n0],
            sbox[n2]^new_key[_n1],
            sbox[n3]^new_key[_n2],
            sbox[n0]^new_key[_n3])
        nex(nx)
        rcon_iter += 1

        #Run three passes of 4 byte expansion using copy of 4 byte tail of extended key
        #which is then xor'd with 4 bytes n bytes from end of extended key
        nx=n0,n1,n2,n3=(n0^new_key[_n0],
            n1^new_key[_n1],
            n2^new_key[_n2],
            n3^new_key[_n3])

        nex(nx)