title: AES: Input strings must be a multiple of 16 in length
body: <p>I want to make a script to decrypt my filess, but when I try to run my script then show me this message , how can I fix it?</p>
  
  <blockquote>
    <p>Traceback (most recent call last):   File "F:\bug_bounty\decrypt.py",
    line 46, in    File "F:\bug_bounty\decrypt.py", line 24, in
    decrypt   File
    "C:\Python27\lib\site-packages\Crypto\Cipher\blockalgo.py", line 295,
    in decrypt
        return self._cipher.decrypt(ciphertext) ValueError: Input strings must be a multiple of 16 in length</p>
  </blockquote>
  
  <pre><code>from Crypto.Hash import SHA256
  from Crypto.Cipher import AES
  import os
  import random
  import sys
  
  
  def decrypt(key, filename):
      outFile = os.path.join(os.path.dirname(filename),
                             os.path.basename(filename[11:]))
      chunksize = 64 * 1024
      with open(filename, 'rb') as infile:
          filesize = infile.read(16)
          IV = infile.read(16)
  
          decryptor = AES.new(key, AES.MODE_CBC, IV)
  
          with open(outFile, 'wb') as outfile:
              while True:
                  chunk = infile.read(chunksize)
                  if len(chunk) == 0:
                      break
  
                  outfile.write(decryptor.decrypt(chunk))
  
              outfile.truncate(int(filesize))
  
  
  def allfiles():
      allFiles = []
      for (root, subfiles, files) in os.walk(os.getcwd()):
          for names in files:
              allFiles.append(os.path.join(root, names))
  
      return allFiles
  
  
  password = 'M4st3rRul3zs'
  files = allfiles();
  for filename in files:
      if os.path.basename(filename).startswith("(encrypted)"):
         print "%s is already encrypted" %filename
         pass
  
      else:  
          decrypt(SHA256.new(password).digest(), filename)
          print "Done decrypting %s" %filename
          """os.remove(filename)"""
  </code></pre>