title: SALT and HASH using pbkdf2
body: <p>I am using the following methods to create a salted and hashed password from the crypto lib in nodejs:</p>
  
  <pre><code>crypto.randomBytes(size, [callback])
  crypto.pbkdf2(password, salt, iterations, keylen, callback)
  </code></pre>
  
  <p>For the randomBytes call (creating the SALT) what size should I use? I have heard 128-bit salts, maybe up to 256-bit. It looks like this function uses a size in bytes so can I assume a size of 32 (256 bits) is sufficient?</p>
  
  <p>For the pbkdf2 call, what is a good number of iterations and what is a good length for the key (keylen)?</p>
  
  <p>Also, for storage I have seen examples of storing the salt, length, iterations and derviedkey in the same column. I am using an example which separates the 4 by <code>::</code>, i.e.:</p>
  
  <pre><code>salt::derivedKey::keyLength::iterations
  </code></pre>
  
  <p>Doing this, I can then separate on <code>::</code> to get the 4 values, so I can generate a derived key based on a provided password to see if it matches. Is this the correct way to store this? Or should I be a little more "deceptive" in combining these values?</p>