擅长:python、mysql、java
<p>使用py bcrypt,不需要单独存储盐:<code>bcrypt</code>将盐存储在散列中。</p>
<p>您可以简单地将散列用作盐,盐存储在散列的开头。</p>
<pre><code>>>> import bcrypt
>>> salt = bcrypt.gensalt()
>>> hashed = bcrypt.hashpw('secret', salt)
>>> hashed.find(salt)
0
>>> hashed == bcrypt.hashpw('secret', hashed)
True
>>>
</code></pre>