I am trying to encrypt a bitstream data or basically a list of binary data like this [1,0,1,1,1,0,0,1,1,0,1,1,0,1] in python using AES encryption with block size of 128bit, the problem is that i want the output to be binary data as well and the same size as the original binary data list, is that possible?how do i do that?
Yes, there are basically two ways:
You have a unique value tied to the data (for instance if they are provided in sequence then you can create a sequence number) then you can simply use the unique value as nonce and then use AES encryption in counter mode. Counter mode doesn't expand the data but it is insecure if no nonce is supplied. Note that you do need the nonce when decrypting.
You use format preserving encryption or FPE such as FF1 and FF3 defined by NIST. There are a few problems with this approach:
Neither of these schemes provide integrity or authenticity of the data obviously, and they by definition leak the size of the plaintext.