Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p><b>update</b>: use a competent library e.g. <a href="http://code.google.com/p/passlib/" rel="noreferrer">passlib</a> for Python.</p> <p>These take care of generating a per-password salt and they use a proper hashing algorithm (its not enough to just use a cryptographic hash such as SHA1; you have to apply it in a way that makes it very slow to reverse e.g. looping 1000 or more times over it etc. This is how password hash functions like <a href="http://en.wikipedia.org/wiki/Bcrypt" rel="noreferrer">bcrypt</a> work. Password storing libraries do all this properly; they typically produce a string that is delimited so they can determine the hash system and work factor used; you just store the string without needing to know this.</p> <hr/> <p>You can store the salt in 'plain-text' in the table.</p> <ul> <li><p>The salt does not need to be secret to be effective</p></li> <li><p>it just needs to be random.</p></li> </ul> <p>The salt strengthens a password by making the hashed value incomparable to the same password in the same or other database, and invalidating large pre-generated lists of common password to hash lookups (e.g. 'rainbow tables').</p> <p>So it's critical that the salt is unique per user and is some random value stored with the password; the alternatives outlined in the question (using the username as the salt, using a single salt value for the whole application) each fail:</p> <ul> <li><p>if systems use the user-name or other trivia, then the password can be compared to other users with the same name in other systems (imagine how often the 'administrator' or 'root' user account uses the same password in different systems...)</p></li> <li><p>if the system uses a single random salt for all users in the same system, then two users who by chance have the same password would have the same hash, and guessing one user's password would trivially compromise the other.</p></li> </ul>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload