Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>It <strong>doesn't matter</strong> if your salts are hashed or left as plain strings - the important point is that salting a password prevents the direct use of dictionary/rainbow table attacks to brute-force crack passwords. An added advantage is that each user has a different hashed password as a result.</p> <p>Salts are randomly generated string that are created server-side and don't involve any kind of transmission to or from the browser.</p> <p>On your server:</p> <pre><code> // Password from form $pw = $_GET['password']; // Generate salt using unique values $salt = (rand(8).$registration_date.$username); // Password to be hashed $pwthb = ($pw.$salt); </code></pre> <p>If a hacker gains access to your databases, then your <em>game is over</em> in the majority of cases as you need to store the initial random salt to hash it for comparison.</p> <p>A simple example:</p> <ol> <li>User enters initial password in browser upon registration</li> <li>On your server, password is combined with a unique salt, hashed and stored as password in DB</li> <li>Salt is stored in DB</li> </ol> <p><em>Note: hashing can be done using PHP or using MySQL/DB functions</em></p> <p>When the user returns:</p> <ol> <li>User enters password in browser</li> <li>Grab salt from DB and combine with the password entered</li> <li>Hash password+salt and compare with stored/hashed password</li> <li>If they match: authenticate</li> </ol> <p>In terms of further reading, It's probably worth looking over the following:</p> <ul> <li><a href="https://security.stackexchange.com/questions/16009/is-encrypting-a-salt-value-with-a-password-plaintext-a-viable-alternative-to-str">Is encrypting a salt value with a password/plaintext a viable alternative to straight up hashing?</a><br></li> <li><a href="https://stackoverflow.com/questions/213380/the-necessity-of-hiding-the-salt-for-a-hash">The necessity of hiding the salt for a hash</a></li> <li><a href="https://stackoverflow.com/questions/6141537/how-store-salt-in-distributed-environment">How store salt in distributed environment</a></li> </ul>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

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