title: Encrypting a file from a password using libgcrypt
body: <p>I'm developing simple software that does aes256-cbc encryption of a file. I'm using GNU/Linux and libgcrypt-1.5.0.  The IV is randomly generated with the OpenSSL rand function and the IV is stored before the ciphertext in the output file.  I'm using the PKCS#7 padding method.</p>
  
  <p>Now I am in doubt about how to proceed:</p>
  
  <ol>
  <li><p>It is better to use sha256 repeated 50,000 times of the inputed password to encrypt the file, or it is better to use the password given by the user?</p></li>
  <li><p>If I want to check the correctness of the inputed password, I have to store it into the encrypted file (obviously encrypted). Is it correct to do this?</p></li>
  </ol>