title: PHP md5 and sha1 confusion - Why am I getting different encryption results?
body: <p>I have a php function in a php page called encrypt_password that I use when processing a registration form:</p>
  
  <pre><code>function encrypt_password($password){
  
      $salt  = sha1(md5($password));
      $password = md5($password.$salt);
  
      return $password;
  }
  </code></pre>
  
  <p>I try to use it again for when I process the login form but I get a different result.</p>
  
  <p>I get the correct result just by not calling this function and instead just calling:</p>
  
  <pre><code>$salt  = sha1(md5($password));
  $password = md5($password.$salt);
  </code></pre>
  
  <p>directly on my process_login page. Why would I get a different result by calling encrypt_password?</p>
  
  <p>I hope I have explained this clearly enough!
  Thanks!</p>