title: Why not use MD5 for password hashing?
body: <p>I have a friend which is a white hat hacker. He says that md5 is not really that bad and actually is really secure, just if we use it properly.</p>
  
  <p>I believe that he is right. As I know, there is 3 ways to break hashes:</p>
  
  <ol>
  <li>Using Rainbow tables (Which can be secured against by a long/random salt)</li>
  <li>Collision (Which can be prevented by multiple salts or hashes - as in example bellow)</li>
  <li>Generation time (Which is not much important if we use a long enough salt value per each user - AFAIK)</li>
  </ol>
  
  <p>I and my friend believe that Blowfish is not really needy, also it can be harmful because it can slow down password validation process and it can be used with DDOS attacks to break down server even with fewer attak-resources.</p>
  
  <p>So, I want to make sure that is following algorithm really secure or not? And, is there a real reason to go with Blowfish hash algorithm or not?</p>
  
  <pre><code>// return a 256 bit salt + 128 bit md5 binary hash value
  function hash(password, salt=null)
  {
      salt = (salt != null) ? salt : Random256BitBinaryValueGenerator();
      // What about using another user-specified parameter, like email address as salt?
  
      return salt + md5(salt + password) + md5(password + salt);
  
      // Or just use a non-cryptographic hash algorithm like crc32 to prevent collisions:
      // return salt + md5(salt + password) + crc32(salt + password);
  
      // Or even use two different salts:
      // return salt + md5(salt + password) + md5('C' + salt + password);
  }
  
  // check password
  function check(password, hash_value)
  {
      return hash(password, substring(hash_value, 0, 32)) == hash_value;
  }
  </code></pre>