title: Encrypt & Decrypt using PyCrypto AES 256
body: <p>I'm trying to build two functions using PyCrypto that accept two parameters: the message and the key, and then encrypt/decrypt the message.</p>
  
  <p>I found several links on the web to help me out, but each one of them has flaws:</p>
  
  <p><a href="http://www.codekoala.com/blog/2009/aes-encryption-python-using-pycrypto/" rel="noreferrer">This one at codekoala</a> uses os.urandom, which is discouraged by PyCrypto.</p>
  
  <p>Moreover, the key I give to the function is not guaranteed to have the exact length expected. What can I do to make that happen ?</p>
  
  <p>Also, there are several modes, which one is recommended? I don't know what to use :/</p>
  
  <p>Finally, what exactly is the IV? Can I provide a different IV for encrypting and decrypting, or will this return in a different result?</p>
  
  <p><strong>Edit</strong>: Removed the code part since it was not secure.</p>