Consider the following two methods:
hashedPassword = hash(trulyRandomSalt + password)
Where hashedPassword and the trulyRandomSalt are stored in the database.
hashedPassword = hash(applicationConstantPepper + uniqueUserName + password)
Where the hashedPassword and uniqueUserName are stored in the database and the applicationConstantPepper is stored in the application config. Here, the uniqueUserName acts as a salt which are usually email addresses.
I have read this question which has a lot of great information but doesn't address an application constant pepper value and how that will improve using usernames as a salt.
I have always used method one with a 32 bit cryptographically random salt. However, I've just seen method two used in another application. The first issue I have with method two is that it ties the username to the hash so that the username can never change without regenerating the hash.
What are the security issues with method two? Which would be the best method to use?