def aes_encrypt(data, expanded_key):
 rounds = ((len(expanded_key) // BLOCK_SIZE_BYTES) - 1)
 data = xor(data, expanded_key[:BLOCK_SIZE_BYTES])
 for i in range(1, (rounds + 1)):
  data = sub_bytes(data)
  data = shift_rows(data)
  if (i != rounds):
   data = mix_columns(data)
  data = xor(data, expanded_key[(i * BLOCK_SIZE_BYTES):((i + 1) * BLOCK_SIZE_BYTES)])
 return data

def aes_encrypt ( data , expanded_key ) : rounds = ( ( len ( expanded_key ) // BLOCK_SIZE_BYTES ) - 1 ) data = xor ( data , expanded_key [ : BLOCK_SIZE_BYTES ] ) for i in range ( 1 , ( rounds + 1 ) ) : data = sub_bytes ( data ) data = shift_rows ( data ) if ( i != rounds ) : data = mix_columns ( data ) data = xor ( data , expanded_key [ ( i * BLOCK_SIZE_BYTES ) : ( ( i + 1 ) * BLOCK_SIZE_BYTES ) ] ) return data
return a version of the data that has been encrypted to .