title: what is an alternative to password_hash() for (PHP 5 < 5.5.0)?
body: <p>According to manual: <a href="http://www.php.net/manual/en/function.password-hash.php">password_hash</a> this function can be used for <code>(PHP 5 &gt;= 5.5.0)</code></p>
  
  <p>After searching for an alternative way I found this simple function from here: <a href="http://www.sitepoint.com/password-hashing-in-php/">http://www.sitepoint.com/password-hashing-in-php/</a></p>
  
  <pre><code>function generateHash($password) {
      if (defined("CRYPT_BLOWFISH") &amp;&amp; CRYPT_BLOWFISH) {
          $salt = '$2y$11$' . substr(md5(uniqid(rand(), true)), 0, 22);
          return crypt($password, $salt);
      }
  }
  </code></pre>
  
  <p>I can manage my code by using <code>function_exists</code> before using, but My question is about above alternative code if its secure or not, or is there any alternative in older versions of PHP?</p>