title: PHP: Does iterating a hash make it more secure?
body: <p>I wanted to know if the process of hashing a hash would help stop attacks to it (brute-force I think) when used with salt as well. So my code:</p>
  
  <pre><code>function hash_password($password, $salt, $site_key) {
      $hash = hash('sha512', $password . $salt . $site_key);
      for ($i=0; $i&lt;1000; $i++) {
          $hash = hash($hash);
      }
      return $hash;
  }
  </code></pre>
  
  <p>From what I can work out my code would be secure because it stops rainbow table attacks by using salt, and stops brute-force attacks by iterating the hash.</p>
  
  <p>Would this iteration actually make brute-force attacks much harder?
  And if so how much would it affect the performance? (how long would it take to hash 1000 times, I heard someone said you should iterate the hash until it takes 200ms)</p>
  
  <p>Does doing this emulate the behaviour of an algorithm such as bcrypt?</p>