title: Using mcrypt_create_iv to create salt?
body: <p>I'm currently in the process of learning how hashing + salting works, I'm currently using this code on PHP to generate 'salt'</p>
  
  <pre><code>function calculateSalt(){
  $iv = mcrypt_create_iv(16, MCRYPT_DEV_URANDOM);
  return $iv;
  }
  </code></pre>
  
  <p>In theory this should return a good salt for hashing my passwords with. When I applied it to my small database of test passwords It seem'd like it looked pretty secure and unique although as this is a very low amount of test passwords I was wondering If this is an acceptable way to generate a good, unique salt or if <code>mcrypt_create_iv</code> was bad practice. From what I can tell it's main purpose isn't for salting but would It be bad If I used it for this purpose?</p>
  
  <p>Note this database is not of public passwords, just test cases. Here is the salt + hashes using the above technique.
  <img src="https://i.stack.imgur.com/jcSr0.png" alt="salted + hashed passwords using above technique"></p>