title: CodeIgniter - Use a static IV when using AES in CBC mode
body: <p><strong>Codeigniter 3.x</strong></p>
  
  <p>Hello guys. I have a question about using IV in the encryption class in CodeIgniter. I would like to create a key based on 2 inputs. I have a Python script which we already use to create the key, but I am trying to rebuild this in CodeIgniter. I have read about the encryption class, but I am relatively new to cryptography so I don't know if what I am doing is even possible. </p>
  
  <p><strong>Python</strong></p>
  
  <p>Let's say I have a python function like this :</p>
  
  <pre><code>import base64
  from Crypto.Cipher import AES
  
  def encrypt(key, init_vector, value):
      enc = AES.new(key, AES.MODE_CBC, init_vector)
      return enc.encrypt(value)
  </code></pre>
  
  <p>Then we have 2 user-based inputs, where var needs to be 14 characters, and an integer which needs to be 2 characters:</p>
  
  <pre><code>var = "abcdefghijklmn"
  int = "01"
  </code></pre>
  
  <p>Then we create the key, with a static key and IV:</p>
  
  <pre><code>key = base64.b64encode(encrypt("abcdefghikjlmnop", "the_static_IV", var+int))
  </code></pre>
  
  <p>And this results in our key.</p>
  
  <p><strong>Encryption Library</strong></p>
  
  <p>Now I know the Encryption library in CI is able to do this, but I am not able to use a static IV. The IV is generated randomly ( which I have read is actually the better practice ), so this approach isn't going to work. Does anybody know if I could use a static IV in CI, or am I able to generate a decryptable key with only knowing the key used to generate it? And if so, how could I achieve this?</p>