Credit card

I am trying to understand the basics about encryption. I'm not sure if this code is even something I can use, I just want to better understand so I can write my own program as needed.

I guess the parts that I am confused about are c = cipher and what c.iv = self.iv = generate_iv(passphrase) is doing. I understand that the c.encrypt is just encrypting the credit card number, just not about the rest. Is the c = cipher saying how the long the key will be? And I have no idea about what the c.iv stuff is doing. Thanks,

c = cipher is just caller the cipher method defined above, which just does"aes-256-cbc"), i.e. give me a new cipher object that does 256bit AES in CBC mode. c.encrypt says that you want to encrypt and the iv is the initialization vector. You can read up on that if you want, essentially it's just one of the parameters for the encryption