should I store all encrypted password to database using generate_password_hash()
<p>When I use <code>generate_password_hash()</code> function, I get a encrypted password string which contains a random salt.</p>

<pre><code>&gt;&gt;&gt; from werkzeug.security import generate_password_hash, check_password_hash
&gt;&gt;&gt; generate_password_hash('password')
&gt;&gt;&gt; 'pbkdf2:sha1:1000$3j8Brovx$9acddcd67da9e4c913817231c882a0f757e2d095'
</code></pre>

<p>If I store this string to database, someone else hacked into my database and get this string, it's easy to get the origin password using brute force cracking becasue the encrypted password contains the salt. </p>

<pre><code>check_password_hash('pbkdf2:sha1:1000$9HycZ0Qa$94f08a91fba1c040c5bffb6c7e1ab5a6ad4818de', 'password')
</code></pre>

<p>Should I encrypt the origin password using my own salt first before using <code>generate_password_hash()</code> or is there a better solution?</p>

<p>Thanks.</p>

<blockquote>
  <p>it's easy to get the origin password using brute force cracking because the encrypted password contains the salt.</p>
</blockquote>

<p>No, it's "easy" to brute force, because you're having a low iteration count of 1000.</p>

<blockquote>
  <p>Should I encrypt the origin password using my own salt first before using <code>generate_password_hash()</code> or is there a better solution?</p>
</blockquote>

<p>No, encryption is reversible and since a lost database also means that the encryption key is probably lost too, this would mean that the additional encryption is useless.</p>

<p>An easy fix would be to increase the number of iterations to a million or 10 million depending on what you can afford on your server that your users don't run away because of a slow authentication procedure.</p>

<pre><code>generate_password_hash('password', method='pbkdf2:sha256:1000000')
</code></pre>

<p>The problem with PBKDF2 is that it can be easily parallelized, because it doesn't need much memory. There are alternatives such as scrypt and Argon2 which can be configured to require much memory. Memory is currently the main limitation of dedicated password brute forcing machines based on ASICs.</p>

<p>Ultimately, nothing you do, will lead to a secure authentication system if your users are using "password1" as their password. You should require your users to use complicated passwords with at least 12 characters including uppercase letters, lowercase letter and numbers (optionally including special characters). Those should also not be part of a dictionary.</p>

<p>See more: <a href="http://security.stackexchange.com/q/211/45523">How to securely hash passwords?</a></p>

python encryption flask