Hi,
On my websites, I encrypt passwords using a combination of hashing algorithm (Which I am obviously not going to post on a forum but its along the lines of md5(substr(whirlpool($Value), 0, 7)); )
What is blowfish, how do I use it and how much more secure is it than a function as shown above?
Regards,
Sam Rudge
Why not just save the whole hash generated by whirlpool? Using md5 effectively reduces the size of the hash, making it easier to guess (find collisions).
Taking a substr() of 7 characters makes it very insecure. You've effectively made the password a 7 character string composed of 0-9 and a-f. (hexadecimal).
This makes guessing the password less then 16^7 possibilities, which is very insecure. A single machine would guess it in less then an hour. A rainbow table, a few seconds.
I've updated the linked thread with a few tips:
http://www.daniweb.com/forums/thread178241.html
You can actually use blowfish, enough though it is a cypher. Part of its algorithm is used in BCrypt (
http://www.usenix.org/events/usenix9...tml/node1.html) which is the password hashing function in OpenBSD.
The reason is that blowfish uses 4Kb of RAM when processing keys. Thus you can make it process a large number of keys, in order to make sure your algorithm uses a large amount of ram.
Say you want to use 1MB for each hashing function. You could generate 1000/4 keys, and feed them into blowfish then rehash. Note this isn't to encrypt the password, you just want to take up 1MB of RAM, so that anyone trying a brute force attack on the hashes requires 1MB for each hash which is unfeasible for them.
You however, can afford 1MB since logins are not a bottleneck on web applications. Things like disk and network IO usually are.