I am updating my helper functions library. I am wondering whether it is too much of salt in the password encryption?
Is there any difference between:
mb_substr(sha1($str . AY_HASH), 5, 10) . mb_substr(sha1(AY_HASH . sha1($str . AY_HASH)), 5, 10) . mb_substr(md5($str . AY_HASH), 5, 10)
and simply:
sha1(AY_HASH . sha1($str . AY_HASH))
AY_HASH being the salt. Which should I prefer and if neither is good, what is the best alternative?
A salt should be generated for each password, not a secret string used on every password. Re-using a salt means that the attacker will only need to create one rainbow table for every password instead of one per password.
I invite you to read a previous answer I wrote on secure hashing. The rules are simple:
If anything however, you should use bcrypt, which is future-adaptable. Again, I invite you to my previous answer for a more detailed example.