What hashing method should you use?
For the longest time MD5 was has been to hash passwords for database lookup and has served a secure and viable way to store one-way passwords without revealing the password itself. MD5 has become under scrutiny for having not a significant amount of required plaintext searches to find a collision. SHA-1 is the often recommended alternative for less collisions and less-constructred rainbowtable dictionaries but still remains cyptographically weak.
Here are side-by-side performance benchmarks on each of the cryptogaphical hash functions that are available usually by default to PHP: [hash('type', 'plaintext');], sorted by size of the key bit length and results are in seconds.
The test plaintext for the iterations is the following:
"The quick brown fox jumped over the lazy dog." and should result in exactly 45000000 bytes ( 45MBs ) of data hashed by each hash function.
Weak:
Time elapsed for 1000000 iterations of md4: 2.320000 Collision: 31
Time elapsed for 1000000 iterations of md5: 2.410000 Collision: 224.1
Time elapsed for 1000000 iterations of sha1: 3.110000 Collision: 264
128 bit:
Time elapsed for 1000000 iterations of tiger128,3: 3.390000 Collision: 244
Time elapsed for 1000000 iterations of haval128,3: 5.230000
Time elapsed for 1000000 iterations of ripemd128: 3.690000 Collision: 26
160 bit:
Time elapsed for 1000000 iterations of ripemd160: 4.230000
Time elapsed for 1000000 iterations of tiger160,3: 3.400000 Collision: 262
192 bit:
Time elapsed for 1000000 iterations of tiger192,4: 3.960000
256 bit:
Time elapsed for 1000000 iterations of sha256: 4.100000 Collision: 2251.7
Time elapsed for 1000000 iterations of haval256,5: 8.100000
Time elapsed for 1000000 iterations of snefru: 23.840000 Collision: 288.5
Time elapsed for 1000000 iterations of gost: 15.010000
384 bit:
Time elapsed for 1000000 iterations of sha384: 12.970000
512 bit:
Time elapsed for 1000000 iterations of sha512: 13.070000 Collision: 2502
Time elapsed for 1000000 iterations of whirlpool: 15.320000 Collision: 2128