title: TypeError: Object type <class 'str'> cannot be passed to C code
body: <p>I am trying to implement aes encryption and decryption in python. When I execute code, it returns error. I have installed anaconda on my machine. I am running scripts in jupyter notebook.</p>
  
  <pre><code>!pip install pycryptodome
  
  import base64
  from Crypto import Random
  from Crypto.Cipher import AES
  
  BS = 16
  pad = lambda s: s + (BS - len(s) % BS) * chr(BS - len(s) % BS)
  unpad = lambda s : s[0:-ord(s[-1])]
  
  class AESCipher:
  
      def __init__( self, key ):
          self.key = key
  
      def encrypt( self, raw ):
          raw = pad(raw)
          iv = Random.new().read( AES.block_size )
          cipher = AES.new( self.key, AES.MODE_CBC, iv )
          return base64.b64encode( iv + cipher.encrypt( raw ) )
  
      def decrypt( self, enc ):
          enc = base64.b64decode(enc)
          iv = enc[:16]
          cipher = AES.new(self.key, AES.MODE_CBC, iv )
          return unpad(cipher.decrypt( enc[16:] ))
  
  cipher = AESCipher('mysecretpassword')
  encrypted = cipher.encrypt('Secret')
  decrypted = cipher.decrypt(encrypted)
  print(encrypted)
  print(decrypted)
  </code></pre>
  
  <p>How to solve this ?</p>