Recently i was reading a book regarding a safe way to store a password in the database. The book started with MD5, SHA1, and CRYPT_BLOWFISH. From what i read i understand that the safer way to store passwords is by using CRYPT along with random salt per user(a value that the user inserts in while registrating, like username for example), without storing the salt in the database.
So, lets say that i generate a salt:
$salt = '$2y$11$';
$salt = $salt.md5($username);
As we know a MD5 hash is a 32 character long string. So 7+32 = 39 character string = SALT
Something like this: $2y$11$243dc6440dfd91e35a773035da362f4e
Then i generate the hash using crypt()
:
$hash = crypt($password,$salt);
The crypt hash always results in a 60 character string. The result is:
$2y$11$243dc6440dfd91e35a773uY4TBuP14hk.KZq4VvOWV8EhT03Vj8Tu
If a hacker gain access to the database, he/she will see the part $2y$11$
of the 60 character string above.
My question is: Is this info helpful for the hacker (knowing the hashing method and the cost)?
Should I store the hash omitting that part? 243dc6440dfd91e35a773uY4TBuP14hk.KZq4VvOWV8EhT03Vj8Tu
Will this make things worse for the hacker?
Other than these, are there any other suggestions regarding password security AFTER the hacker gains access to the database?