title: How to make Python Crypto AES faster
body: <p>I'm looking for a very fast way for encrypting and decrypting short text snippets. Security is secondary in my use-case. Light encryption with a constant IV is fine. I'm currently doing this:</p>
  
  <pre><code>BS = 16
  pad = lambda s: s + (BS - len(s) % BS) * chr(BS - len(s) % BS)
  unpad = lambda s : s[:-ord(s[len(s)-1:])]
  
  import base64
  from Crypto.Cipher import AES
  
  iv = '0123456789012345'
  def encrypt(raw, key):
      raw = pad(raw)
      cipher = AES.new(key, AES.MODE_CBC, iv)
      return base64.b64encode( cipher.encrypt( raw ) )
  
  def decrypt(enc, key):
      enc = base64.b64decode(enc)
      cipher = AES.new(key, AES.MODE_CBC, iv)
      return unpad(cipher.decrypt( enc ))
  
  enc_text = encrypt('Hello World!','xyz1234567890abc')
  print decrypt(enc_text, 'xyz1234567890abc')
  </code></pre>
  
  <p>How can I make this faster? Maybe by using another AES mode (MODE_CBC?), or is there a faster padding function, a faster way of hex-converting the output?</p>